Repository navigation
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe 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 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 ReviewSecurity architecture risk: 🟡 Moderate · up to 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
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation 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.
Warning 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7530b2cf-7f03-4a1e-bee0-c7bfe685f7ac
📒 Files selected for processing (19)
src/main/antigravity-accounts/antigravity-account-registration.tssrc/main/antigravity-accounts/antigravity-account-selection.tssrc/main/antigravity-accounts/antigravity-managed-auth-storage.tssrc/main/antigravity-accounts/managed-auth-path.tssrc/main/antigravity-accounts/runtime-selection.tssrc/main/antigravity-accounts/service.tssrc/main/ipc/antigravity-accounts.tssrc/main/ipc/register-core-handlers/register-core-handlers.test.tssrc/main/ipc/register-core-handlers/register-core-handlers.tssrc/main/startup/main-process-state.tssrc/main/startup/main-window-core-services.tssrc/preload/api/agent-account-api.tssrc/renderer/src/components/settings/accounts-pane-antigravity-section.tsxsrc/shared/agent-session-option-catalog-opencode.test.tssrc/shared/agent-session-option-catalog-opencode.tssrc/shared/agent-session-option-catalog.tssrc/shared/antigravity-managed-account-types.tssrc/shared/default-global-settings.tssrc/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.
| } catch (error) { | ||
| await this.dependencies.storage.remove(location.managedAuthPath) | ||
| this.dependencies.store.updateSettings(previousSettings) | ||
| throw error |
There was a problem hiding this comment.
🗄️ 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.
| } 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 |
| async remove(managedAuthPath: string): Promise<void> { | ||
| rmSync(managedAuthPath, { recursive: true, force: true }) | ||
| } |
There was a problem hiding this comment.
🔒 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-accountsRepository: 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)
)| 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 | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 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?
| 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) | ||
| ) |
There was a problem hiding this comment.
🩺 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
| !museUsage || | ||
| !codexAccounts || | ||
| !claudeAccounts || | ||
| !antigravityAccounts || | ||
| !rateLimits || | ||
| !automations || | ||
| !keybindings || |
There was a problem hiding this comment.
🩺 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/mainRepository: 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.tsRepository: 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)| /** Why: closing a terminal with a running process is destructive, so confirm by default. */ | ||
| skipCloseTerminalWithRunningProcessConfirm: boolean |
There was a problem hiding this comment.
🎯 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.
| /** Why: closing a terminal with a running process is destructive, so confirm by default. */ | |
| skipCloseTerminalWithRunningProcessConfirm: boolean |
There was a problem hiding this comment.
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, plussrc/main/ipc/antigravity-accounts.tshandlers. - Startup/IPC wiring —
AntigravityAccountServicethreaded throughregisterCoreHandlersandattachMainWindowCoreServices, with a typedmainProcessStateslot. - Settings schema —
antigravityManagedAccounts,activeAntigravityManagedAccountId, and runtime selection, plus defaults. - Preload/renderer surface —
AntigravityAccountsApitype and anAntigravityAccountsSectioncomponent. - Unrelated OpenCode catalog —
OPENCODE_SESSION_OPTION_CATALOG(8 seededkr/*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.
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 |
There was a problem hiding this comment.
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 || |
There was a problem hiding this comment.
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 }) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
|
| !museUsage || | ||
| !codexAccounts || | ||
| !claudeAccounts || | ||
| !antigravityAccounts || |
| /** Why: closing a terminal with a running process is destructive, so confirm by default. */ | ||
| skipCloseTerminalWithRunningProcessConfirm: boolean |
There was a problem hiding this comment.
This declaration repeats skipCloseTerminalWithRunningProcessConfirm two lines below in the same type. TypeScript reports a duplicate identifier, blocking typecheck and the desktop build.
| /** Why: closing a terminal with a running process is destructive, so confirm by default. */ | |
| skipCloseTerminalWithRunningProcessConfirm: boolean |
| }) => Promise<ClaudeRateLimitAccountsState> | ||
| } | ||
|
|
||
| export type AntigravityAccountsApi = { |
| busy: boolean | ||
| } | ||
|
|
||
| export function AntigravityAccountsSection({ |
| _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 | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
| 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 | ||
| } |
| async remove(managedAuthPath: string): Promise<void> { | ||
| rmSync(managedAuthPath, { recursive: true, force: true }) | ||
| } |
There was a problem hiding this comment.
| this.dependencies.store.updateSettings({ | ||
| antigravityManagedAccounts: [ | ||
| ...previousSettings.antigravityManagedAccounts, | ||
| account | ||
| ] |
| await this.dependencies.storage.remove(location.managedAuthPath) | ||
| this.dependencies.store.updateSettings(previousSettings) | ||
| throw error |
| 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 |
There was a problem hiding this comment.
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.
|
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. |

Summary
Test plan