fix(onboard): widen inference verification timeouts on WSL2 (Fixes #987)#1998
Conversation
WSL2's virtualized network stack can cause DNS resolution and TCP connections to take significantly longer, making the 10s connect timeout expire before TLS completes. This widens probe timeouts to 20s/30s on WSL2, adds a single retry with doubled timeouts on curl exit codes 28 (timeout), 6, and 7 (connection failure), and surfaces an actionable hint suggesting --skip-verify when the retry also fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR addresses a WSL2 endpoint verification regression by introducing configurable curl timeouts and automatic retry logic. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/wsl2-probe-timeout.test.ts (1)
65-68: Source-scanning regex is fragile.This regex requires exact formatting of the guard function. Minification, code formatting changes, or even variable renaming would break this test without any actual behavioral change.
Consider adding a comment acknowledging this fragility, or extract the guard logic into a separate, exported helper that can be tested directly (similar to how
getValidationProbeCurlArgswas exported).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/wsl2-probe-timeout.test.ts` around lines 65 - 68, The test is brittle because it checks the exact source formatting of the guard using a fragile regex; update the code by extracting the guard logic into a named, exported helper (e.g., export a function isTimeoutOrConnFailure) and update the test to import and assert that helper directly (similar to getValidationProbeCurlArgs), or at minimum add an inline comment in test/wsl2-probe-timeout.test.ts explaining the regex fragility and why it’s used; locate references to isTimeoutOrConnFailure and onboardSrc to implement the extraction and update the test to call the exported helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/wsl2-probe-timeout.test.ts`:
- Around line 65-68: The test is brittle because it checks the exact source
formatting of the guard using a fragile regex; update the code by extracting the
guard logic into a named, exported helper (e.g., export a function
isTimeoutOrConnFailure) and update the test to import and assert that helper
directly (similar to getValidationProbeCurlArgs), or at minimum add an inline
comment in test/wsl2-probe-timeout.test.ts explaining the regex fragility and
why it’s used; locate references to isTimeoutOrConnFailure and onboardSrc to
implement the extraction and update the test to call the exported helper.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 17a5e2c7-ff4d-44a0-a8ea-8751150c563c
📒 Files selected for processing (2)
src/lib/onboard.tstest/wsl2-probe-timeout.test.ts
Summary
getValidationProbeCurlArgs()from 10s/15s to 20s/30s whenisWsl()detects WSL2, preventing false "failed to connect" errors caused by slower DNS resolution and TLS handshakes through the virtualized network stack./chat/completionsbefore reporting failure.--skip-verifyso users aren't stuck on a false negative.Closes #987
Test plan
getValidationProbeCurlArgs({ isWsl: true })returns["--connect-timeout", "20", "--max-time", "30"]getValidationProbeCurlArgs({ isWsl: false })returns["--connect-timeout", "10", "--max-time", "15"]--skip-verifypresent in failure path🤖 Generated with Claude Code
Summary by CodeRabbit
Improvements
Tests