Skip to content

fix(billing-web): end the handoff tab when Cloud refuses the whole session - #23373

Merged
dante01yoon merged 7 commits into
mainfrom
1.61-billing-handoff/billing-web-handoff-disabled
Nov 15, 2026
Merged

dante01yoon merged 7 commits into
mainfrom
1.61-billing-handoff/billing-web-handoff-disabled

Conversation

@dante01yoon

@dante01yoon dante01yoon commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Dependency graph

graph LR
  A["2b billing-web handoff tab #23224 (merged)"] --> B["end the tab on HANDOFF_DISABLED (this PR)"]
  C["4 Desktop launch #23327"] -.-> D["5 staging and exposure"]
  B -.-> D
  style B stroke-width:3px
Loading

Independent of #23327; both should land before the flag is exposed.

Summary

Why. local_billing_web is the one switch for the billing handoff. Turning it off must take a user out of billing-web, including a tab that already exchanged its handoff.

Root cause. Cloud rechecks the flag on every scoped-session call and answers 403 HANDOFF_DISABLED once it is off. billing-web's handoff client only treated 401 INVALID_CREDENTIAL as the end of the session, so the tab stayed signed in until the session expired (up to 30 minutes from the exchange) while every billing call failed. Cloud still refused the calls; only the screen was wrong.

How.

  • createHandoffBillingClient ends the handoff on every 403 Cloud's scoped-session policy answers for the whole session: HANDOFF_DISABLED, sso_required, account_outside_organization, personal_workspace_disabled and workspace_access_denied, as it already does on 401 INVALID_CREDENTIAL.
  • BILLING_FORBIDDEN keeps the tab. Cloud answers it both when the owner lost the workspace (whole session) and when one request names another workspace, and the body does not tell them apart. Ending on it needs Cloud to separate the two.
  • App.vue renders nothing while an ended handoff tab is replaced to /handoff. Before, the scope went away first and the current billing view remounted outside BillingShell, which threw No billing client (and left the Vite dev server on a blank page). This affected the existing 401 path too.

AS IS. Flag turned off mid-session: the tab keeps showing billing with failed reads.
TO BE. The tab ends on the next billing call. A tab that sent no payment lands on "This checkout link no longer works"; #23395 (merged) picks the ending screen from what the tab knows about a payment.

AS IS TO BE
AS IS: the tab keeps the subscription screen and shows a failed read TO BE: the tab ends on the link screen

Screenshots: real billing-web production build (vite build + vite preview), Cloud mocked with Playwright routes. The handoff exchange and the first billing reads succeed, then every billing call answers 403 HANDOFF_DISABLED and "Cancel subscription" is clicked, which re-reads /billing/status. AS IS is the same build with billingWebClient.ts from the commit before the fix. TO BE was recaptured at 463cf0e, after main with #23395 was merged in.

Found in a cross-review of the handoff (Astra read, confirmed against the code).

