Skip to content

feat(mobile): switch a usage-limited Antigravity chat to another saved account from the phone - #51582

Merged
AmoabaKelvin merged 3 commits into
mainfrom
feat/mobile-antigravity-account-switch
Nov 28, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
feat/mobile-antigravity-account-switch

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When an Antigravity chat runs out of quota, the phone can now move it to another saved Google account, the same way desktop's usage-limit row does. Switching an Antigravity account on the phone's Accounts screen now shows the same confirmation desktop does.

Files Added Deleted Net
Test 0 0 0 0
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​288 $\color{#cf222e}{\Huge{\mathbf{−}}}$​33 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​255

What Changed

Builds on #50216, #51498 and #49584 (the Accounts screen sections), all now on main.

Chat usage-limit row (phone)

Accounts screen: switching an Antigravity account shows the same success toast; a failure uses desktop's title.

Toast: a two-line toast now keeps clear of the screen edges.

Why

#51498 added the desktop menu and noted the phone's menu as a separate PR. A separate host field keeps older phones from offering a switch that dead-ends. Mounting the sheet with the chat (not in the row) is what keeps a switch from being cut off when the chat is freed.

Linked Issue

#50155 (the phone part; #50216 and #51498 cover the host and desktop).

Visual Proof

Rendered from the branch's real components on a phone-sized page, iPhone 18 Pro size, dark and light. The host is faked; it answers the list, select and options calls the real host serves.

Usage-limited Antigravity chat with Switch Account:

(screenshot removed: contained real product data)

The sheet (dark / light):

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

After picking an account (dark / light):

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Accounts screen, before and after a switch, and a refused switch:

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Testing

  • Drove the real phone components (Accounts screen, usage-limit row, sheet, toast) against a fake host in a browser at phone size. Recorded calls: accounts.antigravityList {"runtime":"host"}, then agentSession.options {"sessionId":…}, then accounts.antigravitySelect {"target":{"runtime":"host"},"accountId":"a2"}. The failure path shows the host's message.

  • Checked that the host's caller scope now lets a phone (including a delegated one) call accounts.antigravityList, accounts.antigravitySelect and accounts.selectData. accounts.antigravityRemove stays refused.

  • pnpm -C mobile typecheck, pnpm check:changed against the stack base.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below: UI and RPC wiring, which the repo's test rules leave to running it.

  • Every added test fails without this change and avoids the test anti-patterns

Performance

None, because the only new host read (accounts.antigravityList) runs when the sheet opens. The usage-limit row reads the same agentSession.options answer it already fetched.

Risk

The riskiest part is mixed versions. Each case:

  • Older phone: ignores canSwitchAntigravityAccount and keeps canSwitchAccount, which the host leaves false for Antigravity.
  • Older host: sends neither the field nor the capability, so the phone shows no button.
  • Host that lists accounts but refuses a phone: has no capability, so the phone shows no section.
  • New server relayed through an older Mac: the phone may offer the button and show the Mac's refusal as a failure. Other server-only phone methods behave the same way.

A plain revert backs this out.

Level: Low

AI Disclosure

Review

One review round (Codex and a Claude reviewer). Fixed:

  • Select now waits 90 s, as desktop does, for a keychain prompt on the host.
  • The sheet opens at once, and closes when no accounts are left.
  • The switch toast stays up 4 s.
  • The "native account changed" note shows only where desktop shows it.
  • agy's moved login can be picked.
  • A Codex reset reply keeps the OpenCode/Devin profiles.

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

A phone's select sends no terminal choice, so the host's agy terminals follow its running-sessions setting from #51652.

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

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)

@AmoabaKelvin
AmoabaKelvin force-pushed the feat/mobile-antigravity-account-switch branch from eb7a366 to 3a13f78 Compare November 28, 2026 07:39
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/antigravity-usage-limit-account-switch branch 3 times, most recently from 137566a to 432377e Compare November 28, 2026 09:02
@AmoabaKelvin
AmoabaKelvin force-pushed the feat/mobile-antigravity-account-switch branch from 3a13f78 to ff7028c Compare November 28, 2026 09:13
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/antigravity-usage-limit-account-switch branch 2 times, most recently from b266680 to 27e9de2 Compare November 28, 2026 09:39
@AmoabaKelvin
AmoabaKelvin force-pushed the feat/mobile-antigravity-account-switch branch from ff7028c to 4e802bb Compare November 28, 2026 09:45
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/antigravity-usage-limit-account-switch branch from 27e9de2 to a40a302 Compare November 28, 2026 10:55
…the phone

The chat's usage-limit row offers Switch Account for Antigravity only when
the host sends canSwitchAntigravityAccount (never canSwitchAccount, which
older phones offer for any agent) and advertises the phone switch. It opens
a sheet of that host's saved accounts; a pick re-checks the chat, calls
accounts.antigravitySelect on the chat's host and shows desktop's toast.
The sheet lives with the chat, so a switch that lets the host continue the
chat still finishes.

Switching on the Accounts screen shows the same toast, and its failure
uses desktop's title.
@AmoabaKelvin
AmoabaKelvin force-pushed the feat/mobile-antigravity-account-switch branch from 4e802bb to d2c1356 Compare November 28, 2026 12:49
@AmoabaKelvin
AmoabaKelvin changed the base branch from fix/antigravity-usage-limit-account-switch to main November 28, 2026 12:49
@AmoabaKelvin AmoabaKelvin reopened this Nov 28, 2026
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change adds Antigravity account switching to mobile account settings and usage-limited chats. The chat account model is exposed when host support and session options allow switching. A new account sheet lists and selects host accounts, and the usage-limit notice can open it. Toasts report switch results. The account schema also permits a missing or null subject.

Merge Risk: Low · up to d2c13

Account switching from a usage-limited chat is gated by host capability checks and works as described. In a rare case, such as a tab closing while the picker is open, the picker could stay visible and act on the previous chat. This is a low-risk follow-up and not a merge blocker.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: letting a phone move a usage-limited Antigravity chat to another saved account. The changeset adds the chat row action, account sheet, host capability gating, and the …
Description check Passed The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, upstream boundary, Notes, an…
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 names the main change: letting a phone move a usage-limited Antigravity chat to another saved account. The changeset adds the chat row action, account sheet, host capability gating, and the Accounts screen toast, which all match the title's scope. The title uses the conventional feat(mobile) prefix and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, upstream boundary, Notes, and Checklist sections, and each is filled in with specific, concrete content. The Visual Proof section links before/after screenshots for the chat row, sheet, toast, and Accounts screen. Minor gaps: the Performance line is filled in, but the Risk Level is set to Low with no reasoning beyond the mixed-version list; the AI Disclosure section is empty; and the Linked Issue section cites #50155 without the 'Fixes #' form the template uses. These gaps are non-critical, so the check passes.

  • 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

@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: 1

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: 6eb0ede4-7746-4639-8151-99a6e93e0017
Commits

Reviewing files that changed from the base of the PR and between f44167e and d2c1356.

Files selected for processing: 14

  • mobile/src/accounts/MobileAccountsScreen.tsx
  • mobile/src/accounts/antigravity-account-section.tsx
  • mobile/src/accounts/antigravity-account-switch.ts
  • mobile/src/accounts/provider-account-operations.ts
  • mobile/src/accounts/provider-account-sections.tsx
  • mobile/src/components/feedback/transient-toast-styles.ts
  • mobile/src/i18n/locales/en.json
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/native-chat/MobileNativeChatOverlay.tsx
  • mobile/src/session/native-chat/agent-session/mobile-structured-agent-session-host-support.ts
  • mobile/src/session/native-chat/status/use-mobile-native-chat-usage-limit.ts
  • mobile/src/session/native-chat/transcript/notices/MobileAntigravityChatAccountSheet.tsx
  • mobile/src/session/native-chat/transcript/notices/MobileNativeChatUsageLimitStatus.tsx
  • mobile/src/session/native-chat/transcript/notices/mobile-native-chat-notice-context.ts
Files with no reviewable changes: 1

  • mobile/src/accounts/antigravity-account-section.tsx

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

onToast: ((message: string, durationMs?: number) => void) | undefined
): { open: (() => void) | undefined; sheet: ReactNode } {
// A copy, so a switch that frees the row (and drops `accounts`) leaves the sheet open.
const [shown, setShown] = useState<AntigravityChatAccounts | null>(null)

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.

Minor · Functional Correctness · Quick win

Bind the account picker to the chat it was opened from.

The picker keeps the account adapter from the chat that opened it. The overlay is not keyed by chat, and the picker's visibility does not depend on the active chat. If the active chat changes while the picker is open, for example after the active tab closes or is reconciled, the picker stays visible over the new chat. A selection then still calls the adapter for the previous chat.

Define the required behavior before changing the code. When the active chat changes while the picker is open, the picker must either close or stop acting on the previous chat. The picker must not select an account for a chat the user is no longer viewing. Keep the intended behavior when only the usage-limit row disappears: the picker still completes its selection.

@AmoabaKelvin
AmoabaKelvin merged commit 6fe9491 into main Nov 28, 2026
85 of 124 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