Skip to content

feat: add Antigravity multi-account support - #23761

Closed
Tai-DT wants to merge 1 commit into
stablyai:mainfrom
Tai-DT:feat/antigravity-multi-account
Closed

Tai-DT wants to merge 1 commit into
stablyai:mainfrom
Tai-DT:feat/antigravity-multi-account

Conversation

@Tai-DT

@Tai-DT Tai-DT commented Sep 29, 2026

Copy link
Copy Markdown

Summary

  • Add AntigravityManagedAccount types and settings
  • Add main process account service with selection, registration, auth storage
  • Add IPC handlers for list/add/remove/select/reauthenticate
  • Add preload API types for renderer
  • Add AntigravityAccountsSection UI component
  • Wire up service in registerCoreHandlers and main-window-core-services
  • Add OpenCode session option catalog with 8 models from 9router

Test plan

  • Build on CI (adhoc-mac-build)
  • Verify Antigravity account list/add/remove/select in Settings → Accounts
  • Verify account switching passes correct auth to agy CLI
  • Verify OpenCode model picker shows 8 models from 9router

Copilot AI balanced review requested due to automatic review settings September 29, 2026 01:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The change adds Antigravity managed-account settings, runtime-specific selection, registration and reauthentication, managed-auth storage, and account actions through IPC and a settings component. The service’s login-capture method currently returns empty credentials and a null email. The change also adds and registers an OpenCode session-option catalog with model and reasoning-effort options, launch arguments, override detection, and mid-session commands.

Priority: ➖ Normal

Merge Risk: 🟠 High · up to 8dcf3

As written, the app fails its type check and cannot open its main window, because the new account service is never created at startup. Adding an account also saves an entry with no credentials. Removing an account can recursively delete whatever directory its stored path names, without checking that the app owns it. A failed add can also undo settings the user changed while login was running. Fix these before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 8dcf3

Account removal can delete a stored path without checking that it still belongs to the account. Removal can also leave credential files behind if deletion fails. The demonstrated reach is local, and whether an untrusted caller can change the stored path remains unresolved.

Retained concerns

  • Medium · security · observed: Account removal recursively deletes the persisted credential path without checking that it is the account-owned path. A modified stored path would bypass the ownership control applied to other credential operations.
  • Medium · security · inferred: Removal commits the account and selection changes before credential deletion. If deletion fails, the account disappears from managed state while its credential directory remains, and repeating removal by account ID is rejected.
Security review details

Security Blast Radius

  • inferred — The deletion sink is a local main-process filesystem operation. If a stored path can be changed, deletion is not confined by this method to the managed credential root; the observed IPC removal input alone does not supply such a path.

Security Findings and Attack Paths

  • observed — The retained finding identifies unvalidated recursive deletion of the persisted managed-auth path. The account-ID lookup and validated path creation constrain ordinary use but do not validate the path at deletion. An untrusted route to alter the persisted path has not been established.

Trust Boundaries and Controls

  • observed — Renderer-facing account operations delegate to the main-process service. Removal crosses from persisted account metadata to a privileged filesystem sink without applying the account-aware ownership control used on credential writes and reauthentication.

Resilience and Maintainability Implications

  • inferred — A filesystem deletion failure after settings are updated can leave credential material outside the managed account lifecycle, weakening cleanup and recovery.

Hardening Proposals

  • proposed — Require account-ID-bound ownership validation immediately before recursive deletion, and retain enough account or cleanup state to retry a failed removal safely.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the implementation and lists planned tests, but it does not follow the required template. It omits the ELI5, What Changed, Why, Linked Issue, Visual Proof, AI Disclosure, Re… Rewrite the description using the repository template. Add the required sections, provide the linked issue, include before-and-after visual proof or state N/A with a reason, document why this approach was chosen, record completed testing an…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 19 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding Antigravity multi-account support.
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: Description check

Explanation

The description summarizes the implementation and lists planned tests, but it does not follow the required template. It omits the ELI5, What Changed, Why, Linked Issue, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. It also reports no completed test results or platform coverage.

Resolution

Rewrite the description using the repository template. Add the required sections, provide the linked issue, include before-and-after visual proof or state N/A with a reason, document why this approach was chosen, record completed testing and platform coverage, complete the checklist, and provide the required security, compatibility, performance, SSH, and AI disclosure information.

  • Fix all pre-merge checks with AI

Warning

⚠️ This pull request has been flagged as potential spam (promotional) by CodeRabbit slop detection and should be reviewed carefully.


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

Comment @coderabbitai help to get the list of available commands.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7530b2cf-7f03-4a1e-bee0-c7bfe685f7ac

📥 Commits

Reviewing files that changed from the base of the PR and between 28942ee and 8dcf3e2.

📒 Files selected for processing (19)
  • src/main/antigravity-accounts/antigravity-account-registration.ts
  • src/main/antigravity-accounts/antigravity-account-selection.ts
  • src/main/antigravity-accounts/antigravity-managed-auth-storage.ts
  • src/main/antigravity-accounts/managed-auth-path.ts
  • src/main/antigravity-accounts/runtime-selection.ts
  • src/main/antigravity-accounts/service.ts
  • src/main/ipc/antigravity-accounts.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/startup/main-process-state.ts
  • src/main/startup/main-window-core-services.ts
  • src/preload/api/agent-account-api.ts
  • src/renderer/src/components/settings/accounts-pane-antigravity-section.tsx
  • src/shared/agent-session-option-catalog-opencode.test.ts
  • src/shared/agent-session-option-catalog-opencode.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/antigravity-managed-account-types.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts

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

Comment on lines +27 to +30
} catch (error) {
await this.dependencies.storage.remove(location.managedAuthPath)
this.dependencies.store.updateSettings(previousSettings)
throw error

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Stop the rollback from overwriting unrelated settings.

The catch block calls updateSettings(previousSettings) with a full snapshot. That snapshot was taken before login ran. Login can take a long time, and the user can change other settings while it runs. The rollback reverts all of those changes. persist writes settings as its last step, so nothing needs a rollback. Remove the settings restore and keep only the storage cleanup.

🐛 Proposed fix
     } catch (error) {
       await this.dependencies.storage.remove(location.managedAuthPath)
-      this.dependencies.store.updateSettings(previousSettings)
       throw error
     }