Verification

  • Unit (billingWebClient.test.ts): one case per ending 403 code, failing before the fix; BILLING_FORBIDDEN keeps the tab.
  • E2E (e2e/handoff-session-ended.spec.ts, production build): a session refused mid-session with 403 HANDOFF_DISABLED or 401 INVALID_CREDENTIAL reaches "This checkout link no longer works" on /handoff with no page or console error. Failed on the console error before the App.vue change.
  • apps/billing-web: unit session and handoff suites 134 passed; E2E 159 passed before the last commit, handoff specs rerun after it.
  • After merging main (e008428, brings FRONT-3855 fix(billing-web): end every handoff session on a designed ending screen #23395): both E2E cases failed on the removed heading "This checkout session has ended" and nothing else; 463cf0e updates the two expectations and the test title. Handoff E2E specs 13 passed, unit session and handoff suites 151 passed. With billingWebClient.ts reverted to main, the 403 case fails again and the 401 case passes.
  • Cross-reviewed twice (Astra read, each finding reproduced by a failing test before the fix).
  • Not run: a live session against Cloud with the flag flipped; the dev-server blank page was not rechecked after the fix.

…BLED

A scoped-session call refused with 403 HANDOFF_DISABLED left the tab
signed in until the session expired, so turning local_billing_web off
kept the billing UI up for up to 30 minutes with every call failing.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The billing client recognizes additional HTTP 403 session-refusal codes. The app updates fallback route rendering for ended handoffs. Unit and end-to-end tests cover refusal handling and handoff behavior.

Changes: Handoff session refusal handling

Layer / File(s) Summary
Refusal status and code handling
apps/billing-web/src/session/billingWebClient.ts, apps/billing-web/src/session/billingWebClient.test.ts
The client maps HTTP 401 and 403 responses to accepted refusal codes. Unit tests verify that five specified 403 codes invoke onSessionRefused, while BILLING_FORBIDDEN does not.
Ended handoff rendering and end-to-end coverage
apps/billing-web/src/App.vue, apps/billing-web/e2e/handoff-session-ended.spec.ts
The fallback RouterView is suppressed when a handoff tab exists and the current route is not the handoff path. End-to-end tests cover HANDOFF_DISABLED and INVALID_CREDENTIAL responses during cancellation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: drjkl

Merge Risk: Minimal · up to 463cf

This change ends the handoff tab when Cloud refuses the whole session and avoids a blank-page remount error during the redirect. Tests cover the new refusal codes and the existing 401 path. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 6

Check name Status Explanation
Title check Passed The title names the main change: the billing-web handoff tab now ends when Cloud refuses the whole session. The PR adds 403 codes to the ending set, keeps BILLING_FORBIDDEN open, and changes App.vue t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is thorough and covers the template's Summary and Verification sections. The Summary explains the why, root cause, the fix (ending the handoff on five 403 codes plus the existing 401, …
End-To-End Test Suggestion For User-Facing Changes Passed The check does not apply to this PR. Its first failure condition requires a bug fix or feature change in the main frontend application under src/ or packages/. Per the changed-file list in the rev…
Adr Compliance For Entity/Litegraph Changes Passed The check applies only when the PR changes files under src/lib/litegraph/, src/ecs/, or files related to graph entities (nodes, links, widgets, slots, reroutes, groups, subgraphs). The changed-fil…
Full details: Title check

Explanation

The title names the main change: the billing-web handoff tab now ends when Cloud refuses the whole session. The PR adds 403 codes to the ending set, keeps BILLING_FORBIDDEN open, and changes App.vue to render nothing during the redirect. The title covers the central fix, though not the App.vue remount change.

Full details: Description check

Explanation

The description is thorough and covers the template's Summary and Verification sections. The Summary explains the why, root cause, the fix (ending the handoff on five 403 codes plus the existing 401, keeping BILLING_FORBIDDEN, and the App.vue render change), and includes before/after screenshots. The Verification section lists unit tests, E2E tests with production build, command results, and the gaps (no live Cloud session with the flag flipped, dev-server blank page not rechecked). The optional 'Fixes #ISSUE_NUMBER' line is absent, but the template marks it as conditional. The 'After release' telemetry item is not provided, but the template says to include only what applies.

Full details: End-To-End Test Suggestion For User-Facing Changes

Explanation

The check does not apply to this PR. Its first failure condition requires a bug fix or feature change in the main frontend application under src/ or packages/. Per the changed-file list in the review context, every changed file is under apps/billing-web/: - apps/billing-web/src/session/billingWebClient.ts - apps/billing-web/src/session/billingWebClient.test.ts - apps/billing-web/e2e/handoff-session-ended.spec.ts - apps/billing-web/src/App.vue No changed file is under src/ or packages/. The PR fixes a bug in a separate billing app, so condition 1 is not met. The check therefore cannot fail. I did not run shell commands, because this check restricts evidence to the review context. The file list comes from the supplied change summary. The PR also already adds an E2E spec, but under apps/billing-web/e2e/, not browser_tests/. That fact does not change the result.

Full details: Adr Compliance For Entity/Litegraph Changes

Explanation

The check applies only when the PR changes files under src/lib/litegraph/, src/ecs/, or files related to graph entities (nodes, links, widgets, slots, reroutes, groups, subgraphs). The changed-file list in the review context contains only billing-web files: - apps/billing-web/src/session/billingWebClient.test.ts - apps/billing-web/src/session/billingWebClient.ts - apps/billing-web/e2e/handoff-session-ended.spec.ts - apps/billing-web/src/App.vue None of these paths is under the listed litegraph or ECS directories, and none is a graph entity file. The check therefore does not apply, so it passes without evaluating the ADR-LAYOUT or ADR-ECS patterns. The PR touches the billing handoff session logic and the billing-web app shell, not graph entities. The primary PR is github.com/#23373 by dante01yoon. No author-based criterion is involved. Per the check's instructions, I did not use shell commands.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9177bae and 463cf0e.

Files selected for processing: 3

  • apps/billing-web/e2e/handoff-session-ended.spec.ts
  • apps/billing-web/src/session/billingWebClient.test.ts
  • apps/billing-web/src/session/billingWebClient.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

No verdict is available. Open the workflow run to confirm the check was intentionally skipped, or fix the collection failure and re-run it.

Findings and check details

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

The matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped.

Full docs: scripts/registry-census/README.md

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

🌾 Fallow: ✅ Passed

Findings and check details

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

No new findings in the changed files.

Full docs: ADR-DEVEX-LINT-0015

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since f1974bcc949712332d13366ac11d0b8a035f6f51

🏛️ Architecture: ✅ Passed

Findings and check details

Warnings (515)

  • billing path matches no source files: src/platform/billing/composables/activateBillingScope.testUtils.ts. Remove or update it in docs/architecture/domains/records/billing.domain.json.
  • error-handling path matches no source files: src/utils/errorUtil.ts. Remove or update it in docs/architecture/domains/records/error-handling.domain.json.
  • graph-model path matches no source files: src/types/linkTopology.ts. Remove or update it in docs/architecture/domains/records/graph-model.domain.json.
  • graph-model path matches no source files: src/types/nodeState.ts. Remove or update it in docs/architecture/domains/records/graph-model.domain.json.
  • job-queue path matches no source files: src/platform/remote/comfyui/jobs/**. Remove or update it in docs/architecture/domains/records/job-queue.domain.json.
  • linear-mode path matches no source files: src/utils/appMode.ts. Remove or update it in docs/architecture/domains/records/linear-mode.domain.json.
  • link-connection path matches no source files: src/lib/litegraph/src/infrastructure/LinkConnectorEventMap.ts. Remove or update it in docs/architecture/domains/records/link-connection.domain.json.
  • node-widgets path matches no source files: src/types/widgetState.ts. Remove or update it in docs/architecture/domains/records/node-widgets.domain.json.
  • subgraphs path matches no source files: src/lib/litegraph/src/infrastructure/SubgraphEventMap.ts. Remove or update it in docs/architecture/domains/records/subgraphs.domain.json.
  • vue-node-widgets path matches no source files: src/types/positionConfig.ts. Remove or update it in docs/architecture/domains/records/vue-node-widgets.domain.json.
  • workspace path matches no source files: src/platform/workspace/fixtures/**. Remove or update it in docs/architecture/domains/records/workspace.domain.json.
  • packages/api-client/src/abortSignal.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/abortSignal.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchRouteTemplate.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchWithRetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchWithRetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/retryPolicy.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/retryPolicy.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/statusRetryTelemetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/statusRetryTelemetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/generated/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/generated/types.gen.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/formatUtil.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/formatUtil.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/geometry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/loadExternalScript.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/networkUtil.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/telemetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/telemetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/urlSafety.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/urlSafety.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/tailwind-utils/src/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/TopbarActions.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/searchbox/v2/filterChip.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatClipStrip.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatClipTile.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPanel.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPanel.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPlaybackBar.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/WidgetVideoConcat.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/WidgetVideoConcat.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/__fixtures__/clipTiles.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/graph/menuOption.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionActions.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionActions.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionNotices.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionNotices.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • …and 465 more

Full docs: Frontend domain catalog

Reproduce locally
pnpm architecture:check

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #23373      +/-   ##
==========================================
- Coverage   88.00%   88.00%   -0.01%     
==========================================
  Files        3168     3169       +1     
  Lines      169710   169608     -102     
  Branches    43764    45767    +2003     
==========================================
- Hits       149358   149260      -98     
+ Misses      19379    19374       -5     
- Partials      973      974       +1     
Flag Coverage Δ
billing-web-unit 91.88% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/billing-web/src/App.vue 66.66% <100.00%> (+3.03%) ⬆️
apps/billing-web/src/session/billingWebClient.ts 96.36% <100.00%> (+0.13%) ⬆️

... and 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the risk:medium PR risk grade (advisory shadow check; grader-owned) label Nov 13, 2026
…r its end screen

When a handoff session ended mid-session the scope went away before the
router replaced to /handoff, so App rendered the current billing view
outside BillingShell: it threw No billing client, and on the Vite dev
server the page stayed blank.
@github-actions github-actions Bot added risk:xhigh PR risk grade (advisory shadow check; grader-owned) and removed risk:medium PR risk grade (advisory shadow check; grader-owned) labels Nov 13, 2026
…hole session

Cloud's scoped-session policy also answers sso_required,
account_outside_organization, personal_workspace_disabled and
workspace_access_denied on every call once they apply. BILLING_FORBIDDEN
stays: Cloud answers it for one request naming another workspace too.
@dante01yoon dante01yoon changed the title fix(billing-web): end the handoff tab when Cloud answers HANDOFF_DISABLED fix(billing-web): end the handoff tab when Cloud refuses the whole session Nov 13, 2026
@comfy-greenlight-bot

comfy-greenlight-bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Swarmhost agentic review

The detailed evaluation is available to employees in the internal Slack review thread.

Evaluation budget remaining for this pull request: 97 automatic and 99 manual.

Updated by Swarmhost's agentic review process.

@comfy-greenlight-bot comfy-greenlight-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request at head commit 9177bae has been reviewed and approved by Swarmhost's agentic review process.

The detailed evaluation is available to employees in the internal Slack review thread.

…f session

PR 23395 removed the undesigned "This checkout session has ended" screen.
A refused handoff session that sent no payment now ends on "This checkout
link no longer works". Both cases here refuse the status read after a
cancellation, so both end there.

@comfy-greenlight-bot comfy-greenlight-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request at head commit 463cf0e has been reviewed and approved by Swarmhost's agentic review process.

The detailed evaluation is available to employees in the internal Slack review thread.

@jtydhr88 jtydhr88 assigned dante01yoon and unassigned jtydhr88 Nov 15, 2026

huang47 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Verified on 463cf0e1c5. I built billing-web from both revisions and mocked Cloud returning 403 HANDOFF_DISABLED when the user confirmed cancellation. Before, the subscription screen stayed open and showed a billing error. After, the tab redirected to “This checkout link no longer works.” All 93 focused unit tests passed.

Before After
Subscription screen shows a billing error Billing tab redirects to the link unavailable screen

@huang47 huang47 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the billing handoff redirect. Before-and-after evidence.

@dante01yoon
dante01yoon added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 0a7b09f Nov 15, 2026
80 checks passed
@dante01yoon
dante01yoon deleted the 1.61-billing-handoff/billing-web-handoff-disabled branch November 15, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

greenlight risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants