fix(web): retry legacy Connect auth backfill - #7903
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ 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.
ApprovabilityVerdict: 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. |

Problem
The desktop Connect auth provider stops retrying after the first successful
authStateresponse. A legacy CLI credential can be authorized while itsaccountIdis still null during the server's lazy identity backfill, so the desktop keepsisSignedInfalse until a focus refresh or another sign-in.Fix
accountIdis backfilled.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
pnpm exec vp test run --project unit src/cloud/connectAuthState.test.tspnpm exec vp test run --project unit src/cloud/connectAuthState.test.ts src/cloud/managedAuth.test.tspnpm exec vp run --filter @t3tools/web typecheckpnpm exec vp fmt --check apps/web/src/cloud/connectAuth.tsx apps/web/src/cloud/connectAuthState.ts apps/web/src/cloud/connectAuthState.test.tspnpm 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-directivesRelated 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
authStateresponse as final when a legacy CLI credential is authorized butaccountIdis still null. It keeps polling until identity backfill completes so the session can become signed-in without a focus refresh or another login.Adds
isIdentityPendingonT3ConnectAuthand 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
accountIdis missingaccountIdnow keep polling until the identity is backfilled, using newshouldRetryDesktopConnectAuthStateandisDesktopConnectAuthIdentityPendinghelpers in connectAuthState.tssetIntervalloops withstartSettledPolling, which waits for each refresh to settle before scheduling the next tick, preventing overlapping refreshes inDesktopConnectAuthProviderisIdentityPendingboolean toT3ConnectAuthand surfaces it to consumers so ConnectOnboardingDialog.tsx can skip signed-out cold-load recording and onboarding prompts during backfillDesktopConnectAuthProvidernow polls at 3s intervals on startup whenshouldRetryDesktopConnectAuthStateis true instead of using the previous fixed interval; consumers readingT3ConnectAuthmust handle the newisIdentityPendingfieldMacroscope summarized 6998c9e.