You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mobile): add or sign in Claude and Codex accounts from the phone - #51701
Stacked on #51699: review the commits after 7584621.
ELI5
On the phone you can now add a Claude or Codex account to your computer, or sign a signed-out one back in, without going to the desktop. A chat that stopped because its account was signed out now has a Sign in button that does the same.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$112
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$112
Prod
49
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1840
$\color{#cf222e}{\Huge{\mathbf{−}}}$353
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1487
What Changed
Before: the phone's Accounts screen could only switch accounts and said "Add or re-authenticate accounts from desktop Settings → Accounts." A chat on a signed-out managed account showed the error with no action (Codex) or opened a terminal.
After:
Accounts ends each provider's group with a blue Add account row. A signed-out account says Signed out in red, hides its empty usage and offers Sign in.
Both open one sheet in bot import's numbered-step style. Claude: open the sign-in page in the phone's browser (or copy the link), then paste the code back. Codex: open the page and enter the code shown in big type; the sheet closes itself when the computer hears the page is done. On success a toast names the account. The account is saved on the computer.
Chat notice on a managed account reads "Claude isn't signed in." with Sign in, which opens the same sheet for the chat's selected account; the host's longer words move under Details. Once it finishes, that notice settles to "Signed in. Send again." (as desktop's does). Chats on the agent's own login keep today's terminal Sign in.
Hosts that can't do this (older, or Windows) keep today's footer text and no rows.
How: the host already runs these logins for a paired desktop (accounts.hostSignInStart/Wait/SubmitCode/Cancel, #20009). They are now on the phone allowlist on the paired-desktop route, next to accounts.list, gated by a new accounts.mobile-host-sign-in.v1 capability that Windows hosts don't advertise (they refuse the start). The desktop's follow loop (start with lost-answer retries, 90 s link deadline, cancel delivery, signedIn-wins-over-cancel) moves to src/shared/agent-accounts/host-account-sign-in-run.ts, and both the desktop client and the phone use it.
Why
Root cause: the host flow was built for a desktop that polls the whole time. The phone was never allowlisted, had no client, and the host ended any flow its owner stopped asking about after 90 s, which a phone always hits: iOS suspends it while the person signs in in Safari.
So: the host keeps an unattended host-account flow for 10 minutes (as long as Claude's own login waits), the shared loop keeps asking through lost answers while the person is on the page (until Cancel, or until the host has been unreachable longer than it keeps the flow), and an owner that lost its own flow (an app killed in Safari) can replace it after a minute instead of being told "another sign-in is running" for 10 minutes.
Why this over the alternatives: reusing the host's existing flow means credentials never leave the computer and there's one login implementation; the rejected option (opening a terminal running claude auth login) leaves the person driving a TUI on a phone. Sharing the loop instead of a phone copy keeps cancel/lost-answer behaviour identical on both clients. A Claude Add doesn't change the computer's selected account, as on desktop; a Codex Add selects it, as the host already does.
Linked Issue
No issue; part of the phone account work. Follows the host sign-in added for paired desktops (#20009).
Visual Proof
iOS 27 simulator against a serve built from this branch; the computer's claude/codex logins were stand-ins printing the real link/code formats (no real accounts touched).
Before
Accounts
Claude sheet
Code pasted after 2 min in Safari
Added
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Signed out (dark)
Signed out (light)
Code refused by host
Signed in again
Claude sheet (light)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Codex device code
Codex (light)
Finished while the phone was in Safari: sheet closed itself
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Chat on a signed-out managed account
Same sheet
After signing in (dark)
(light)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
On the iOS simulator, paired to a worktree orca serve (macOS host):
Added a Claude account after leaving the app in Safari for over 2 minutes, then pasting the code.
Re-authenticated a signed-out Claude account (a wrong code shows the host's refusal with Try again; the retry succeeded and the account count stayed at one).
Added a Codex account where the page was finished while the phone sat in Safari for 100 s; on return the sheet closed itself and named the account.
From a structured Claude chat on a signed-out managed account, Sign in re-authenticated that account and the notice settled.
Dark and light.
Tests (each fails with its fix reverted): the shared run keeps following one flow through 7 minutes of lost answers without a second start or a cancel, and stops once the host has been unreachable longer than it keeps a flow; the host lets an owner replace only its own flow it stopped asking about for a minute, never another owner's or a live one.
Performance
Nothing runs unless someone taps Add account or Sign in. The Accounts screen shares the existing status probe; the chat reads the session's already-loaded host status. While a sign-in is open, the phone long-polls one request at a time (host answers within 20 s); during an outage it retries with 2–15 s backoff and stops after 10 minutes without an answer. The page bundle grows by ~40 KB; the eager fence moves by 32 KiB with a dated note.
Risk
Level: Medium
Riskiest part is the desktop's paired-server sign-in, whose loop moved to shared code. It keeps the same start/cancel/deadline rules; the change is that while waiting on the page it keeps asking through lost answers for up to 10 minutes instead of failing after 80 s. Host side, an abandoned host-account flow now holds the host's one sign-in slot for up to 10 minutes (was 90 s) for other devices; its own owner can replace it after a minute, and local account actions still supersede it. Mixed versions: new phone + old host shows today's footer (no capability); old phone + new host is unchanged. Page-only on the phone: no store build needed. Plain revert backs it all out.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The phone opens only https pages on the provider's own sign-in host (isHostAccountSignInPage), the same check the host applies; pasted codes are capped at 4,096 characters.
Chats another server runs (relayed workspaces) don't get the sheet: accounts are the paired computer's, so they keep their terminal Sign in.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
…omputer
Accounts painted its groups bgPanel on bgBase, while every other grouped screen uses
sheetGroup groups on the groupedPage grey. It now uses the same page, bar and group
fills. The usage track moves to translucentFill, since bgRaised equals the group fill
in dark and would hide it.
Accounts on the phone could only switch; adding an account or signing a signed-out one in
again needed the desktop, and a signed-out managed chat offered no action. The host already
runs these logins for a paired desktop (accounts.hostSignIn*), so the phone now uses them:
Accounts gets an Add account row per provider and Sign in on signed-out accounts, and a
managed-account chat's notice opens the same sheet. Chats on the agent's own login keep the
terminal Sign in.
The phone may call the four methods on the paired-desktop route, gated by a new
accounts.mobile-host-sign-in.v1 capability that Windows hosts don't advertise. The desktop's
follow loop moves to src/shared so both clients share it; while the person is on the
sign-in page it keeps asking through lost answers for as long as the host keeps the flow,
and the host keeps an unattended flow for 10 minutes instead of 90 seconds, since a phone in
the browser is suspended. An owner that lost its own flow can replace it after a minute.
No actionable comments were generated in the recent review.
Walkthrough
The mobile app adds Claude and Codex sign-in through a paired host. The Accounts screen and chat notices expose sign-in actions and status. Host-side changes add sign-in RPC support, capability reporting, shared flow handling, and owner takeover timing. The PR also moves the Codex authentication warning helper to a shared module, adds translations, updates account-screen styling, and introduces a shared list step marker.
Merge Risk: Low · up to 8abf7
Phone sign-in works for the main flows. One minor gap remains: an inactive Codex account with expired credentials may not show a Sign in action. This matches the desktop Accounts pane, so it can be handled as a follow-up.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(mobile): add or sign in Claude and Codex accounts from the phone" matches the main change. The changeset adds phone-side Add account and Sign in flows for Claude and Codex, which the t…
Description check
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, and Notes sections, with the required before/after images …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(mobile): add or sign in Claude and Codex accounts from the phone" matches the main change. The changeset adds phone-side Add account and Sign in flows for Claude and Codex, which the title summarizes. The title is short, specific, and conventional. It omits the chat sign-in notice and the shared sign-in run loop, which is acceptable because it need not cover every detail.
Full details: Description check
Explanation
The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, and Notes sections, with the required before/after images and a Performance statement. Gaps: the Linked Issue section says no issue exists, although the template says there should always be one for outside contributors. The Risk level is set to Medium, and the Risk section explains the revert path. The AI Disclosure section is empty. The Review section is empty. The Testing and Performance content is detailed, so the description is mostly complete.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…sults
The Sign in row announces its action as a button; step 1 ticks only once the browser takes the page; a cancelled sign-in that finishes late settles only its own chat notice; a wait error arriving after a cancel settled the flow no longer overrides that outcome.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #51699: review the commits after 7584621.
ELI5
On the phone you can now add a Claude or Codex account to your computer, or sign a signed-out one back in, without going to the desktop. A chat that stopped because its account was signed out now has a Sign in button that does the same.
What Changed
Before: the phone's Accounts screen could only switch accounts and said "Add or re-authenticate accounts from desktop Settings → Accounts." A chat on a signed-out managed account showed the error with no action (Codex) or opened a terminal.
After:
How: the host already runs these logins for a paired desktop (
accounts.hostSignInStart/Wait/SubmitCode/Cancel, #20009). They are now on the phone allowlist on the paired-desktop route, next toaccounts.list, gated by a newaccounts.mobile-host-sign-in.v1capability that Windows hosts don't advertise (they refuse the start). The desktop's follow loop (start with lost-answer retries, 90 s link deadline, cancel delivery, signedIn-wins-over-cancel) moves tosrc/shared/agent-accounts/host-account-sign-in-run.ts, and both the desktop client and the phone use it.Why
Root cause: the host flow was built for a desktop that polls the whole time. The phone was never allowlisted, had no client, and the host ended any flow its owner stopped asking about after 90 s, which a phone always hits: iOS suspends it while the person signs in in Safari.
So: the host keeps an unattended host-account flow for 10 minutes (as long as Claude's own login waits), the shared loop keeps asking through lost answers while the person is on the page (until Cancel, or until the host has been unreachable longer than it keeps the flow), and an owner that lost its own flow (an app killed in Safari) can replace it after a minute instead of being told "another sign-in is running" for 10 minutes.
Why this over the alternatives: reusing the host's existing flow means credentials never leave the computer and there's one login implementation; the rejected option (opening a terminal running
claude auth login) leaves the person driving a TUI on a phone. Sharing the loop instead of a phone copy keeps cancel/lost-answer behaviour identical on both clients. A Claude Add doesn't change the computer's selected account, as on desktop; a Codex Add selects it, as the host already does.Linked Issue
No issue; part of the phone account work. Follows the host sign-in added for paired desktops (#20009).
Visual Proof
iOS 27 simulator against a serve built from this branch; the computer's
claude/codexlogins were stand-ins printing the real link/code formats (no real accounts touched).Testing
On the iOS simulator, paired to a worktree
orca serve(macOS host):Tests (each fails with its fix reverted): the shared run keeps following one flow through 7 minutes of lost answers without a second start or a cancel, and stops once the host has been unreachable longer than it keeps a flow; the host lets an owner replace only its own flow it stopped asking about for a minute, never another owner's or a live one.
Performance
Nothing runs unless someone taps Add account or Sign in. The Accounts screen shares the existing status probe; the chat reads the session's already-loaded host status. While a sign-in is open, the phone long-polls one request at a time (host answers within 20 s); during an outage it retries with 2–15 s backoff and stops after 10 minutes without an answer. The page bundle grows by ~40 KB; the eager fence moves by 32 KiB with a dated note.
Risk
Level: Medium
Riskiest part is the desktop's paired-server sign-in, whose loop moved to shared code. It keeps the same start/cancel/deadline rules; the change is that while waiting on the page it keeps asking through lost answers for up to 10 minutes instead of failing after 80 s. Host side, an abandoned host-account flow now holds the host's one sign-in slot for up to 10 minutes (was 90 s) for other devices; its own owner can replace it after a minute, and local account actions still supersede it. Mixed versions: new phone + old host shows today's footer (no capability); old phone + new host is unchanged. Page-only on the phone: no store build needed. Plain revert backs it all out.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
isHostAccountSignInPage), the same check the host applies; pasted codes are capped at 4,096 characters.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)