Skip to content

fix(setup): securely bound CLI installer retries - #1297

Merged
shanselman merged 14 commits into
mainfrom
fix/install-cli-wsl-dns-retry
Sep 8, 2026
Merged

shanselman merged 14 commits into
mainfrom
fix/install-cli-wsl-dns-retry

Conversation

@shanselman

@shanselman shanselman commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Download the CLI installer into a per-attempt random private directory before execution.
  • Bound official-installer transfers to a 15-second connect deadline and 60-second total transfer deadline.
  • Preserve the existing five-minute outer command budget for supported custom HTTPS installer sources.
  • Let SetupPipeline own the only retry loop, capped at two attempts, with no nested curl retries.
  • Preserve curl exit codes and stderr for DNS, timeout, and partial-transfer failures.
  • Reject empty downloads and prevent execution after failed or partial transfers.
  • Clean the exact private temp directory through a shell EXIT trap and an independent 15-second post-command cleanup, without relying on curl options unavailable in supported Ubuntu environments.
  • Preserve the authoritative installer failure or caller cancellation when cleanup itself times out, is cancelled, or throws an expected process/filesystem exception; cleanup diagnostics log exception type only.
  • Pin and verify Node 24.19.0, the current official installer default, because the official installer now rejects the previous 22.22.3 runtime.
  • Generate the Capabilities-page Show the exact commands & files preview from the production installer command builder, including the selected --version and official-only --node-version arguments.
  • Keep custom installers version-pinned without the official Node argument or shortened official-source curl deadlines.
  • Merge current main while retaining the proven installer behavior.

Fixes #1256 (Setup masks fresh-WSL DNS failures during CLI installation).
Supersedes #1258 because its fork branch was being force-updated during repair and could not be advanced without violating the no-force requirement.

Validation

Current head: d002ba79.

  • .\build.ps1: passed
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,943 passed, 32 skipped
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,861 passed
  • dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore: 1,096 passed
  • focused installer, preview, and policy tests: 53 passed
  • rubber-duck review and re-review: clean, no actionable findings
  • final portability autoreview: clean, no accepted/actionable findings, confidence 0.98
  • Node tuple review: code-clean; exact hosted compatibility proof completed below

Real behavior proof

Capabilities review UI

The isolated preview displayed the production-derived command with the selected Gateway and Node versions. Custom installer previews omit the official-source 15/60-second curl deadlines while retaining HTTPS restrictions, complete download, cleanup, and exact version pinning.

Fresh WSL installer behavior

The production command has exercised DNS failure, a successful second pipeline attempt, transfer timeout, partial transfer, empty response, private permissions, and exact-path cleanup. Current-head tests additionally prove cleanup IOException and unrelated cleanup cancellation cannot mask the original download failure or caller cancellation.

Slow custom HTTPS compatibility

Current-head production BuildInstallCommand was executed against a locally trusted HTTPS server in Ubuntu that intentionally delayed its response for 65 seconds:

exit=0 timedOut=False elapsed_seconds=65.5
cleanup_and_execution=CUSTOM_INSTALL_OK --version 2026.6.34

The command contained neither --connect-timeout nor --max-time, completed within the existing five-minute outer budget, executed the exact version argument, and removed its private /tmp/openclaw-installer-* directory.

Official installer portability and runtime tuple

Hosted E2E exposed two upstream compatibility changes that current head corrects:

  1. Ubuntu curl does not support --remove-on-error; current head relies on set -euo pipefail plus the exact private-directory EXIT trap instead.
  2. The official installer rejects Node 22.22.3 and requires Node 24.16.0+ or 26.1.0+; current head pins the installer's exact current default, Node 24.19.0, and verifies that exact runtime after installation.

Full current-head workflow dispatch: https://github.com/openclaw/openclaw-windows-node/actions/runs/34174326026 at d002ba79:

  • setup-connect E2E: passed
  • network-recovery E2E: passed
  • revocation-recovery E2E: passed
  • x64 release publish smoke: passed
  • ARM64 release publish: passed
  • UI, Tray/Setup, fast validation, proof-pool contracts, and release metadata: passed
  • Core lane: one unrelated PiperVoiceExtractionTests temporary-file lock flake; the same test passes locally and the failed lane was rerun

The setup/connect proof recorded Gateway 2026.6.34, protocol v4, operator and node credentials, gateway restart, and a successful real node.invoke call.

Required proof pools

  • windows-wsl-gateway-e2e: satisfied by current-head full workflow run 34174326026, including setup/connect, network recovery, and revocation recovery.
  • windows-winui-interactive: isolated Capabilities review UI proof passed and visibly includes the selected Gateway and Node versions; current-head preview is derived from the same production builder and has focused official/custom coverage.

Security impact

  • New permissions or capabilities: No
  • Secrets or token handling changed: No
  • Network handling: the official installer download is bounded and fail-closed; custom HTTPS sources retain their compatibility budget.
  • Command execution: the installer is downloaded completely and validated as non-empty before execution rather than piped directly into bash.
  • Diagnostic privacy: cleanup logs contain operation and exception type only, not command output or exception messages.

Compatibility and migration

No configuration migration is required. Custom HTTPS installer timing is preserved. The official runtime pin advances from unsupported Node 22.22.3 to exact Node 24.19.0, validated with Gateway 2026.6.34 by current-head hosted setup, pairing, restart, network recovery, revocation recovery, and node invocation proof.

joelagnel and others added 8 commits August 28, 2026 01:03
Download the installer to a temporary file with bounded curl retries before executing it. Pass the script through WSL stdin so Bash variables survive, and preserve curl failures for actionable setup errors.

Fixes #1256.
Download the installer to a temporary file with bounded curl retries before executing it. Pass the script through WSL stdin so Bash variables survive, and preserve curl failures for actionable setup errors.

Fixes #1256.
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 9:03 PM ET / September 8, 2026, 01:03 UTC.

ClawSweeper review

What this changes

Windows setup downloads installers privately before execution, bounds official-source transfers, preserves download errors and custom-source timing, updates the command preview, and pins Node 24.19.0.

Merge readiness

✅ Ready for maintainer review

Keep this PR as the active fix. Current main still masks download failures, the earlier code findings are resolved, and the updated runtime evidence addresses the previous compatibility concern. No blocking introduced defect was found.

Priority: P0
Reviewed head: d002ba790009d206a99824b433425f609dea1ef2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with useful regression coverage and relevant current-head runtime evidence; previous blockers are addressed.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The captured current-head evidence connects InstallCliStep to real Windows/WSL setup with Gateway 2026.6.34 and Node 24.19.0, followed by pairing, restart, recovery, and node invocation; the slow custom HTTPS transcript demonstrates preserved timing and cleanup. Linked raw logs could not be independently fetched from this reviewer environment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The captured current-head evidence connects InstallCliStep to real Windows/WSL setup with Gateway 2026.6.34 and Node 24.19.0, followed by pairing, restart, recovery, and node invocation; the slow custom HTTPS transcript demonstrates preserved timing and cleanup. Linked raw logs could not be independently fetched from this reviewer environment.
Evidence reviewed 9 items Current main still needs the fix: The fetched main implementation streams curl directly into bash, allowing the final shell process to mask a failed transfer. The latest supplied release also contains that implementation.
Release check: The supplied latest release, v2026.7.1-4, still uses the curl-to-bash pipeline at line 174; it does not contain this repair.
Failure handling and execution boundary: The introduced code uses stdin transport, a random private directory, complete-download and nonempty checks, an EXIT trap, and independent bounded cleanup. Official downloads receive 15/60-second limits; custom sources retain the existing outer five-minute budget. Cleanup exceptions preserve the original failure or cancellation.
Findings None None.
Security None None.

How this fits together

The setup engine installs the Gateway CLI inside a managed WSL distribution before configuring and pairing the Windows application. Installer failures feed the setup retry and rollback flow; successful installations undergo exact version checks.

flowchart TD
  A[Setup configuration] --> B[Installer command builder]
  B --> C[Private HTTPS download]
  C --> D{Complete nonempty download}
  D -->|Yes| E[Run installer and verify versions]
  D -->|No| F[Preserve download failure]
  E --> G[Cleanup and setup result]
  F --> G
  G --> H[Continue or bounded retry]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production +150/-13, tests +452/-4 Production growth implements private download, cleanup, and shared preview behavior, with substantially larger regression coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1256
Summary: This PR owns the proposed repair for masked installer download failures; the command-output drain work is separate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Setup should retain actionable download errors and bounded in-product retries, execute only complete installers, and preserve custom-source compatibility.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: on current main a failed curl transfer can be masked by successful bash termination, followed by misleading CLI-location probing; this review did not execute that failure.

Is this the best way to solve the issue?

Yes. The patch repairs the existing installer owner, reuses pipeline retries, and derives the preview from production code; supplied current-head setup and recovery evidence addresses the runtime-pin concern.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 88822d342567.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured current-head evidence connects InstallCliStep to real Windows/WSL setup with Gateway 2026.6.34 and Node 24.19.0, followed by pairing, restart, recovery, and node invocation; the slow custom HTTPS transcript demonstrates preserved timing and cleanup. Linked raw logs could not be independently fetched from this reviewer environment.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P0: The linked report describes fresh first-run setup failing and rolling back after WSL DNS errors, blocking onboarding.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The captured current-head evidence connects InstallCliStep to real Windows/WSL setup with Gateway 2026.6.34 and Node 24.19.0, followed by pairing, restart, recovery, and node invocation; the slow custom HTTPS transcript demonstrates preserved timing and cleanup. Linked raw logs could not be independently fetched from this reviewer environment.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured current-head evidence connects InstallCliStep to real Windows/WSL setup with Gateway 2026.6.34 and Node 24.19.0, followed by pairing, restart, recovery, and node invocation; the slow custom HTTPS transcript demonstrates preserved timing and cleanup. Linked raw logs could not be independently fetched from this reviewer environment.

Evidence

What I checked:

  • Current main still needs the fix: The fetched main implementation streams curl directly into bash, allowing the final shell process to mask a failed transfer. The latest supplied release also contains that implementation. (src/OpenClaw.SetupEngine/InstallCliStep.cs:174, 88822d342567)
  • Release check: The supplied latest release, v2026.7.1-4, still uses the curl-to-bash pipeline at line 174; it does not contain this repair. (src/OpenClaw.SetupEngine/InstallCliStep.cs:174, c7c6fb06be03)
  • Failure handling and execution boundary: The introduced code uses stdin transport, a random private directory, complete-download and nonempty checks, an EXIT trap, and independent bounded cleanup. Official downloads receive 15/60-second limits; custom sources retain the existing outer five-minute budget. Cleanup exceptions preserve the original failure or cancellation. (src/OpenClaw.SetupEngine/InstallCliStep.cs:88, d002ba790009)
  • Prior findings resolved: The full introduced diff confirms that the preview now uses the production builder and that custom installers omit official-source transfer deadlines. Added tests cover error propagation, second-attempt recovery, timeout, partial and empty transfers, cancellation, cleanup exceptions, and preview equivalence. (tests/OpenClaw.SetupEngine.Tests/SetupStepsTests.cs:1951, d002ba790009)
  • Runtime compatibility boundary: ADR 0001 makes the official installer runtime part of the validated Gateway tuple, establishing an affirmative dependency on the official installer and Gateway behavior. The changed Node pin is consumed by installation, post-install verification, and preview; this diff adds no migration of existing running gateways. (docs/adr/0001-gateway-release-policy.md:24, d002ba790009)
  • Updated production-path proof: The captured body, sourceRevision 366b7c706cf32b561d6b41743ac082f111fa5759df73a8253826125e154e8f0b, reports current-head Windows setup, pairing, restart, network and revocation recovery, and real node invocation for Gateway 2026.6.34 with Node 24.19.0. It links https://github.com/openclaw/openclaw-windows-node/actions/runs/34174326026 and includes a 65.5-second successful custom HTTPS installer transcript with cleanup. These observations address the preceding review's runtime concern. (d002ba790009)

Likely related people:

  • Barbara Kudiess: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-02T19:24:03.883Z sha 2ab6510 :: needs changes before merge. :: [P2] Make the installer review command actually exact
  • reviewed 2026-09-02T20:05:39.573Z sha bdcbeb0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T20:25:45.914Z sha bdcbeb0 :: found issues before merge. :: [P1] Preserve the custom-installer transfer contract
  • reviewed 2026-09-07T22:44:40.229Z sha bdcbeb0 :: blocked before merge. :: [P1] Preserve the custom-installer transfer contract
  • reviewed 2026-09-07T23:05:47.678Z sha 58b4d6c :: blocked before merge. :: [P1] Preserve the custom-installer transfer contract
  • reviewed 2026-09-07T23:25:06.285Z sha 8c3ae7a :: blocked before merge. :: none
  • reviewed 2026-09-08T00:10:59.206Z sha b07b37a :: needs maintainer review before merge. :: none
  • reviewed 2026-09-08T00:31:24.525Z sha d002ba7 :: blocked before merge. :: none

@shanselman shanselman added status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. and removed status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. labels Sep 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e6c2cca1-653c-4578-8e26-f2434d221143
@shanselman

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

P2 fixed at bdcbeb0a. The Capabilities-page pane no longer owns a hardcoded installer command. It is populated from SetupReviewSummaryBuilder, which now calls the production InstallCliStep.BuildInstallCommand shape and substitutes only the random temp-directory value. Official preview includes selected --version plus --node-version; custom preview includes selected --version without the official Node argument; invalid non-HTTPS preview stops before curl/bash. Final local build and required suites pass, current-head isolated UI proof is in the PR body, and rubber-duck plus structured Codex autoreview are clean.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. proof: sufficient Contributor real behavior proof is sufficient. P1 Urgent regression or broken agent/channel workflow affecting real users now. labels Sep 8, 2026
@shanselman

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 8, 2026
@shanselman
shanselman merged commit 6d10562 into main Sep 8, 2026
57 of 59 checks passed
@shanselman
shanselman deleted the fix/install-cli-wsl-dns-retry branch September 8, 2026 01:06
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup masks fresh-WSL DNS failures during CLI installation

2 participants