Skip to content

fix(wsl): fail a first deploy fast when the Node runtime download gets no answer - #35869

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-node-runtime-fail-fast
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-node-runtime-fail-fast

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82

ELI5

The first time Orca sets up its server inside a WSL distro, it downloads Node (about 30 MB). It tries from this computer first, then from inside the distro. On a network that silently drops traffic, that took about two minutes before giving up. Now it gives up in about 45 seconds, and the error still says exactly how to fix it.

What Changed

  • Desktop download (runtime-archive-download.ts, pinned-runtime-materializer.ts): new optional connectTimeoutMs.
    • If no response arrives within it, the attempt fails with "Node download got no response within N s".
    • That error is not retried: a dropped connection would only repeat the wait. Other transient errors still retry as before.
    • The abort normalization now keeps the actual reason (stalled or unanswered), not always "stalled".
  • Host fallback (remote-node-runtime-host-download.ts): the per-source connect timeout for curl --connect-timeout and wget -T is now a parameter. It defaults to the existing 20 s.
  • Plumbing:
    • deployOrcad takes an optional nodeRuntimeDownload budget, applied through a new small orcad-node-runtime-install-options.ts.
    • The budget flows through installOrcadBundle and ensureRemoteOrcadNodeRuntime to the host fallback.
    • Only the WSL deploy (wsl-orcad-deploy.ts) passes it: WSL_NODE_RUNTIME_DOWNLOAD_BUDGET = 15 s desktop, 15 s per host source.
  • Host fallback kept on a proxy refusal, deliberately. On win-lowspec the desktop's proxy refused the download and the distro's own route is what made the deploy succeed.
  • Error unchanged: the final message already names the mirror setting (Settings > Advanced > Network > Node.js download mirror, or NODEJS_ORG_MIRROR) and the offline archive path. The existing host-fallback test keeps covering that.

Why

