Skip to content

fix(antigravity): request fresh Chat login when changing accounts - #37439

Draft
darkspock wants to merge 1 commit into
stablyai:mainfrom
darkspock:fix/antigravity-chat-account-switch
Draft

darkspock wants to merge 1 commit into
stablyai:mainfrom
darkspock:fix/antigravity-chat-account-switch

Conversation

@darkspock

Copy link
Copy Markdown
Contributor

ELI5

Clicking Change account for Antigravity Chat can silently keep using the existing Google login. This change makes the explicit sign-in action request a fresh login and preserves the previous account if the replacement fails or is cancelled.

What Changed

  • Stage only the host-owned Chat acp_token.json before starting authentication. Keep its backup until authentication, session initialization, and server shutdown succeed.
  • Restore the previous token on failure/cancellation after the credential writer exits. If shutdown is unproven or Orca exits mid-switch, retain the backup and recover it during the next account preparation, after retained writers stop.
  • Leave native agy CLI credentials, settings, and conversations untouched. Reuse the existing per-host launch gate; no RPC or renderer changes.
  • Extract the existing sign-in error formatting unchanged to stay within the source-file line limit.

Why

The current flow calls ACP authenticate('oauth-personal') while the server can still read its valid cached Chat token. That allows authentication to complete without opening the browser. The explicit account-change action needs to remove that shortcut while preserving a rollback path.

Linked Issue

Fixes #37437

Visual Proof

Pending. The original behavior was reported on macOS with Orca 1.4.246. No rendered before/after capture or real Google OAuth validation of this patch is claimed; this PR is a draft until that interaction is verified. Layout and labels are unchanged.

Testing

  • I manually tested the patched Google account-switch flow locally.
  • Automated regression tests added.
  • macOS ARM64, Node 24.22.2, pinned pnpm 12.14.0 / Bun 1.4.4.
  • pnpm test src/main/antigravity src/main/acp/acp-launch-gate.test.ts --maxWorkers=2: 207 passed, 9 skipped across 20 files (two platform-specific files skipped).
  • Replayed the new cached-login regression with the original sign-in implementation: it fails because the flow reaches signedIn instead of waiting. It passes with this patch.
  • Temporary-file tests cover restoring partially written credentials, recovering an interrupted switch, failed initial sign-in, and refusing a token symlink. The scripted ACP tests cover successful replacement and cancellation.
  • pnpm check:changed --maxWorkers=2 --timeout=3: 21/22 checks passed, including typechecking, lint/format, changed-code quality and all applicable ratchets. The broad related-unit-test selection exceeded the explicit three-minute per-step limit; its result is incomplete. The scoped provider suite above passed separately.
  • Real Google OAuth, Linux, Windows, and paired-host manual validation remain pending. No production build is claimed.

Risk

Level: Medium. This changes credential-file handling for explicit Antigravity Chat sign-in. A filesystem error can prevent switching; the old token backup is retained for recovery. Token restoration waits for the writer to exit, and the existing gate stops starts/live chats before a switch. All file operations run on the execution host using its resolved GEMINI_HOME; no new wire fields or capabilities are introduced.

A revert restores the old behavior. If reverting during an interrupted switch, stop the Chat writer first and restore acp_token.json.orca-sign-in-backup to acp_token.json in that host's Chat account directory. No account secrets are included in this PR.

AI Disclosure

Prepared with OpenAI Codex (GPT-6), including implementation, automated tests, and this description. Real-provider validation remains explicitly pending.

Review

  • Self-reviewed for account isolation, cancellation, interrupted recovery, and process-exit ordering.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content is copied or translated.

Checklist

  • This PR is small and focused.
  • User-facing behavior, mechanism, and risk are explained.
  • Before/after interaction evidence attached.
  • Cross-platform paths, host ownership, remote/mobile callers, and wire compatibility considered.
  • Full lint/typecheck/test/build CI validation complete; scoped local evidence is listed above.

This branch has not been deployed

No deployments
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.

Antigravity Chat Change account silently reuses the cached login

1 participant