Skip to content

fix(web): retry legacy Connect auth backfill - #7903

Open
gnustella-lab wants to merge 3 commits into
pingdotgg:t3code/move-electron-auth-to-browserfrom
gnustella-lab:fix/pr7483-linux-auth-recovery
Open

fix(web): retry legacy Connect auth backfill#7903
gnustella-lab wants to merge 3 commits into
pingdotgg:t3code/move-electron-auth-to-browserfrom
gnustella-lab:fix/pr7483-linux-auth-recovery

Conversation

@gnustella-lab

@gnustella-lab gnustella-lab commented Aug 22, 2026

Copy link
Copy Markdown

Problem

The desktop Connect auth provider stops retrying after the first successful authState response. A legacy CLI credential can be authorized while its accountId is still null during the server's lazy identity backfill, so the desktop keeps isSignedIn false until a focus refresh or another sign-in.

Fix

  • Extract the desktop auth-state retry predicate into a small pure helper.
  • Keep polling while the initial state is unavailable.
  • Also keep polling for an authorized legacy credential until accountId is backfilled.
  • Stop polling for stable signed-out and signed-in states.

This is a focused follow-up to #7483 and is intended to be merged with, or applied on top of, t3code/move-electron-auth-to-browser. It does not change the server, CLI token storage, OAuth flow, or mobile surface.

Tests

  • RED reproduced before the fix: the legacy authorized/null-account case failed.
  • pnpm exec vp test run --project unit src/cloud/connectAuthState.test.ts
  • pnpm exec vp test run --project unit src/cloud/connectAuthState.test.ts src/cloud/managedAuth.test.ts
  • pnpm exec vp run --filter @t3tools/web typecheck
  • pnpm exec vp fmt --check apps/web/src/cloud/connectAuth.tsx apps/web/src/cloud/connectAuthState.ts apps/web/src/cloud/connectAuthState.test.ts
  • pnpm exec vp lint apps/web/src/cloud/connectAuth.tsx apps/web/src/cloud/connectAuthState.ts apps/web/src/cloud/connectAuthState.test.ts --report-unused-disable-directives

Related to #7816. The issue is not marked closed because this patch only covers the legacy Linux/Desktop state-backfill case.

Built with GPT-5.6 Luna via Hermes Agent.


Note

Medium Risk
Touches desktop session signed-in detection and polling. A stuck backfill could poll indefinitely, but this is client-only and does not change tokens or OAuth.

Overview
Desktop Connect no longer treats the first authState response as final when a legacy CLI credential is authorized but accountId is still null. It keeps polling until identity backfill completes so the session can become signed-in without a focus refresh or another login.

Adds isIdentityPending on T3ConnectAuth and settled (non-overlapping) polling helpers. Onboarding skips recording that incomplete snapshot as a signed-out cold load so the wizard does not fire when the id arrives.

Reviewed by Cursor Bugbot for commit 6998c9e. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Retry legacy Connect auth backfill when accountId is missing

  • Legacy desktop credentials that are authorized but have a null accountId now keep polling until the identity is backfilled, using new shouldRetryDesktopConnectAuthState and isDesktopConnectAuthIdentityPending helpers in connectAuthState.ts
  • Replaces setInterval loops with startSettledPolling, which waits for each refresh to settle before scheduling the next tick, preventing overlapping refreshes in DesktopConnectAuthProvider
  • Adds isIdentityPending boolean to T3ConnectAuth and surfaces it to consumers so ConnectOnboardingDialog.tsx can skip signed-out cold-load recording and onboarding prompts during backfill
  • Behavioral Change: DesktopConnectAuthProvider now polls at 3s intervals on startup when shouldRetryDesktopConnectAuthState is true instead of using the previous fixed interval; consumers reading T3ConnectAuth must handle the new isIdentityPending field

Macroscope summarized 6998c9e.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 03cf2fec-9b7f-48eb-9d51-d6df5379da93

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 22, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1c54fb5. Configure here.

Comment thread apps/web/src/cloud/connectAuth.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Skipped

Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Aug 22, 2026
Comment thread apps/web/src/cloud/connectAuth.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant