Repository navigation
fix(chat): ask for a sign-in when a resume is refused, and sign in the session's own account - #7993
Conversation
🏆 Review leaderboardNov 1–8, 2026 · UTC
Ranked by distinct external PRs reviewed, then review rounds, then PR comments. Self-activity and bot activity are excluded. Show 7 more reviewers
|
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: changes requested (one small fix).
Backend looks right: auth sentinels now map before the driver/recovery ones, RequireSessionLogin follows the ConfirmConversationLogin lock+tx pattern and leaves a pending demand alone, the daemon login-confirmed hook clears it, and ExitAgent is gated per session by beginAgentOperation, so stopping different sessions concurrently is safe.
One required change inline: the accountLogin request outlives the settings modal.
Optional (not required):
ReauthLogInButtonfalls back tostartLogin(this computer CLI login) while the session/account queries are still loading, so a very fast click still opens the wrong login. Disabling the button until both queries settle would close that gap.requireChatLoginrecordsErrAgentAuthRequired.Error()as the reason even forErrChatAuthRequired; harmless since the banner hides the reason.
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: approved.
8aa6325 resolves the previous finding: closeSettings and openProjectSettings now clear accountLogin, and the new ui-store test covers both paths. The rest of the PR is unchanged since the last review.
Optional (from the last review, not required): ReauthLogInButton still falls back to the CLI login while the session/account queries load, so a very fast click can open the wrong login.
8aa6325 to
5d1d742
Compare
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: approved.
5d1d742 is a rebase of the previously approved head (8aa6325) onto main. git range-diff shows the only change is the icon imports in ChatStatusBanners.tsx and AgentAccountsSection.tsx, which now come from @/components/app-icons after #7903. All icons used (KeyRound, TriangleAlert, LoaderCircle, Trash2, etc.) are exported there. The other three commits are identical, and ChatWorkspace is still the only ReauthBanner call site.
Optional (not required): ReauthLogInButton still falls back to the CLI login while the session/account queries load.
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: approved.
Reviewed e0a3333 on top of the previously approved head:
mapSessionError: the auth codes go first only for aRelaunchError(resume), so a refused spawn keepsCHAT_DRIVER_UNAVAILABLEand its fallback; the new test covers both.relaunchErris the same value the laterRelaunchErrorcase reads, so the extraerrors.Ashas no side effect.RedactError:redactedErrorhas noUnwrap, so the cause is still unreachable byerrors.As/telemetry; onlyerrors.Issees through, which exposes no text.ReconcileConversationAuthentication: the read-only evidence check now runs on the reader, and only a verified turn takes the writer, where the tx path re-checks the evidence, so there is no TOCTOU. The new held-writer test proves the read path no longer blocks.requireChatLoginskips a session with a pending account move and records the matching sentinel as the reason.- Frontend: the button is disabled until the session account query settles and passes the bound account id, device included.
AgentAccountsPanelwaits forcliLoginto be enabled before callingonSignInfor the device row, and uses the per-account sign-in otherwise.HarnessAccountTabrenders the panel for any local installed Claude/Codex harness, so the request is consumed, andcloseSettingsdrops it otherwise.
No changes required.
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: changes requested.
ca04e72 hides the stopped-agent banner (Resume agent / Open shell) while a sign-in demand is pending, and removes the bar dismiss button. This can leave a chat stuck with no way forward; details inline.
The rest is fine: needsReauth matches ReauthBanner own required check, so the two never disagree, and both render under the same HoldWhileHidden.
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: approved.
5ae8079 resolves the previous finding. Resume agent is hidden only when needsReauth holds for a local Claude Code/Codex session (agentAccountProviderFor(harness) !== null, no remote host, not cloud), which is exactly where the daemon login-confirmed hook can clear the demand. ACP-family harnesses, remote hosts and cloud sessions keep the stopped-agent banner with Resume. The parameterised test covers codex (hidden) and opencode (kept).
Optional (not required): a local Claude/Codex login that no account reading can confirm (for example a token login with no usage reading) would still rely on the hook. If that shows up in practice, a secondary Resume under the sign-in bar would cover it.
5ae8079 to
2fcca42
Compare
illegalcall
left a comment
There was a problem hiding this comment.
Verdict: approved.
2fcca42 is a rebase of the previously approved head (5ae8079) onto main (6f4f941). git range-diff shows only the conflict resolutions, and each one keeps main side:
- context lines from main AO to Orchestrator rename (
CHAT_RESUME_FAILEDmessage,settings.agentAccounts.removeDescriptionin all 9 locales); the newremovingkeys are unchanged. - the Log in again button now uses main
variant="secondary"in place ofoutline, still with theisPendingdisable.
Commits 3, 4, 6 and 7 are identical. No changes required.
illegalcall
left a comment
There was a problem hiding this comment.
Approved at bc3cccdb81. Nothing needs to change.
The new commit lifts the existing sign-in condition into one signInRequired const, which the controller banner and the composer now share. While that condition holds and the controller is stopped, the composer placeholder becomes "Log in to continue" instead of "The controller is not connected". This branch sits after the terminated, resuming and reconnecting branches, so those states keep their own text. ACP-family, remote and cloud chats keep the old text, matching where Resume agent stays visible. The new key is in all 9 locales, and the updated test covers both harness cases and the return to the old text after authentication.
This head is the same as the previously approved 2fcca4225b plus this commit. No other files changed.
…e session's own account Opening an older chat whose Claude login had expired showed the raw "chat driver unavailable: persistent ACP host: agent requires authentication" error, and no sign-in prompt. The resume error now maps to AGENT_AUTH_REQUIRED before the driver/recovery wrappers, and a launch refused for its login records the chat's login demand, so the "Log in again" bar shows until a reading confirms the account is signed in. "Log in again" now signs in the saved account the session runs on, in its own folder, instead of this computer's CLI login. Sessions on the CLI's login, remote hosts and the cloud keep the existing flow. Removing an account stops its agents concurrently (9.2 s -> 5.6 s for four busy chats in the lab), and the dialog's button reads "Removing…" while it runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hows ReauthBanner mounts for every chat that has account state, so its query hooks ran on chats with no login demand and broke chat tests rendered without a QueryClientProvider. The lookup now lives in the bar's button, which mounts only when a sign-in is required. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A "Log in again" request the accounts list never took stayed in the store after Settings closed or project settings opened, so a later mount of that account's row could start a sign-in nobody asked for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Only a refused resume maps to the sign-in codes first; a refused chat spawn keeps CHAT_DRIVER_UNAVAILABLE and its terminal fallback. - Log in again passes the session's bound account, including this computer's login, which the accounts panel signs in through the CLI; the button waits for the session's account instead of guessing. - Reading a chat that waits for a sign-in no longer takes the writer unless a verified turn can clear the demand. - An account move's refused launch no longer raises a demand on the account the session still runs on. - A redacted launch error keeps errors.Is matching, so a refusal that mentions a project env value still reads as a sign-in. - The demand records which refusal it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refused login stops the agent, and neither Resume agent nor Open shell can fix it. While the sign-in bar shows, the stopped-agent banner stays hidden, and the bar has no close button: signing in is the one way on. Once the login works the bar goes away and Resume agent returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only a local Claude Code or Codex session gets its sign-in request cleared by an account reading. Other harnesses (the ACP family), remote hosts and cloud sessions keep the stopped-agent banner with Resume agent, which is their way back once the login works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s required The composer said "The controller is not connected" under the sign-in bar. While the login is refused and the agent is stopped, it now asks for the sign-in that unblocks the chat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bc3cccd to
ab6748b
Compare
illegalcall
left a comment
There was a problem hiding this comment.
Approved at ab6748b594. Nothing needs to change.
This head is the previously approved bc3cccdb81 rebased onto main d429710c18. The range-diff shows only conflict resolutions, and each keeps both sides:
chat_spawn.goresumeChatController: main's imported-sessionErrSessionOpenElsewherereturn now runs beforerequireChatLogin. That order is right: another app holding the chat is not a refused login, so it must not record a sign-in demand.ChatStatusBanners.tsx: theDownloadimport andImportedAgentBlockedfrom main stay next to the ReauthBanner changes.ChatWorkspace.tsx: main's open-elsewhere recheck and theImportedAgentBlocked/AgentBlockimports stay next to thesignInRequiredprop andagentAccountProviderForimport.
Commits 2-4 and 8 are unchanged.
Optional: if one chat shows both a pending sign-in and "open elsewhere", the sign-in bar hides the open-elsewhere banner while its timed recheck keeps running. That combination is unlikely and harmless, so it does not need a change here.
Brings in main's deflake of the session-switch streaming smoke test (#8044), which failed renderer-smoke here, and resolves the conflicts with main's sign-in work (#7993): - The chat's Log in (band and banner) now signs in the saved account the session runs on, as main's banner does, and falls back to the CLI login only when that account is not known yet. The chat reads the account as soon as a login is on offer, so the click needs no wait. - The banner keeps main's shape (no dismiss button); a chat passes its own Log in, and other uses keep main's account lookup. - Both sides' i18n keys, store types and Timeline props are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Three problems hit when a Claude login expired on an older session:
ErrChatDriverUnavailable→ErrAgentAuthRequired.mapSessionErrorchecked the driver/recovery sentinels first, so the user sawCHAT_DRIVER_UNAVAILABLEwith "chat driver unavailable: persistent ACP host: agent requires authentication". A refused launch also has no chat controller, so nothing recorded the chat's login demand and the "Log in again" bar never appeared.RelaunchError), the auth sentinels now map before the driver/recovery ones, so it returnsAGENT_AUTH_REQUIRED. A refused chat spawn keepsCHAT_DRIVER_UNAVAILABLEand its terminal fallback.Store.RequireSessionLogin, which sets the same demand a refused turn sets (ConversationAccount.RequireLogin, shared with the controller) and records which refusal it was. A pending demand is left untouched. No demand is raised while an account move launches on its target account. The existingConfirmConversationLoginclears the demand once a reading shows the account is signed in.RedactErrorkeepserrors.Ismatching, so a refusal whose text contains a project env value still maps to a sign-in.POST /agents/accounts/{id}/login), and this computer's login starts the CLI sign-in from its row once that row can. The button waits until it knows the session's account. Sessions on a remote host or in the cloud keep the existing flow. The request travels asaccountLoginin the ui-store, andAgentAccountsPaneltakes it once the row has loaded; closing settings drops it.ExitAgentsOnAccountnow stops them concurrently, and the confirm button reads "Removing…" while the request runs (all 9 locales).Screenshots
Desktop app in a lab, real Claude Code, same steps on main (
8912917478) and on this PR. The email of this computer's own login is replaced with you@example.com.chat driver unavailable: persistent ACP host: agent requires authenticationand no bar. This PR shows only the sign-in bar, and the composer says "Log in to continue"; the daemon itself records the demand from the refused resume. This shot is frombc3cccdb81; the other two are from00d60ee700.POST /api/v1/agents/accounts/lab-expired/login(202 in the daemon log), and the sign-in opens in that account's folder.Evidence (daemon-only lab, real Claude, before/after binaries)
CHAT_DRIVER_UNAVAILABLE, raw driver message, no demand recordedAGENT_AUTH_REQUIRED,account_json.authenticationState = "required"withreauthRequiredAtTests
mapSessionErrorcases for a resume refused for its login (AGENT_AUTH_REQUIRED) and a spawn refused for its login (CHAT_DRIVER_UNAVAILABLE);TestResumeChatRefusedLoginAsksForSignIn(refused login records a demand with its own reason, a Codex-style refusal records the chat reason, an account move and provider down record none);TestLaunchRefusalRaisesTheChatLoginDemand(demand set, plan kept, a repeat refusal keeps the same failure ID, reading the chat while the writer is held returns, login check clears it, a later refusal raises a new demand, unknown session is a no-op);RedactErrorhides the value and keeps the sentinel.ReauthBannerpasses the bound account (saved or this computer's), waits for it, and has only Log in again;ChatWorkspacehides Resume agent and says "Log in to continue" in the composer while a Codex login is refused, keeps Resume for opencode, and shows it again once the login works;AgentAccountsPanelstarts a requested sign-in exactly once, signs this computer's login in through the CLI once it can, and clears the request; closing settings drops it; the remove dialog shows "Removing…" until the DELETE resolves.Risks / follow-ups
ChatStatusBanners,AgentAccountsSection,ui-storeand the i18n files, so whichever lands second will need a rebase.🤖 Generated with Claude Code