The win-lowspec QA run (signed 1.4.244, with the test instance's desktop traffic refused by a proxy) found the pinned Node runtime is not bundled for WSL targets. The template ships only the runtime marker, so a first deploy fetches it.

Worst case on a firewall that drops packets:

Before After
Desktop 4 attempts × about 21 s (the Windows connect timeout) + 1/3/9 s gaps ≈ 1.5–2 min one 15 s attempt
Host fallback 20 s per source 15 s per source (official, plus mirror if set)
Total about 2–2.5 min, then fails ≤ 45 s, then the same actionable error

Alternatives considered:

  • Bundling the archive: fixes it fully, at a cost in installer size. That's the next PR.
  • Skipping the host fallback when the desktop's proxy refuses: rejected. It would have failed the win-lowspec run, which only passed because of the fallback.

Linked Issue

Follow-up to the win-lowspec WSL host proxy QA (flag-on checklist).

Visual Proof

N/A: no UI change. It changes download timing and failure speed only.

Testing

  • runtime-archive-download.test.ts:

    • a request that never answers fails with the "no response within" error after one attempt (no retry);
    • a response that arrives within the budget downloads in full.
  • remote-node-runtime-host-download.test.ts: a real sh run of the generated command with fake curl and wget records --connect-timeout / -T. It shows 20 by default (SSH) and 15 when a WSL budget is passed.

  • orcad-node-runtime-install-options.test.ts:

    • SSH gets no budget;
    • WSL threads 15 000 ms to the desktop materializer and 15 s to the host;
    • the worst case stays ≤ 45 s.
  • wsl-orcad-deploy.test.ts: the WSL deploy passes the budget to deployOrcad.

  • Suites: node-runtime, managed-server/install, the byte budget, orcad-remote-deploy, the SSH on-connect node download, wsl-orcad-deploy and orcad-runtime-deployment all pass (806).

  • Checks: pnpm tc, pnpm run typecheck:ci, pnpm run check:code-quality:changed, oxlint, the anti-slop oxlint (plugin synced) and both ast-grep steps pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Two reviewers requested: e9-reviewer and fix-reviewer-2.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

User-risk:

  • Slow servers: a WSL first deploy whose desktop download gets no response in 15 s now goes straight to the distro's own download instead of retrying from this computer. A very slow but working proxy that takes over 15 s to start responding would use the distro route.
  • Unchanged: once a response starts, the existing 120 s stall guard and full-size download apply.

Flag-off: only the WSL deploy passes the budget. SSH and every other caller keep today's timing (the defaults are unchanged and test-covered).

SSH: unaffected. This touches shared install code, but only through a new optional parameter that SSH doesn't pass.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…s no answer

A first WSL deploy fetches the pinned Node archive, from this computer
and then from inside the distro. Behind a firewall that drops packets it
retried four times and then waited 20 s per host source, about two
minutes before failing. WSL deploys now give the desktop one 15 s attempt
with no retry on a missing response, and the host 15 s per source, so a
dead network fails in about 45 s. The host fallback stays, since the
distro's own route often succeeds when this computer's proxy refuses.
SSH keeps its timing.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The timing change is limited to WSL first-deploy runtime downloads.

The PR appears safe to merge, with a non-blocking correction needed to the worst-case test and its stated wait.

Findings

  1. P2 Worst-case test misses a download ▶

Summary

Adds WSL-only timeouts for acquiring the pinned Node runtime.

  • WSL deploys give unanswered Node downloads 15 seconds before fallback.

Reviews (1) · Last reviewed commit: "fix(wsl): fail a first deploy fast when ..." · Reviewed by Greptile

Comment on lines +34 to +38
it('fails a dead network within about 45 s: one desktop attempt, then official and mirror on the host', () => {
const worstCaseMs =
WSL_NODE_RUNTIME_DOWNLOAD_BUDGET.desktopConnectTimeoutMs +
2 * WSL_NODE_RUNTIME_DOWNLOAD_BUDGET.hostConnectTimeoutSeconds * 1000
expect(worstCaseMs).toBeLessThanOrEqual(45_000)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Worst-case test misses a download

With a mirror configured, withNodeDistMirror waits up to 15 seconds for the mirror, then another 15 seconds for the official URL. The host then tries both sources, adding up to 30 seconds. A dropped network can therefore take about 60 seconds, while this test passes by counting only one desktop source.

Exercise the mirror fallback path and either share the desktop deadline across sources or correct the claimed bound.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change adds configurable connection timeouts for desktop Node runtime archive downloads and host download fallbacks. Desktop requests that exceed the configured timeout abort without retrying. Host curl and wget commands use a configurable timeout, with a 20-second default. Deployment options pass timeout budgets through to the download paths. WSL deployments set both connection timeouts to 15 seconds.

Priority: Normal

Merge Risk: Moderate · up to 6fab8

First-time WSL deployment can still wait far longer than intended on a silent download source. Fix the curl idle limit and shared desktop budget before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: making the first WSL deploy fail faster when the Node runtime download receives no response.
Description check Passed The description is mostly complete. It explains the user impact, implementation, rationale, alternatives, testing, scope, compatibility considerations, and the lack of UI changes. The linked issue is …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is mostly complete. It explains the user impact, implementation, rationale, alternatives, testing, scope, compatibility considerations, and the lack of UI changes. The linked issue is not provided as an actual issue reference, and the general validation checklist remains partially unchecked, but these omissions do not make the description incomplete overall.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 13 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b097daf-68d5-4d31-90f9-4e620e0eb5d7
Commits

Reviewing files that changed from the base of the PR and between cfdd7d6 and 6fab85b.

Files selected for processing: 13
  • src/main/managed-server/install/orcad-remote-install.ts
  • src/main/managed-server/install/orcad-remote-node-runtime.ts
  • src/main/managed-server/install/remote-node-runtime-host-download.test.ts
  • src/main/managed-server/install/remote-node-runtime-host-download.ts
  • src/main/node-runtime/pinned-runtime-materializer.ts
  • src/main/node-runtime/runtime-archive-download.test.ts
  • src/main/node-runtime/runtime-archive-download.ts
  • src/main/ssh/orcad-node-runtime-install-options.test.ts
  • src/main/ssh/orcad-node-runtime-install-options.ts
  • src/main/ssh/orcad-remote-deploy.ts
  • src/main/wsl/wsl-node-runtime-download-budget.ts
  • src/main/wsl/wsl-orcad-deploy.test.ts
  • src/main/wsl/wsl-orcad-deploy.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

'wait "$orca_dl_z" && kill "$orca_dl_pid") </dev/null >/dev/null 2>&1 & orca_dl_dog=$!; ' +
'wait "$orca_dl_pid"; orca_dl_s=$?; kill "$orca_dl_dog" 2>/dev/null; exit "$orca_dl_s"'
const curl = `curl -fsSLg --connect-timeout 20 --max-time "$orca_dl_t" -o ${file} "$2"`
const curl = `curl -fsSLg --connect-timeout ${connectTimeout} --max-time "$orca_dl_t" -o ${file} "$2"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Stability & Availability · Quick win

Bound curl when a connected source sends no response.

If a host proxy completes the connection and then sends no response, --connect-timeout 15 no longer applies. Curl instead waits for --max-time "$orca_dl_t", which can be 840 seconds with one source. This breaks the stated WSL failure-time budget. Add an idle-response limit, such as a curl low-speed timeout, while retaining the longer limit for downloads that make progress. (curl.se)

nodeRuntimeArchive: () =>
materializeNodeRuntimeArchive(target, runtimeCacheRoot, {
signal: input.signal,
connectTimeoutMs: input.nodeRuntimeDownload?.desktopConnectTimeoutMs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Stability & Availability · Quick win

Supported by static analysis

Script executed:

sed -n '1,180p' src/main/node-runtime/pinned-runtime-materializer.ts
sed -n '1,230p' src/main/node-runtime/runtime-archive-download.ts
sed -n '1,110p' src/main/ssh/orcad-node-runtime-install-options.ts

Repository: stablyai/orca

Length of output: 15333


Script executed:

set -u
printf '%s\n' '--- materializer symbols and callers ---'
rg -n -F --glob '*.ts' -e 'materializeNodeRuntimeArchive' -e 'nodeRuntimeHostConnectTimeoutSeconds' -e 'nodeRuntimeArchive' -e 'configuredNodeDistMirror' src tests || test "$?" -eq 1
printf '%s\n' '--- complete materializer region ---'
rg -n -F -- 'export async function materializeNodeRuntimeArchive' src/main/node-runtime/pinned-runtime-materializer.ts
sed -n '150,330p' src/main/node-runtime/pinned-runtime-materializer.ts
printf '%s\n' '--- host download implementation and relevant options ---'
rg -n -F --glob '*.ts' -e 'hostConnectTimeout' -e 'downloadVerifiedArchive' -e 'nodeRuntimeHost' src tests || test "$?" -eq 1
printf '%s\n' '--- focused tests ---'
rg -n -F --glob '*.{test,spec}.ts' -e '45_000' -e '45 seconds' -e 'desktopConnectTimeoutMs' -e 'nodeRuntimeHostConnectTimeoutSeconds' -e 'mirror' -e 'unanswered' src tests || test "$?" -eq 1
printf '%s\n' '--- relevant diff from merge base ---'
git diff --unified=25 32e804dd6f9fb4824449a840180bda349b62b037 6fab85b91ab76ee7982d412c727baf0c1b9c7e67 -- src/main/node-runtime/pinned-runtime-materializer.ts src/main/node-runtime/runtime-archive-download.ts src/main/ssh/orcad-node-runtime-install-options.ts

Repository: stablyai/orca

Length of output: 45661


Script executed:

set -u
printf '%s\n' '--- symbols and callers ---'
rg -n -F --glob '*.ts' -e 'materializeNodeRuntimeArchive' -e 'nodeRuntimeHostConnectTimeoutSeconds' -e 'configuredNodeDistMirror' -e 'nodeRuntimeArchive' src tests || test "$?" -eq 1
printf '%s\n' '--- materializer ---'
rg -n -F -- 'export async function materializeNodeRuntimeArchive' src/main/node-runtime/pinned-runtime-materializer.ts
sed -n '150,360p' src/main/node-runtime/pinned-runtime-materializer.ts
printf '%s\n' '--- host download path ---'
rg -n -F --glob '*.ts' -e 'hostConnectTimeout' -e 'downloadVerifiedArchive' -e 'nodeRuntimeHost' src tests || test "$?" -eq 1
printf '%s\n' '--- focused assertions ---'
rg -n -F --glob '*.{test,spec}.ts' -e '45_000' -e 'desktopConnectTimeoutMs' -e 'nodeRuntimeHostConnectTimeoutSeconds' -e 'unanswered' -e 'mirror' src tests || test "$?" -eq 1
printf '%s\n' '--- changed diff ---'
git diff --unified=25 32e804dd6f9fb4824449a840180bda349b62b037 6fab85b91ab76ee7982d412c727baf0c1b9c7e67 -- src/main/node-runtime/pinned-runtime-materializer.ts src/main/node-runtime/runtime-archive-download.ts src/main/ssh/orcad-node-runtime-install-options.ts

Repository: stablyai/orca

Length of output: 45659


Script executed:

set -u
printf '%s\n' '--- host downloader ---'
nl -ba src/main/managed-server/install/remote-node-runtime-host-download.ts | sed -n '145,225p'
printf '%s\n' '--- install options tests ---'
nl -ba src/main/ssh/orcad-node-runtime-install-options.test.ts | sed -n '1,75p'
printf '%s\n' '--- WSL budget and deploy wiring ---'
nl -ba src/main/wsl/wsl-node-runtime-download-budget.ts
nl -ba src/main/wsl/wsl-orcad-deploy.test.ts | sed -n '210,250p'
rg -n -F --glob '*.ts' -e 'WSL_NODE_RUNTIME_DOWNLOAD_BUDGET' -e 'nodeRuntimeDownload:' src/main/wsl src/main/ssh src/main/managed-server

Repository: stablyai/orca

Length of output: 9878


Script executed:

set -u
rg -n -F --glob '*.ts' -e 'function hostDownloadNodeRuntimeCommand' -e 'hostDownloadNodeRuntimeCommand' -e 'connectTimeoutSeconds' src/main/managed-server src/main/node-runtime
printf '%s\n' '--- command implementation ---'
file=$(rg -l -F --glob '*.ts' 'function hostDownloadNodeRuntimeCommand' src/main)
if [ -n "$file" ]; then
  line=$(rg -n -F -- 'function hostDownloadNodeRuntimeCommand' "$file" | cut -d: -f1 | head -1)
  start=$((line-15)); [ "$start" -lt 1 ] && start=1
  end=$((line+100))
  nl -ba "$file" | sed -n "${start},${end}p"
fi

Repository: stablyai/orca

Length of output: 9262


Share the desktop timeout across mirror and official requests.

withNodeDistMirror tries the official URL after a mirror timeout. Each request receives a fresh 15-second timeout, so desktop source iteration can consume 30 seconds. The host then has two 15-second source attempts, producing a 60-second path instead of the stated 45-second budget.

The budget test passes because it assumes one desktop attempt. Use one shared desktop deadline across both desktop sources, while preserving the host fallback after that deadline expires.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant