fix(preflight): do not pin empty WSL/local agent detection (#8366)#8391
fix(preflight): do not pin empty WSL/local agent detection (#8366)#8391bbingz wants to merge 4 commits into
Conversation
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds one retry for WSL detection command failures caused by timeouts or killed child processes, while leaving other failures non-retriable. Expands tests for retry counts and returned results. Updates detected-agent state handling so empty detection or refresh results do not remain cached, allowing subsequent detection calls to run again. Adds local hook retry behavior and coverage for empty results, remounts, and later detected agents. 🚥 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.
🧹 Nitpick comments (1)
src/main/ipc/preflight-wsl-agent-detection.test.ts (1)
99-135: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a retry exhaustion test.
The three new tests cover single-retry success and non-retriable failure, but don't verify behavior when both attempts timeout (retry exhaustion). A test confirming
detectWslCommandsOnPathreturns an emptySetandexecFileAsyncMockis called exactly twice after two consecutiveETIMEDOUTrejections would close the gap.🧪 Suggested test for retry exhaustion
it('returns an empty set when both attempts timeout', async () => { const timeoutError = Object.assign(new Error('Timed out running wsl.exe'), { code: 'ETIMEDOUT' }) execFileAsyncMock.mockRejectedValue(timeoutError) const found = await detectWslCommandsOnPath({ distro: 'Ubuntu' }, ['grok']) expect(found).toEqual(new Set()) expect(execFileAsyncMock).toHaveBeenCalledTimes(2) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d1b358ea-54b0-4880-a68a-aef5c16402c7
📒 Files selected for processing (4)
src/main/ipc/preflight-wsl-agent-detection.test.tssrc/main/ipc/preflight-wsl-agent-detection.tssrc/renderer/src/store/slices/detected-agents.test.tssrc/renderer/src/store/slices/detected-agents.ts
Store non-sticky empty was not enough: useDetectedAgents only called ensureLocal when detectedIds was null, so TabBar/QuickLaunch never re-probed after a WSL cold-start []. Mirror SSH/runtime one-shot empty remount retry for local surfaces (stablyai#8366 / stablyai#8391).
|
@coderabbitai review |
✅ Action performedReview finished.
|
Store non-sticky empty was not enough: useDetectedAgents only called ensureLocal when detectedIds was null, so TabBar/QuickLaunch never re-probed after a WSL cold-start []. Mirror SSH/runtime one-shot empty remount retry for local surfaces (stablyai#8366 / stablyai#8391).
b01b463 to
3557906
Compare
Store non-sticky empty was not enough: useDetectedAgents only called ensureLocal when detectedIds was null, so TabBar/QuickLaunch never re-probed after a WSL cold-start []. Mirror SSH/runtime one-shot empty remount retry for local surfaces (stablyai#8366 / stablyai#8391).
d869edb to
a499c6b
Compare
|
Rebased onto current
Ready for re-review / CI. |
|
Taking a look! |
|
Did a deep review of this cold-start empty-agent-list fix (#8366) — correctness, cross-platform, SSH/runtime, and perf/regression angles — plus ran the full test suite for the touched files. Verdict: solid. The three-part approach is correct and minimal, and it reuses the already-shipped non-sticky-empty pattern (
Things I specifically checked and confirmed are not problems: no re-probe/render loop (per-mount ref guard + module-scoped One change I pushed (commit Validation: 30/30 tests pass across the three touched test files, |
…8366) Empty [] is truthy, so a cold-start soft-fail permanently hid agents from the launcher until a context switch. Match remote/runtime non-sticky empty caching, clear empty detectPromise snapshots, and retry one WSL ETIMEDOUT.
Store non-sticky empty was not enough: useDetectedAgents only called ensureLocal when detectedIds was null, so TabBar/QuickLaunch never re-probed after a WSL cold-start []. Mirror SSH/runtime one-shot empty remount retry for local surfaces (stablyai#8366 / stablyai#8391).
…t is killed=true, not ETIMEDOUT)
35fe8b0 to
8910a7f
Compare
Restack noteRebased onto latest
Ready for upstream review; community author cannot merge. |
Use a per-mount retry key so the first empty result does not double-fire ensureDetectedAgents, while a remounted launch surface still re-probes.
Summary
WSL cold-start / probe failures return an empty agent list, and the renderer treated that empty
[]as a successful cache hit (if (existing)is true for arrays). The launcher then permanently hid installed agents (including Grok) until a context switch. This also adds one cold-start retry for WSLETIMEDOUT/ killed probes, and wires the local launch surfaces to re-probe once on remount after an empty result (same contract as SSH/runtime).Closes #8366
Root cause
ensureDetectedAgentsshort-circuited on any non-nulldetectedAgentIds, including[]. Remote/runtime already usedexisting?.length(Detect agents in the serve user's package-manager bins; don't pin empty remote-detect results #6029); local did not.detectPromisefor the same context key could still short-circuit.detectWslCommandsOnPathswallowed timeouts intonew Set()with no retry, feeding the sticky empty cache.useDetectedAgentsonly calledensureLocalwhendetectedIds === null, so TabBar/QuickLaunch never re-entered after[]. SSH/runtime already had one empty remount retry; local did not.Fix
existing?.length && detectedContextKey === contextKey(mirror remote/runtime).detectPromisewhen the detection/refresh result is empty so the next ensure re-probes.ETIMEDOUT/killedonly; hard shell failures still fail immediately to empty.useDetectedAgentslocal path: one empty remount retry per mounted surface (emptyRetryKey = 'local'), same shape as SSH/runtime.Related PRs
Test plan
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/store/slices/detected-agents.test.ts src/main/ipc/preflight-wsl-agent-detection.test.ts src/renderer/src/hooks/useDetectedAgents.test.tsx