Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds Grok managed-account support end to end. Main-process changes add managed-home creation and validation, Grok account state and IPC handlers, AI vault Grok session discovery, PTY and WSL 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/i18n/locales/en.json (1)
6838-6889: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTwo Grok search keywords are missing from the
accounts.searchlocale catalog.
accounts-search.tscallstranslateSearchKeyword('auto.components.settings.accounts.search.c61b14be7c', 'grok')andtranslateSearchKeyword('auto.components.settings.accounts.search.a51c85f205', 'GROK_HOME'), but neitherc61b14be7cnora51c85f205exists under thisaccounts.searchnamespace (the other 6 new Grok-related keywords — rate limit, status bar, quota, optional, reauthenticate, plus the title/description — are present).c61b14be7cdoes exist elsewhere in the file undersettings.general.search, but that's a different namespace.Functionally this degrades gracefully (i18next falls back to the English
defaultValue, and English locale skipstranslate()entirely), so there's no runtime break, but it leaves the non-English catalog incomplete for these two keywords. Based on learnings, new auto-keyed strings should be added toen.jsonbefore runningpnpm bootstrap:locale-catalogso they propagate to es/ja/ko/zh.🌐 Proposed fix
"d09fb5ca92": "Account Location", + "c61b14be7c": "grok", + "a51c85f205": "GROK_HOME", "733f9e2a93": "MiniMax Usage",Source: Learnings
🧹 Nitpick comments (8)
src/main/daemon/pty-subprocess.ts (2)
715-745: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftGrok WSL-home mapping duplicates the Codex block almost verbatim.
The Codex and Grok blocks (681-713 and 715-728) are structurally identical, and the post-chain scrub for Grok (741-745) is written as a separate top-level
ifinstead of folding into the existingif (wsl.exe) {...} else if (...) {...}chain the way Codex's scrub does (line 734-739). The same duplication is repeated inlocal-pty-provider.ts. Extracting a sharedapplyWslManagedHomeEnv(env, { key, wslInfo, launchWslDistro, ... })helper would remove this 4x copy-paste (2 accounts × 2 files) and make the launch-distro fix above land in one place instead of four.
677-728: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
isHostCodexHomeForWsl/isWslCodexHomeForHostare Codex-named but now shared with Grok.These predicates (from
src/main/pty/codex-home-wsl-env.ts) are generic Windows/WSL path detectors, reused here forGROK_HOME. The names still read as Codex-specific, which can mislead future readers into thinking they're Codex-only. Consider renaming to something account-agnostic (e.g.isHostStyleHomeForWsl) now that a second consumer exists.src/main/ipc/pty.ts (1)
3924-3930: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
registerHeadlessPtyRuntimeparam style diverges fromregisterPtyHandlers's options bag.
getSelectedGrokHomePathis added here as a new positional parameter alongsidestore, whereasregisterPtyHandlersgroups the equivalent Grok option inside itsoptionsobject (line 1266). Purely stylistic, but a future addition here will keep growing the positional parameter list.src/main/rate-limits/grok-fetcher.test.ts (1)
195-363: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider covering the "no cached_token auth method" branch.
grok-acp-auth.ts'sunavailable('Not signed in to Grok. Run \grok login`.', 'missing-credentials')path (wheninitializesucceeds butauthMethodslackscached_token) isn't exercised by this suite. The existingFakeGrokProcesscould easily be extended to return anauthMethods: []` initialize response for one test case.src/main/rate-limits/service.ts (1)
418-428: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff
refreshGrokForAccountChangeforces a fullfetchAllinstead of a Grok-only cycle.Unlike Codex/Claude account switches, which use dedicated
fetchCodexOnly/fetchClaudeOnlycycles, switching the Grok account re-fetches every provider (Claude, Codex, Gemini, OpenCode Go, Kimi, MiniMax) viafetchAll({ force: true }). This causes unnecessary re-fetches/CLI calls for unrelated providers and momentary "fetching" flicker in their status, purely to refresh Grok's usage.src/main/runtime/orca-runtime-grok-launch-env.test.ts (1)
9-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRegex-based source scan is a brittle proxy for real coverage.
This asserts textual presence of
settings/isRemote/launchPlatform/hostPlatformsubstrings in matched call text rather than verifying actual resolved values — it would pass even if the wrong variable (one that merely contains e.g. "isRemote" in its name) were substituted, and could break on harmless reformatting. Not blocking given today's 5 call sites are simple and non-nested.src/shared/tui-agent-launch-defaults.ts (1)
108-128: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueRemove the dead Grok branch
src/shared/tui-agent-launch-defaults.ts: both paths returnenv, and the newhostPlatform/launchPlatform/isHostLocalLaunchplumbing plusoptions.settingsare unused. Collapse this to a plainreturn envunless there’s a missing Grok-specific env change here.src/renderer/src/components/settings/GrokAccountsSection.tsx (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winWiden return type per static analysis: use
React.ReactNodeinstead ofJSX.Element.
JSX.Elementexcludesnull, strings, numbers, and fragments, which limits future refactors of this component's return value.♻️ Proposed fix
-import { useEffect, useState, type JSX } from 'react' +import { useEffect, useState, type ReactNode } from 'react'-export function GrokAccountsSection(): JSX.Element { +export function GrokAccountsSection(): ReactNode {Also applies to: 60-60
Source: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 80b20ed3-12d0-47ea-8e54-51fddb3e6494
📒 Files selected for processing (77)
src/main/ai-vault/session-scanner-grok-managed.test.tssrc/main/ai-vault/session-scanner-source-discovery.tssrc/main/ai-vault/session-scanner-types.tssrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/grok-accounts/grok-auth-file.tssrc/main/grok-accounts/managed-home.test.tssrc/main/grok-accounts/managed-home.tssrc/main/grok-accounts/service.test.tssrc/main/grok-accounts/service.tssrc/main/index.tssrc/main/ipc/ai-vault.test.tssrc/main/ipc/ai-vault.tssrc/main/ipc/grok-accounts.test.tssrc/main/ipc/grok-accounts.tssrc/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/rate-limits/grok-acp-auth.tssrc/main/rate-limits/grok-fetcher.test.tssrc/main/rate-limits/grok-fetcher.tssrc/main/rate-limits/service.test.tssrc/main/rate-limits/service.tssrc/main/runtime/orca-runtime-grok-launch-env.test.tssrc/main/runtime/orca-runtime.tssrc/main/startup/configure-process.test.tssrc/main/startup/configure-process.tssrc/main/window/attach-main-window-services.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsxsrc/renderer/src/components/settings/AccountsPane.tsxsrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/GrokAccountsSection.tsxsrc/renderer/src/components/settings/accounts-search.tssrc/renderer/src/components/settings/appearance-status-bar-search.tssrc/renderer/src/components/settings/appearance-status-bar-usage-toggle-entries.tssrc/renderer/src/components/status-bar/StatusBar.tsxsrc/renderer/src/components/status-bar/status-bar-agent-gating.test.tssrc/renderer/src/components/status-bar/status-bar-agent-gating.tssrc/renderer/src/components/status-bar/status-bar-provider-visibility.test.tssrc/renderer/src/components/status-bar/status-bar-provider-visibility.tssrc/renderer/src/components/status-bar/tooltip.tsxsrc/renderer/src/components/status-bar/usage-error-copy.test.tssrc/renderer/src/components/status-bar/usage-error-copy.tssrc/renderer/src/components/terminal-pane/pty-connection.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/hooks/useIpcEvents.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/github-work-item-background-request.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/lib/launch-agent-in-new-tab.tssrc/renderer/src/lib/launch-work-item-direct-agent.tssrc/renderer/src/lib/onboarding-folder-agent-startup.tssrc/renderer/src/lib/resume-sleeping-agent-session.tssrc/renderer/src/lib/worktree-activation.tssrc/renderer/src/store/slices/rate-limits.tssrc/renderer/src/store/slices/ui.test.tssrc/renderer/src/store/slices/ui.tssrc/renderer/src/web/web-preload-api.tssrc/shared/constants.tssrc/shared/rate-limit-types.test.tssrc/shared/rate-limit-types.tssrc/shared/status-bar-defaults.tssrc/shared/tui-agent-launch-defaults.test.tssrc/shared/tui-agent-launch-defaults.tssrc/shared/types.ts
- Guard auth.json read/parse so missing files return null - Thread AbortSignal through Grok rate-limit fetch and ACP auth - Pass isRemote:false for floating-terminal agent launch env
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 69cb7c12-43da-48a7-ae39-09cf764388e2
📒 Files selected for processing (6)
src/main/grok-accounts/grok-auth-file.tssrc/main/rate-limits/grok-acp-auth.tssrc/main/rate-limits/grok-fetcher.tssrc/main/rate-limits/service.test.tssrc/main/rate-limits/service.tssrc/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx
- src/main/grok-accounts/grok-auth-file.ts
- src/main/rate-limits/service.test.ts
- src/main/rate-limits/grok-fetcher.ts
- src/main/rate-limits/service.ts
|
thx for the PR! it's a large PR so will take some time to review |
|
Closed in favor of #7996 (combined Antigravity + Grok usage status). |
Grok usage landed on main via stablyai#7869 (superseding this PR's stablyai#7901 lineage), so this merge keeps main's Grok implementation everywhere the two stacks overlapped and drops the PR-side Grok stack (managed accounts/GROK_HOME, fetcher, launch/resume env, appearance catalog). The PR now carries only the Antigravity usage surfaces.
Summary
GROK_HOMEresolution.Screenshots
No screenshots attached. The change adds a Settings account section and status/account wiring, but no PR evidence images are committed.
Testing
pnpm lintpnpm typecheckpnpm test- 2466 test files passed / 25777 tests passed / 3 files skipped / 31 tests skippedpnpm build- not runAdditional targeted test run:
pnpm exec vitest run --config config/vitest.config.ts \ src/shared/tui-agent-launch-defaults.test.ts \ src/main/runtime/orca-runtime-grok-launch-env.test.ts \ src/main/grok-accounts/managed-home.test.ts \ src/main/grok-accounts/service.test.ts \ src/main/rate-limits/service.test.ts \ src/main/ai-vault/session-scanner.test.ts \ src/main/ai-vault/session-scanner-grok-managed.test.ts \ src/main/ipc/ai-vault.test.ts \ src/main/ipc/grok-accounts.test.ts \ src/main/ipc/register-core-handlers.test.ts \ src/main/ipc/pty.test.ts \ src/main/providers/local-pty-provider.test.ts \ src/main/daemon/pty-subprocess.test.tsResult: 13 test files / 449 tests passed.
AI Review Report
Reviewed in two passes with focus on cross-platform and account-isolation risks. Main findings addressed:
path.relative.GROK_HOMEand scrubs invalid renderer-provided values.GROK_HOME; daemon and local PTY paths have explicit regression coverage.pnpm testinitially exposed existing Codex PTY fallback tests touching real backend fetch under fake timers; this PR now stubs that fetch and restores globals/timers so the full suite is deterministic locally.Cross-platform review covered macOS, Linux, Windows, WSL path handling, PTY spawn env behavior, shell launch paths, IPC validation, and Electron main/preload boundaries touched by this PR.
Security Audit
Reviewed auth and filesystem boundaries for managed Grok accounts:
GROK_HOME; renderer-provided values are overridden or removed when an active managed account is invalid.windowsHide.No secrets are copied into settings; settings store account metadata and managed home paths, while credentials remain inside isolated Grok homes.
Notes
pnpm buildwas not run locally. Full unit test, typecheck, lint, and targeted regression suites passed on Node 24.18.0.