Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between cb42b60 and ad40489369cc67a988c8b98e4d959698c9e8492f. 📒 Files selected for processing (16)
🚧 Files skipped from review as they are similar to previous changes (15)
📝 WalkthroughWalkthroughGrok now selects a host or Windows WSL runtime and resolves its home directory. Authentication reads use asynchronous filesystem operations with caching, timeouts, abort signals, and explicit error states. Rate-limit service flows use resolved runtime homes and discard stale target results. Settings synchronization refreshes Grok when its runtime target changes. IPC account-status handlers use the shared rate-limit service. Tests cover runtime selection, authentication parsing, concurrency, retargeting, and status mapping. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 1
🧹 Nitpick comments (2)
src/main/rate-limits/service.test.ts (1)
344-386: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider covering the retry-exhaustion branch.
This test covers one retarget during resolution, so the second attempt succeeds. The
getGrokAccountStatusloop also has an exhaustion branch that returnserror: 'Grok runtime changed while reading account status'. That branch is user-visible and currently untested. Add a case where the target changes during both attempts.src/main/rate-limits/account-runtime-target-sync.ts (1)
41-49: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueNote the guard asymmetry for Grok.
Claude and Codex refresh only when the policy changed and the current service target differs. Grok refreshes on any policy change. The reason is that
RateLimitStateexposesclaudeTargetandcodexTargetbut nogrokTarget, so the second comparison is not available.The result is a redundant forced Grok fetch when the policy changes but the effective target is already applied.
setGrokFetchTargetreturns early in that case, so no generation bump occurs and correctness is preserved.If you want the same gating as the other providers, expose the Grok target on
RateLimitState. Otherwise a one-line comment here would record why the guard differs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c405dad-40b0-407b-80e4-3260f5e76460
📥 Commits
Reviewing files that changed from the base of the PR and between a0a654c and fad600fc5499628de707f023e2c4b58b3706bc91.
📒 Files selected for processing (16)
src/main/grok-accounts/status.test.tssrc/main/grok-accounts/status.tssrc/main/grok/grok-runtime-home.test.tssrc/main/grok/grok-runtime-home.tssrc/main/index.tssrc/main/ipc/grok-accounts.tssrc/main/ipc/register-core-handlers.test.tssrc/main/ipc/register-core-handlers.tssrc/main/rate-limits/account-runtime-target-sync.test.tssrc/main/rate-limits/account-runtime-target-sync.tssrc/main/rate-limits/grok-auth.test.tssrc/main/rate-limits/grok-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.ts
8eb6fe2 to
0df7b53
Compare
0df7b53 to
8d3849a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Coordination note: #13276 adds managed Grok homes for new local host launches and touches some of the same account/IPC/service wiring. This PR remains narrower: it resolves the system-default Grok auth home from Orca's configured host/WSL runtime for Usage. It does not add managed-account billing attribution. The two changes should be compatible, but whichever lands second may need a small rebase around |
8d3849a to
ad40489
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
ad40489 to
f7ca6cd
Compare
f7ca6cd to
e45960f
Compare
Summary
GROK_HOME; on Windows with a WSL runtime, resolve the selected or default distro home and read.grok/auth.jsonthrough its UNC path.Fixes #13784
Screenshots
No visual change.
Testing
pnpm lint— not run project-wide; changed-code quality passed with 0 new native, type-aware, or React Doctor findings across 16 changed files.pnpm typecheck— the affected Node TypeScript target passed withpnpm typecheck:node.pnpm test— not run project-wide; 7 focused suites passed locally (123 tests). The resolver-failure follow-up additionally passed 3 affected suites (103 tests).pnpm build— not run; this is a main-process behavior change with no renderer or bundle changes.AI Review Report
The full runtime target → home resolution → auth read → account status/rate-limit refresh path was reviewed. The review checked selected/default WSL distro behavior, host fallback, stale-target races, account cross-attribution, resolver failures, abort/timeout handling, full versus Grok-only refreshes, and IPC status reuse. It found stale-target races and an uncontained WSL resolver rejection; both were fixed and covered by regression tests. The final independent code and security re-reviews found no remaining actionable blockers.
Cross-platform compatibility was checked explicitly: macOS and Linux remain on the host runtime and preserve
GROK_HOME/~/.grok; Windows host behavior is unchanged; Windows WSL uses a normalized\\wsl.localhost\<distro>\...\.grokpath. A real Windows Node +wsl.exesmoke against Ubuntu 24.04 resolved the WSL home and read a fresh auth session without printing token or account metadata.Security Audit
The security review checked credential path selection, token exposure, error sanitization, filesystem timeouts, abort handling, shared-read behavior, and runtime-switch races. Grok tokens remain in the Electron main process and are not added to renderer state or logs. Resolver failures become a sanitized auth error rather than an unhandled rejection. Generation/target checks run before the Grok network request and again before applying results, preventing an old runtime credential from being sent or attributed after a target switch.
Notes
{"runtime":"wsl","wslDistro":"Ubuntu-24.04","homeResolved":true,"authStatus":"ok","tokenFresh":true}.