Skip to content

feat(mobile): add or sign in Claude and Codex accounts from the phone - #51701

Merged
AmoabaKelvin merged 5 commits into
mainfrom
phone-account-sign-in
Nov 28, 2026
Merged

AmoabaKelvin merged 5 commits into
mainfrom
phone-account-sign-in

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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.
@AmoabaKelvin
AmoabaKelvin force-pushed the fix-accounts-grouped-colours branch from 0b31732 to 7584621 Compare November 28, 2026 11:01
@AmoabaKelvin
AmoabaKelvin changed the base branch from fix-accounts-grouped-colours to main November 28, 2026 11:04
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 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.
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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd7d50a1-195f-4381-ac0b-33bc1e2744c9
Commits

Reviewing files that changed from the base of the PR and between 9d0b898 and 8abf7fc.

Files selected for processing: 6

  • mobile/src/accounts/MobileAccountsScreen.tsx
  • mobile/src/accounts/sign-in/MobileHostAccountSignInSheet.tsx
  • mobile/src/accounts/sign-in/use-accounts-screen-sign-in.tsx
  • mobile/src/accounts/sign-in/use-chat-account-sign-in.tsx
  • mobile/src/accounts/sign-in/use-host-account-sign-in.ts
  • src/shared/agent-accounts/host-account-sign-in-run.ts

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d59d5ca5-2f90-484c-bcab-65733dac0064
Commits

Reviewing files that changed from the base of the PR and between 1015f3d and 9d0b898.

Files selected for processing: 51

  • config/tsconfig.node.json
  • mobile/src/accounts/MobileAccountsScreen.tsx
  • mobile/src/accounts/accounts-snapshot.ts
  • mobile/src/accounts/antigravity-account-section.tsx
  • mobile/src/accounts/managed-data-account-section.tsx
  • mobile/src/accounts/mobile-accounts-screen-styles.ts
  • mobile/src/accounts/provider-account-sections.tsx
  • mobile/src/accounts/sign-in/MobileHostAccountSignInSheet.tsx
  • mobile/src/accounts/sign-in/host-account-sign-in-operations.ts
  • mobile/src/accounts/sign-in/use-accounts-screen-sign-in.tsx
  • mobile/src/accounts/sign-in/use-chat-account-sign-in.tsx
  • mobile/src/accounts/sign-in/use-host-account-sign-in.ts
  • mobile/src/accounts/usage/UsageBar.tsx
  • mobile/src/accounts/usage/codex-reset-credit-capability.ts
  • mobile/src/accounts/usage/use-codex-reset-credit-action.ts
  • mobile/src/bots/MobileBotImportExportSteps.tsx
  • mobile/src/components/list/ListStepMark.tsx
  • mobile/src/i18n/en-runtime-required.json
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/native-chat/MobileNativeChatOverlay.tsx
  • mobile/src/session/native-chat/transcript/notices/MobileNativeChatNoticeRow.tsx
  • mobile/src/session/native-chat/transcript/notices/mobile-native-chat-notice-context.ts
  • mobile/src/session/native-chat/transcript/notices/native-chat-notice-sign-in.ts
  • mobile/src/transport/connection/use-runtime-capability.ts
  • src/main/runtime/agent-session/environment/host-account-sign-in-flows.ts
  • src/main/runtime/caller-owned-sign-in-contract.ts
  • src/main/runtime/caller-owned-sign-in-flows.test.ts
  • src/main/runtime/caller-owned-sign-in-flows.ts
  • src/main/runtime/hosts/runtime-status.ts
  • src/main/runtime/rpc/server/runtime-rpc-mobile-paired-desktop-methods.ts
  • src/renderer/src/components/settings/accounts/AccountsPane.tsx
  • src/renderer/src/components/settings/accounts/codex/accounts-pane-codex-account-row.tsx
  • src/renderer/src/runtime/provider-accounts/sign-in/host-account-sign-in-failure-text.ts
  • src/renderer/src/runtime/provider-accounts/sign-in/host-sign-in-lost-answers.ts
  • src/renderer/src/runtime/provider-accounts/sign-in/runtime-host-account-sign-in-client.ts
  • src/shared/agent-accounts/codex/codex-account-auth-warning.ts
  • src/shared/agent-accounts/host-account-sign-in-run.test.ts
  • src/shared/agent-accounts/host-account-sign-in-run.ts
  • src/shared/agent-accounts/host-account-sign-in-types.ts
  • src/shared/remote-runtime/protocol/account-runtime-capabilities.ts
Files with no reviewable changes: 3

  • config/tsconfig.node.json
  • mobile/src/accounts/usage/codex-reset-credit-capability.ts
  • src/renderer/src/runtime/provider-accounts/sign-in/host-sign-in-lost-answers.ts

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.
@AmoabaKelvin
AmoabaKelvin merged commit 81aba4a into main Nov 28, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant