Skip to content

feat(auth): say why a page gets no account session, and resolve a cancelled sign-in - #2339

Open
synap5e wants to merge 8 commits into
mainfrom
synap5e/feat/auth-bridge-ux-notes
Open

synap5e wants to merge 8 commits into
mainfrom
synap5e/feat/auth-bridge-ux-notes

Conversation

@synap5e

@synap5e synap5e commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

A ComfyUI page that Desktop won't share its account session with got a bare { status: 'disabled' }, so it couldn't tell the person why. And cancelling a sign-in started from a page rejected the bridge call with a raw IPC error (Error invoking remote method 'desktop2-auth:request-sign-in': SignInFailure: access_denied). This PR makes both answers explain themselves. Who gets the session is unchanged: the reason is worked out after the existing checks have decided.

Case before after
page isn't the main frame of a local install's own loopback ComfyUI (e.g. a Remote Connection) { status: 'disabled' } { status: 'disabled', reason: 'not_local' }
local install page, account sharing turned off (for Apps pages: Apps switched off) { status: 'disabled' } { status: 'disabled', reason: 'off' }
requestSignIn() cancelled or failed rejects with the IPC error resolves with the page's current state plus signInFailure
  • signInFailure is one of cancelled, restarted, superseded, timeout, idp_error, server_error, network, browser_unavailable (the reasons Desktop already uses for sign-in telemetry), or unknown.
  • not_local is decided before the feature flag is read, so a remote page learns nothing about the flag.
  • Both are new optional fields, not new status values. Shipped ComfyUI frontends branch on status only and treat any status they don't know as signed in, so a new status would break them. Every frontend release that reads this bridge catches the requestSignIn rejection and then applies the returned state, so with this change they apply the page's current state after a failed sign-in.
  • Apps pages use the same requestSignIn, so a cancelled sign-in there also resolves instead of rejecting.
  • Desktop still logs the failed sign-in in the main process (before, Electron logged it because the rejection escaped the IPC handler): a cancel, or a sign-in a sign-out cut short, at info with the reason; any other failure at error with the error.
  • @comfyorg/comfyui-desktop-bridge-types goes to 0.18.0 (ComfyDesktop2SignInResult, ComfyDesktop2SignInFailure, reason on the disabled state).

Known limitation: a sign-in that ends without an error but leaves the page signed out (another sign-in or a sign-out landed first) resolves as plain signed_out with no signInFailure, the same as before.

Accepted gaps (author's call):

  • A page whose window was destroyed while its sign-in was pending is told not_local; the view is detached, so nobody sees it.
  • The billing handoff's disabled still carries no reason; a page can call getState for it.
  • Desktop's own Sign in button, when it shares a browser flow with a page's sign-in, still logs a cancel as an error on its own channel.
  • A page that is already signed in and calls requestSignIn starts a new browser sign-in (unchanged; the shipped frontend only calls it when signed out).
  • A server-side access_denied is reported as cancelled and logged at info, the same as a person's Deny.

A disabled state now carries reason 'not_local' (decided before the flag is read) or 'off'.
requestSignIn resolves with the view's state plus signInFailure instead of rejecting.
@synap5e

synap5e commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Disabled auth states now identify whether a session is not local or disabled by a feature gate. Sign-in requests return the current auth state and can include a classified failure code.

Changes: Embedded authentication outcomes

Layer / File(s) Summary
Disabled-state reasons
src/types/comfyDesktopBridge.ts, packages/comfyui-desktop-bridge-types/comfyDesktopBridge.d.ts, src/main/lib/embeddedSession.ts, src/main/lib/embeddedSession.test.ts, packages/comfyui-desktop-bridge-types/package.json
Disabled states now identify not_local or off. Tests check these states, and the bridge types package version changes to 0.20.0.
Sign-in failure results
src/types/comfyDesktopBridge.ts, packages/comfyui-desktop-bridge-types/comfyDesktopBridge.d.ts, src/main/lib/ipc/registerEmbeddedSessionHandlers.ts, src/main/lib/ipc/registerEmbeddedSessionHandlers.test.ts
requestSignIn() now returns an auth state with an optional failure code. The IPC handler classifies failures, logs cancellations and superseded attempts at info level, and logs other failures at error level. Tests cover failure categories and repeated or superseded requests.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant requestSignIn handler
  participant reportHostSignIn
  participant signInFailureReport
  Caller->>requestSignIn handler: request sign-in
  requestSignIn handler->>reportHostSignIn: report host sign-in
  reportHostSignIn-->>requestSignIn handler: sign-in failure
  requestSignIn handler->>signInFailureReport: classify failure
  signInFailureReport-->>requestSignIn handler: failure reason
  requestSignIn handler-->>Caller: current auth state and signInFailure
Loading

Possibly related issues

Possibly related PRs

Merge Risk: Minimal · up to 59a08

This change adds reasons for disabled account sessions and makes page-triggered sign-in resolve with the current state and a classified failure instead of rejecting. Eligibility behavior is unchanged and the new fields are optional, so the risk of regressions for existing callers is low. No outstanding merge-blocking concerns were identified.

Pre-merge checks: Passed 2

Check name Status Explanation
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.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Simplify code

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1d2df74c-5fbb-4745-9652-71923f9ea69c
Commits

Reviewing files that changed from the base of the PR and between 7ff58ab and 59a0870.

Files selected for processing: 1

  • src/main/lib/ipc/registerEmbeddedSessionHandlers.test.ts

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

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@synap5e
synap5e marked this pull request as ready for review November 20, 2026 22:11
@synap5e
synap5e requested review from a team as code owners November 20, 2026 22:11
@comfy-greenlight-bot

comfy-greenlight-bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Swarmhost agentic review

The current assessment 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T22:12:44.412664Z a2fb817 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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 a2fb817 has been reviewed and approved by Swarmhost's agentic review process.

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

@christian-byrne

Copy link
Copy Markdown
Contributor

Heads-up @synap5e: main's bridge types are now 0.19.0 (0.18.0 from #2353, then 0.19.0 from #2359 for setAttentionNeeded), so this PR needs a bump to 0.20.0 and a regen (pnpm run bridge-types:gen) before it can land.

…dge-ux-notes

# Conflicts:
#	packages/comfyui-desktop-bridge-types/package.json
@swarmhost-app
swarmhost-app Bot dismissed comfy-greenlight-bot’s stale review November 22, 2026 05:07

Swarmhost approval covered a2fb817; the pull request advanced to 7ff58ab.

@synap5e-bot

synap5e-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown

Thanks @christian-byrne. Merged main in and bumped the bridge types to 0.20.0. The only conflict was the package version; git show --remerge-diff 7ff58abbc shows the resolution. bridge-types:gen output matches the committed .d.ts, and typecheck, lint, prettier and the unit suite pass on the merged tree.

@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 7ff58ab is approved by Swarmhost's agentic review process on the belief that it is unchanged base-branch maintenance — no evaluator read this commit.

Carried forward from head a2fb817 without re-reviewing, on the judgment that the only change since is base-branch maintenance (rebase: Only a generated package version bump tracking the moved base, no authored code changes.).

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

@swarmhost-app
swarmhost-app Bot dismissed comfy-greenlight-bot’s stale review November 22, 2026 05:21

Swarmhost approval covered 7ff58ab; the pull request advanced to 59a0870.

@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 59a0870 has been reviewed and approved by Swarmhost's agentic review process.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants