Skip to content

fix(antigravity): run new chats on a signed-in agy so chat, quota and the picked account agree - #44943

Merged
nwparker merged 3 commits into
mainfrom
nwparker/agy-backend-select
Nov 20, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/agy-backend-select

Conversation

@nwparker

@nwparker nwparker commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca can run Antigravity chats two ways: on the agy you installed yourself, or on a copy Orca bundles that has its own sign-in. Once you had signed in to Orca's copy even once, Orca kept every new chat on it, even when your own agy was signed in, newer, and had more models. The usage meter and the account switcher still pointed at your own agy. So you could chat on account A, watch the meter for account B, switch accounts, and see nothing change. Now new chats use your own agy whenever it is signed in and can serve chats. Orca's copy is the fallback for when it can't. Settings says which one new chats use, and switching accounts restarts idle chats so they move to the new account.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​50
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​130 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​90

What Changed

  • Backend selection (antigravity-acp-launch-spec.ts, antigravity-host-acp.ts): a saved Orca Chat sign-in (acp_token.json, or auth state signedIn) no longer stops new chats from running on the host's agy acp. The other conditions stay the same:

    • the saved Chat account type is personal, so API-key, ADC and business methods keep the managed server;
    • agy has no API-key provider;
    • agy has a credential;
    • the agy acp probe passes (≥ 1.5.2, answers session/list).

    The now-unused hasManagedAntigravityChatSignIn and selectionRevision are removed.

  • Visibility (antigravity-chat-backend.ts, AntigravityAccountsSection.tsx):

    • accounts.antigravity{List,AddCurrent,Select,Remove} gain an optional chatUsesAgy field for the host target. The host computes it from structuredAgentHostAlternativeReady, waiting at most 1.5 s. Older hosts and WSL omit it.
    • Settings → Accounts → Antigravity uses it to say whether switching agy's account also applies to Antigravity chats. The Chat group says when its own sign-in is only the fallback.
  • Account switch ([Bug] The AI provider account does not change #43375): after accounts.antigravitySelect on the host, idle chats whose agent runs on the host's agy are stopped. Their next send resumes on the newly selected account.

    • This goes through the existing idle-sweep release path with a new anyway flag, so viewed or "Never stop" chats are included.
    • Owed work (an active turn, held or queued sends, a pending prompt) still keeps the agent running.
    • The cached agy acp readiness answer is also cleared, so the next check runs against the new login.

Why

hostBackend.select refused the host whenever the managed token existed. That rule came from #39006: "existing users of Orca's Chat sign-in are never moved". It left chat, quota and the picked account out of agreement:

  • Chat ran on the bundled 1.5.0 server with the Orca sign-in account, and lacked the Orchestrator models that host 1.5.12 lists.
  • The usage meter (agy -p /usage) read agy's own account.
  • Accounts → "agy in the terminal" switched agy's account, which managed chats never use.

The UI gave no way to see this or to leave the managed server. Making a signed-in agy the source of truth means the account picker, the quota and new chats are one account. The Settings group already describes Orca's own sign-in as the way "Chat works without agy installed".

Deliberate behavior change: someone who signed in to Orca's Chat with account X while agy holds account Y now gets Y for new chats. Settings now says so. Existing chats stay pinned to the backend they were created on, so managed chats keep Orca's sign-in.

Linked Issue

Fixes #44613
Refs #43375 (STA-12717): idle chats on the host's agy now follow an account switch. Chats on Orca's managed server and busy chats do not; see the remaining risks below.

Testing

  • antigravity-host-backend-select.test.ts: with a managed acp_token.json present and the Chat auth state signedIn, select returns agy's home. Without this fix it returns null; I checked by reverting.
  • structured-agent-session-early-release.test.ts: releaseIdleSession(id, true) stops a viewed chat's idle agent while "Never stop" is set.
  • pnpm tc:node, pnpm tc:web, oxlint, and pnpm check:changed (40 checks) pass.
  • Verified in a real dev Orca (Electron, macOS, host agy 1.5.13); see Visual Proof. Not checked against a real two-account setup: this host has no saved agy accounts in Orca, so the switch path was triggered through a temporary, uncommitted RPC seam.
  • structured-agent-session-early-release.test.ts: a running ACP-style agent with no adapter-reported home is found through its record's pinned home (the bug fixed in the third commit).

Remaining risks / follow-ups

  • Not verified with two real accounts: that a long-running agy acp keeps its starting login after a keyring switch, and that session/resume under a different Google account works.
  • Managed chats are not moved: chats created on the managed server stay on it, with Orca's sign-in account and no quota reading. Their history lives in the managed home, so moving them is not possible.
  • Busy chats at switch time keep the old account: a chat with a turn running when you switch stays on the old account until the regular idle sweep stops it.
  • Quota for the managed account isn't read. The meter has no reading for Orca's own sign-in when agy can't serve chats (not installed, older than 1.5.2, API-key provider, or a non-personal Chat account type). Reading it would need Google to expose usage for the managed server's token, either through agy-acp-server or by having agy -p /usage accept that token.
  • Orchestrator models on the managed server: the bundled agy-acp-server 1.5.0 does not list them. That needs a newer server build from Google, and a pin bump here.

Visual Proof

Real dev Orca on this branch (macOS, host agy 1.5.13, signed in). Process checks used ps.

a. No managed token: a new Antigravity chat spawns agy acp --dangerously-skip-permissions, answers "OK", and the picker lists Gemini 4 Carbon / Neon / Argon.

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

b. Dummy managed acp_token.json planted in the dev profile: the new chat still spawns host agy acp (no agy_acp_server) and the Orchestrator models show. Running this PR's selection test against origin/main's launch spec returns null (managed), so main would have used the managed server.

(screenshot removed: contained real product data)

c. Settings > AI Provider Accounts > Antigravity: with a personal Chat account type, it says new chats use agy's account. With the Chat account type set to Gemini Enterprise, it says switching does not apply to chats.

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

Non-personal Chat auth stays managed: with Gemini Enterprise, a new chat does not start host agy acp. It asks to install Orca's copy.

(screenshot removed: contained real product data)

d. Account switch path: when triggered (through a temporary seam, since there's no second saved account), the idle chat's agy acp stopped even though the chat was open. The busy chat, mid sleep 40, kept running. The next send to the idle chat started a new agy acp, and the chat resumed with its history.

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

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The host Antigravity backend selector now uses personal-auth, API-key, credential, and host-readiness checks. Account RPC responses can report whether chats use agy’s account, and settings descriptions reflect that state. Selecting an account clears cached host ACP checks and releases eligible idle Antigravity sessions. The idle release API accepts an optional flag that permits release when the normal idle policy would not stop a chat.

Severity of issue fixed: Medium

Merge Risk: Low · up to 57872

New Antigravity chats can now use the host's signed-in agy, and idle host chats are released after an account switch. The settings copy may still overstate how account selection affects existing chats. That wording issue is small and does not block the merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the main change: new Antigravity chats run on a signed-in host agy so chat, quota, and the selected account agree. It matches the changeset's core behavior (backend selection plus …
Linked Issues check Passed Directly linked issue #44613 has two coding objectives. (1) Consistent chat and quota attribution, or clear UI disclosure of any mismatch. (2) Backend visibility or selection when a compatible host ag…
Out of Scope Changes check Passed Each changed area connects to the #44613 objective of consistent account attribution or to its visibility objective. The backend selection change (antigravity-acp-launch-spec.ts, antigravity-host-acp.…
Description check Passed The description follows the repository template closely. It has an ELI5 section, a What Changed section that covers backend selection, visibility, and the account switch, and a Why section that explai…
Full details: Title check

Explanation

The title describes the main change: new Antigravity chats run on a signed-in host agy so chat, quota, and the selected account agree. It matches the changeset's core behavior (backend selection plus account visibility and idle-chat release). The title is a single line, uses the conventional prefix, and is specific enough for a teammate scanning history. Its length is at the upper end but acceptable.

Full details: Linked Issues check

Explanation

Directly linked issue #44613 has two coding objectives. (1) Consistent chat and quota attribution, or clear UI disclosure of any mismatch. (2) Backend visibility or selection when a compatible host agy is installed. The reviewed head addresses both. In antigravity-acp-launch-spec.ts, the host-backend selector no longer rejects the host agy when a managed acp_token.json or Chat auth state signedIn exists. It selects the host agy when the other conditions pass: personal Chat account type, no API-key provider, a host credential, and a passing agy acp probe (>= 1.5.2, answers session/list). New chats therefore use the account that the usage meter reads. antigravity-host-backend-select.test.ts covers the managed-token case. antigravity-chat-backend.ts sets chatUsesAgy for the host target, and AntigravityAccountsSection.tsx and en.json use it to state which account new chats use and when Orca's sign-in is only the fallback. The incremental changes since the previous review (childAccountHome orPinned, the anyway idle-release flag, restartIdleAgyChats, forgetAntigravityHostAcpChecks) support the account-switch part of the objective and the pinning of existing chats. Two parts of the issue remain outside this change and are stated in the PR body: managed-server chats keep the 1.5.0 runtime without Orchestrator models, and no quota reading is provided for the managed account. The issue's expected behavior allows either a backend choice or clear visibility, and the managed-runtime pin update depends on a newer Google build, so these limits do not fail the assessment. Not verified: runtime behavior with two real accounts, and Electron. This assessment relies on the supplied summary and the prior assessment; no additional source inspection was run for the incremental changes.

Full details: Out of Scope Changes check

Explanation

Each changed area connects to the #44613 objective of consistent account attribution or to its visibility objective. The backend selection change (antigravity-acp-launch-spec.ts, antigravity-host-acp.ts) implements the core requirement, and removal of hasManagedAntigravityChatSignIn and selectionRevision follows from it. chatUsesAgy, the withAntigravityChatBackend wrapper, and the Settings copy implement the visibility requirement. The account-switch path (restartIdleAgyChats, the anyway flag in structured-agent-session-idle-sweep.ts and structured-agent-session-host.ts) keeps idle host-agy chats on the selected account. The childAccountHome orPinned flag supports the stated rule that existing chats stay pinned to their backend. The PR body cites #43375 for the account-switch part, but #43375 is not in the linked issue list. The change is still justified by the #44613 attribution objective, and the PR body states its limits (busy chats and managed chats are not moved). The anyway flag can stop viewed or Never-stop idle chats. This is a wider behavior change, but it is used only by the account-switch path, so it is not a demonstrated unrelated change. Tests (antigravity-host-backend-select.test.ts, structured-agent-session-early-release.test.ts) and i18n strings support the implemented behavior. No change was found that lacks a connection to the linked objectives.

Full details: Description check

Explanation

The description follows the repository template closely. It has an ELI5 section, a What Changed section that covers backend selection, visibility, and the account switch, and a Why section that explains the reversal of the #39006 rule and the deliberate behavior change. It links an issue (Fixes #44613) and gives a Testing section with the two targeted tests and check commands. It includes a Visual Proof section with before and after screenshots for the settings text, the chat backend, and the account switch. The Risk section is not a separate heading, but the Remaining risks / follow-ups section covers what could break, the affected users, and the managed-server boundary. It does not give a rollback plan. The Risk Level, AI Disclosure, Agent skill upstream boundary, and Checklist items are not filled in, and the Testing checkboxes are not ticked. The Linked Issue section uses 'Fixes #44613', which matches the template. The Notes section is not addressed for Security, Cross-platform, Remote SSH, Mobile, or performance, and the description does not state platform coverage beyond macOS.

  • 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: 57a698a3-cdf4-4b21-9390-3e5074a2b59d
Commits

Reviewing files that changed from the base of the PR and between 510c730 and 57872ed.

Files selected for processing: 5

  • src/main/antigravity/antigravity-acp-launch-spec.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-conversation-reads.ts
  • src/main/native-chat/agent-session-wire/termination/structured-agent-session-early-release.test.ts
  • src/main/runtime/rpc/methods/accounts/antigravity-chat-backend.ts
  • src/renderer/src/i18n/locales/en.json
Files skipped from review as they are similar to previous changes: 1

  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 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: 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: b302e1d4-6845-4986-8d76-a1c5dea30e91
Commits

Reviewing files that changed from the base of the PR and between 01d45e1 and 510c730.

Files selected for processing: 11

  • src/main/antigravity/antigravity-acp-launch-spec.ts
  • src/main/antigravity/antigravity-host-acp.ts
  • src/main/antigravity/antigravity-host-backend-select.test.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/termination/structured-agent-session-early-release.test.ts
  • src/main/native-chat/agent-session-wire/termination/structured-agent-session-idle-sweep.ts
  • src/main/runtime/rpc/methods/accounts/antigravity-accounts.ts
  • src/main/runtime/rpc/methods/accounts/antigravity-chat-backend.ts
  • src/renderer/src/components/settings/accounts/providers/AntigravityAccountsSection.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/agent-accounts/antigravity/antigravity-account-types.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.

: state.chatUsesAgy
? t(
'accounts.antigravity.terminalDescriptionChats',
"Uses agy's own saved accounts. Switching applies to new agy sessions and to Antigravity chats."

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

Limit these descriptions to the chats that use agy.

chatUsesAgy describes new chats, not all existing chats. When it is true, existing managed chats still keep their original account. When it is false, existing host agy chats can still be affected by restartIdleAgyChats.

Describe new-chat selection separately from existing host agy chats. Update the matching English catalog entries as well.

Also applies to: 258-258

nwparker and others added 3 commits November 19, 2026 17:51
… the picked account agree

A saved Orca Chat sign-in no longer keeps new chats off the host's agy. When agy is
signed in and compatible, new chats use agy's account, which Accounts switches and the
usage meter reads, and agy's own (newer) model list. Orca's sign-in remains the fallback
when agy can't serve chats. Settings now says which account new chats use, and switching
agy's account stops idle chats on agy so their next send resumes on the new account.

Fixes #44613
Refs #43375
ACP adapters report no launch account home, so the post-switch sweep never
found a chat running on the host's agy and stopped nothing. Fall back to the
record's pinned home while a child runs.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

[Bug]: Antigravity managed ACP backend (1.5.0) causes missing Orchestrator models and quota mismatch with host agy CLI

1 participant