persist also appends to the stale previousSettings.antigravityManagedAccounts list. Read the account list fresh at write time.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
await this.dependencies.storage.remove(location.managedAuthPath)
this.dependencies.store.updateSettings(previousSettings)
throw error
} catch (error) {
await this.dependencies.storage.remove(location.managedAuthPath)
throw error

Comment on lines +55 to +57
async remove(managedAuthPath: string): Promise<void> {
rmSync(managedAuthPath, { recursive: true, force: true })
}

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.

🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- relevant files ---'
fd -i 'antigravity.*(selection|service|registration|storage)|managed-auth-path|.*ipc.*' src/main src 2>/dev/null | head -80
printf '%s\n' '--- symbols and callers ---'
rg -n -C 5 'class AntigravityAccountSelection|async remove|storage\.remove|selection\.remove|antigravity.*remove|remove\(' src/main/antigravity-accounts src/main 2>/dev/null | head -240
printf '%s\n' '--- current changed file ---'
cat -n src/main/antigravity-accounts/antigravity-managed-auth-storage.ts
printf '%s\n' '--- diff for bounded area ---'
git diff --unified=40 aedb9305cd1b3de859b5eafc1ee0d77fa0df8963 8dcf3e2e5553f64c55c31a37005758955eab657d -- src/main/antigravity-accounts

Repository: stablyai/orca

Length of output: 42180


Path Traversal

Reachability: Internal
Exploitability: Difficult
CWE: CWE-22 — Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Validate ownership in remove before the recursive delete.

The selection path passes the persisted managedAuthPath directly to rmSync. A tampered setting can therefore make account removal delete an arbitrary directory tree. Pass accountId through both callers and validate the path before deleting its account directory.

🛡️ Proposed fix
-      await this.dependencies.storage.remove(location.managedAuthPath)
+      await this.dependencies.storage.remove(location.managedAuthPath, accountId)

-  async remove(managedAuthPath: string): Promise<void> {
-    rmSync(managedAuthPath, { recursive: true, force: true })
+  async remove(managedAuthPath: string, accountId: string): Promise<void> {
+    const trustedPath = resolveOwnedAntigravityManagedAuthPath(accountId, managedAuthPath)
+    if (!trustedPath) {
+      return
+    }
+    rmSync(join(trustedPath, '..'), { recursive: true, force: true })
   }

-    this.selection = new AntigravityAccountSelection(store, (_accountId, path) =>
-      this.storage.remove(path).then(() => undefined)
+    this.selection = new AntigravityAccountSelection(store, (accountId, path) =>
+      this.storage.remove(path, accountId).then(() => undefined)
     )

View in Security blast radius

Comment on lines +55 to +64
private async runAntigravityLoginAndCapture(
_location: AntigravityManagedAuthLocation
): Promise<{ credentialsJson: string; email: string | null }> {
// TODO: Implement actual antigravity CLI login flow
// For now, return a placeholder that can be replaced with real implementation
return {
credentialsJson: JSON.stringify({}),
email: 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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Implement the login flow before you ship this feature.

runAntigravityLoginAndCapture returns {} as the credentials and null as the email. When a user clicks "Add Account", the app saves an account that has no credentials. The account is labeled authMethod: 'api-key', which is also wrong. The PR objective says account switching passes auth to the agy CLI, but this stub gives the CLI no auth. Implement the CLI login flow, or throw a "not implemented" error so that the app saves no empty accounts.

Do you want me to draft the login capture flow, or open an issue to track it?

Comment on lines +7 to +20
ipcMain.handle('antigravityAccounts:add', (_event, args?: AntigravityAccountAddTarget) =>
antigravityAccounts.addAccount(args)
)
ipcMain.handle('antigravityAccounts:reauthenticate', (_event, args: { accountId: string }) =>
antigravityAccounts.reauthenticateAccount(args.accountId)
)
ipcMain.handle('antigravityAccounts:remove', (_event, args: { accountId: string }) =>
antigravityAccounts.removeAccount(args.accountId)
)
ipcMain.handle(
'antigravityAccounts:select',
(_event, args: { accountId: string | null } & AntigravityAccountSelectionTarget) =>
antigravityAccounts.selectAccount(args.accountId, args)
)

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Validate the renderer arguments in the IPC handlers.

The handlers pass args straight to the service without checking it. If args is missing, args.accountId throws a TypeError. runtime and wslDistro are also used without a type check. Parse each payload with zod, which the project already depends on, before you call the service.

🛡️ Proposed fix
import { z } from 'zod'
const target = z.object({ runtime: z.enum(['host', 'wsl']).optional(), wslDistro: z.string().nullable().optional() })
const idArgs = z.object({ accountId: z.string().uuid() })
const selectArgs = target.extend({ accountId: z.string().uuid().nullable() })

Based on learnings: every main-process IPC handler must validate data from the renderer before it uses the data.

Source: Learnings

Comment on lines 49 to 55
!museUsage ||
!codexAccounts ||
!claudeAccounts ||
!antigravityAccounts ||
!rateLimits ||
!automations ||
!keybindings ||

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'antigravityAccounts|AntigravityAccountService' src/main --glob '!*.test.ts'
rg -n 'claudeAccounts\s*=|new ClaudeAccountService' src/main

Repository: stablyai/orca

Length of output: 7277


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- startup files ---'
for f in src/main/startup/main-window-core-services.ts src/main/startup/main-process-state.ts src/main/startup/main-process-account-services.ts src/main/startup/main-process-runtime-service.ts; do
  echo "### $f"
  sed -n '1,240p' "$f"
done

printf '%s\n' '--- attach call sites and assignments ---'
rg -n -C 4 'attachMainWindowCoreServices|antigravityAccounts\s*=|new AntigravityAccountService' src --glob '!*.test.ts'

printf '%s\n' '--- reviewed-head diff for implicated startup files ---'
git diff --no-ext-diff --unified=25 aedb9305cd1b3de859b5eafc1ee0d77fa0df8963 8dcf3e2e5553f64c55c31a37005758955eab657d -- src/main/startup/main-window-core-services.ts src/main/startup/main-process-state.ts src/main/startup/main-process-account-services.ts src/main/startup/main-process-runtime-service.ts

Repository: stablyai/orca

Length of output: 41383


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- account initializer and callers ---'
rg -n -C 8 'initializeMainProcessAccountServices|antigravityAccounts\s*=|new AntigravityAccountService' src --glob '!*.test.ts'
sed -n '55,115p' src/main/startup/main-process-account-services.ts

printf '%s\n' '--- window startup path ---'
sed -n '130,205p' src/main/startup/main-window-controller.ts
rg -n -C 8 'createMainWindow|initializeMainProcess|attachMainWindowController|mainWindowController|createWindow' src/main --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 41844


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- AntigravityAccountService declaration ---'
sed -n '1,180p' src/main/antigravity-accounts/service.ts
printf '%s\n' '--- Antigravity account module files and usages ---'
rg -n -C 5 'AntigravityAccountService|registerAntigravityAccountHandlers|antigravityAccounts' src/main/antigravity-accounts src/main/ipc src/main/startup --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 15577


Initialize antigravityAccounts before the main window attaches services.

Ready startup initializes the other account services, but it never assigns state.antigravityAccounts. The main-window guard therefore throws before registering core handlers on every desktop launch.

Suggested fix
 import { ClaudeAccountService } from '../claude-accounts/service'
+import { AntigravityAccountService } from '../antigravity-accounts/service'
...
   state.claudeAccounts = new ClaudeAccountService(store, state.rateLimits, state.claudeRuntimeAuth)
+  state.antigravityAccounts = new AntigravityAccountService(store)

Comment on lines +366 to +367
/** Why: closing a terminal with a running process is destructive, so confirm by default. */
skipCloseTerminalWithRunningProcessConfirm: boolean

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.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Remove the duplicate skipCloseTerminalWithRunningProcessConfirm property.

Lines 367 and 369 both declare skipCloseTerminalWithRunningProcessConfirm in GlobalSettings. TypeScript reports a duplicate identifier error (TS2300) when a type literal declares the same property twice. The duplicate breaks the type check and the CI build. Delete the added declaration and keep the existing one on Line 369.

🐛 Proposed fix
-  /** Why: closing a terminal with a running process is destructive, so confirm by default. */
-  skipCloseTerminalWithRunningProcessConfirm: boolean
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/** Why: closing a terminal with a running process is destructive, so confirm by default. */
skipCloseTerminalWithRunningProcessConfirm: boolean

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

Caution

This PR breaks the build and the app at this head. pnpm tc fails with a duplicate property in global-settings-types.ts, and attachMainWindowCoreServices now throws because state.antigravityAccounts is never initialized — so the main window can no longer register its core handlers. It also adds an unvalidated recursive delete path. Details inline.

Reviewed changes

  • Antigravity main-process subsystem — new src/main/antigravity-accounts/ service composing registration, selection, managed auth storage, and path-ownership validation, plus src/main/ipc/antigravity-accounts.ts handlers.
  • Startup/IPC wiring — AntigravityAccountService threaded through registerCoreHandlers and attachMainWindowCoreServices, with a typed mainProcessState slot.
  • Settings schema — antigravityManagedAccounts, activeAntigravityManagedAccountId, and runtime selection, plus defaults.
  • Preload/renderer surface — AntigravityAccountsApi type and an AntigravityAccountsSection component.
  • Unrelated OpenCode catalog — OPENCODE_SESSION_OPTION_CATALOG (8 seeded kr/* models), registered in the catalog map with a new test file.

⚠️ The feature is not reachable from the renderer

AntigravityAccountsSection is defined but never imported or mounted in any accounts pane, and the preload bridge for AntigravityAccountsApi is absent (see inline). Even setting aside the auth stub, no user can reach the Add/Select/Remove/Re-auth UI, so the advertised multi-account flow does not function end to end.

Technical details
# Antigravity accounts unreachable end-to-end

## Affected sites
- `src/renderer/src/components/settings/accounts-pane-antigravity-section.tsx` — component has no importer; the accounts pane never renders it.
- `src/preload/api/agent-account-api.ts:62` — type declared, never exposed on `window.api`.
- `src/main/antigravity-accounts/service.ts:55` — login returns empty credentials.

## Required outcome
- Mount the section in the accounts pane with a state hook that calls the new IPC channels.
- Expose the API through `PreloadApi`/`api-types.ts` and a `preload/index.ts` bridge.
- Replace the placeholder login with the real Antigravity CLI capture before claiming the feature works.

## Open questions for the human
- Is this PR intended as scaffolding-only (login + UI to follow), or should it be marked draft until the flow is wired?

ℹ️ Unrelated OpenCode model catalog bundled into this PR

OPENCODE_SESSION_OPTION_CATALOG and its tests have nothing to do with Antigravity multi-account support. Bundling it makes the diff harder to review and couples two independent rollbacks; consider splitting it out or calling out the intent in the PR description.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

/** Why: worktree deletion is destructive, so confirm by default. */
skipDeleteWorktreeConfirm: boolean
/** Why: closing a terminal with a running process is destructive, so confirm by default. */
skipCloseTerminalWithRunningProcessConfirm: boolean

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.

The PR adds a second skipCloseTerminalWithRunningProcessConfirm immediately before the pre-existing one at line 369. pnpm tc:node fails with TS2300: Duplicate identifier at both lines, so typecheck is red at this head — likely a stray merge artifact. Remove the added declaration and its doc comment.

!museUsage ||
!codexAccounts ||
!claudeAccounts ||
!antigravityAccounts ||

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.

state.antigravityAccounts is added to the required-services guard here, but nothing ever assigns it — initializeMainProcessAccountServices() constructs the Claude and Codex services only. The guard therefore always trips and this function throws 'Main window services must be initialized before attaching', so no core handlers register.

Technical details
# Initialize the Antigravity account service

## Affected sites
- `src/main/startup/main-window-core-services.ts:52` — new `!antigravityAccounts` guard.
- `src/main/startup/main-process-account-services.ts` — builds `state.claudeAccounts`/`state.codexAccounts` but not `state.antigravityAccounts`.
- `src/main/startup/main-process-state.ts:85` — typed slot, initialized to `null`.
- `src/main/startup/main-window-core-services.test.ts` — state mock lacks the field; already fails with `Error: Main window services must be initialized before attaching`.

## Required outcome
- Construct `state.antigravityAccounts = new AntigravityAccountService(store)` in `initializeMainProcessAccountServices()`.
- Add `antigravityAccounts` to the mocked state in `main-window-core-services.test.ts` so the composition-root test passes again.

}

async remove(managedAuthPath: string): Promise<void> {
rmSync(managedAuthPath, { recursive: true, force: true })

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.

remove deletes straight from the persisted managedAuthPath with rmSync(..., { recursive: true }) and never runs the ownership check that assertOwned enforces elsewhere. A tampered or stale path in the settings file would let this recursively delete an arbitrary directory. Claude's equivalent (claude-managed-auth-storage.ts:141) calls assertOwned first and swallows the failure; the caller here even drops the accountId.

Technical details
# Validate managed auth path before recursive delete

## Affected sites
- `src/main/antigravity-accounts/antigravity-managed-auth-storage.ts:55` — `remove` skips `assertOwned`.
- `src/main/antigravity-accounts/service.ts:21` — callback `(_accountId, path) => this.storage.remove(path)` discards the id.

## Required outcome
- Thread `accountId` into `remove` and resolve the path through `assertOwned` before `rmSync`, refusing (without deleting) when validation fails.

export class AntigravityManagedAuthStorage {
async create(
accountId: string,
_target?: AntigravityManagedAuthTarget

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.

target is ignored (_target) and create always returns managedAuthRuntime: 'host', wslDistro: null. A WSL add therefore silently creates a host account, making the WSL branches in runtime-selection.ts and getSelectedAntigravityAccountIdForTarget unreachable. Either implement WSL location creation or drop the target parameters.

}) => Promise<ClaudeRateLimitAccountsState>
}

export type AntigravityAccountsApi = {

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.

AntigravityAccountsApi is declared but never added to PreloadApi/api-types.ts, and there is no bridge (e.g. preload/api/antigravity-accounts-bridge.ts) or preload/index.ts registration. The renderer has no window.api.antigravityAccounts, so none of the new IPC handlers can be invoked.

private async runAntigravityLoginAndCapture(
_location: AntigravityManagedAuthLocation
): Promise<{ credentialsJson: string; email: string | null }> {
// TODO: Implement actual antigravity CLI login flow

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.

Every add and reauthenticate persists {} as credentials and a null email through the real auth-storage path. Accounts are created and the UI presents them as authenticated while writing empty credentials — the core capability of the PR is stubbed.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 0/5

[High risk] Adds multi-account support for Antigravity with credential storage.

This PR is not safe to merge because the uninitialized service prevents main-window startup, and the new account flow has additional build and correctness failures.

Findings

  1. P1 Main window cannot attach ▶
  2. P1 Duplicate settings member ▶
  3. P1 Account API is not exposed ▶
  4. P1 Account controls never appear ▶
  5. P1 Empty credentials count as login ▶
  6. P1 Selection never reaches agent ▶
  7. P1 WSL target is ignored ▶
  8. P1 Removal trusts stored path ▶
  9. P1 Concurrent adds lose accounts ▶
  10. P1 Failed add reverts other changes ▶
  11. P2 Selection accepts invalid accounts ▶

Summary

This PR adds Antigravity account types, storage, IPC handlers, and a settings component, plus an OpenCode model-option catalog.

  • The Antigravity service is not initialized, so the new startup guard prevents main-window services from attaching.
  • The account feature also lacks renderer exposure, UI mounting, real authentication, and launch-time credential selection.
  • The settings type contains a duplicate declaration; account deletion and concurrent registration need correction.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Init[Account-service initialization] --> State[antigravityAccounts remains null]
  State --> Gate[Main-window service guard]
  Gate --> Throw[Throw before core handlers attach]
  Handlers[Antigravity IPC handlers] -. requires passing guard .-> Gate
  Handlers -. no preload bridge .-> Renderer[Settings renderer]
  Section[Antigravity section] -. not mounted .-> Renderer
  Select[Stored account selection] -. no credential consumer .-> Launch[Agent launch]
Loading

Reviews (1) · Last reviewed commit: "feat: add Antigravity multi-account supp..."

!museUsage ||
!codexAccounts ||
!claudeAccounts ||
!antigravityAccounts ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Main window cannot attach

antigravityAccounts starts as null, and account-service initialization never assigns it. On every main-window attachment, this new check throws before core IPC handlers and window services can attach.

Comment on lines +366 to +367
/** Why: closing a terminal with a running process is destructive, so confirm by default. */
skipCloseTerminalWithRunningProcessConfirm: boolean

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Duplicate settings member

This declaration repeats skipCloseTerminalWithRunningProcessConfirm two lines below in the same type. TypeScript reports a duplicate identifier, blocking typecheck and the desktop build.

Suggested change
/** Why: closing a terminal with a running process is destructive, so confirm by default. */
skipCloseTerminalWithRunningProcessConfirm: boolean

}) => Promise<ClaudeRateLimitAccountsState>
}

export type AntigravityAccountsApi = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Account API is not exposed

The new type has no matching field in PreloadApi or bridge in the exposed preload object. Even after main-process startup is fixed, renderer code cannot call the Antigravity list, add, remove, select, or reauthenticate handlers.

busy: boolean
}

export function AntigravityAccountsSection({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Account controls never appear

AntigravityAccountsSection is exported but never mounted by AccountsPane. Settings → Accounts therefore does not show its Add, Select, Re-auth, or Remove controls, even if the preload bridge is added.

Comment on lines +56 to +64
_location: AntigravityManagedAuthLocation
): Promise<{ credentialsJson: string; email: string | null }> {
// TODO: Implement actual antigravity CLI login flow
// For now, return a placeholder that can be replaced with real implementation
return {
credentialsJson: JSON.stringify({}),
email: null
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Empty credentials count as login

Add and re-authentication always return {} instead of performing a login. Registration writes that value to .credentials.json and records an API-key account with a fresh authentication timestamp, leaving users with an apparently authenticated account but no credentials.

Comment on lines +22 to +35
accountId: string,
_target?: AntigravityManagedAuthTarget
): Promise<AntigravityManagedAuthLocation> {
const managedAuthPath = join(this.getRoot(), accountId, 'auth')
mkdirSync(managedAuthPath, { recursive: true, mode: 0o700 })
writeFileSync(join(managedAuthPath, '.orca-managed-antigravity-auth'), `${accountId}\n`, {
encoding: 'utf-8',
mode: 0o600
})
return {
managedAuthPath: await this.assertOwned(managedAuthPath, accountId),
managedAuthRuntime: 'host',
wslDistro: null
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 WSL target is ignored

Calling addAccount({ runtime: 'wsl', wslDistro: 'Ubuntu' }) still creates host-side auth and records the account as host. Re-authentication uses that recorded runtime, so the requested account is never authenticated in its WSL distro.

Comment on lines +55 to +57
async remove(managedAuthPath: string): Promise<void> {
rmSync(managedAuthPath, { recursive: true, force: true })
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Removal trusts stored path

Removal passes managedAuthPath from settings straight to recursive rmSync, unlike auth writes, which validate ownership. If the stored path points outside managed account storage, removing that account deletes the outside directory instead of rejecting the entry.

Comment on lines +82 to +86
this.dependencies.store.updateSettings({
antigravityManagedAccounts: [
...previousSettings.antigravityManagedAccounts,
account
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Concurrent adds lose accounts

Two Add calls can snapshot the same account list while awaiting login. Each then replaces the stored list with its snapshot plus its own account, so whichever finishes last silently drops the other new account.

Comment on lines +28 to +30
await this.dependencies.storage.remove(location.managedAuthPath)
this.dependencies.store.updateSettings(previousSettings)
throw error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Failed add reverts other changes

If another setting or account changes while Add is awaiting login, a later failure restores the entire earlier settings snapshot. That overwrites the unrelated change along with the failed registration.

Comment on lines +67 to +73
const settings = this.store.getSettings()
const selection = normalizeAntigravityRuntimeSelection(settings)
const nextSelection = setSelectedAntigravityAccountIdForTarget(selection, accountId, target)
const nextActiveId = nextSelection.host
this.store.updateSettings({
activeAntigravityManagedAccountId: nextActiveId,
activeAntigravityManagedAccountIdsByRuntime: nextSelection

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Selection accepts invalid accounts

select stores the supplied ID and runtime without checking whether the account exists or belongs to that runtime. A stale ID or a host account selected for WSL can remain recorded as active without a matching account in that lane, making the saved selection unreliable.

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for the work on this, and for your patience. Orca now reads Antigravity quota from the agy CLI (#24073), has native Antigravity Accounts (#24691), and short pool labels in the status bar (#31007), which covers what this PR set out to do. Closing as superseded; your effort here helped shape the problem, so thank you.

@nwparker nwparker closed this Oct 24, 2026
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.

3 participants