Skip to content

fix(setup): retry CLI installer downloads - #1258

Closed
joelagnel wants to merge 1 commit into
openclaw:mainfrom
joelagnel:fix/install-cli-wsl-dns-retry
Closed

joelagnel wants to merge 1 commit into
openclaw:mainfrom
joelagnel:fix/install-cli-wsl-dns-retry

Conversation

@joelagnel

@joelagnel joelagnel commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Download the CLI installer completely to a temporary file before executing it.
  • Retry transient fresh-WSL DNS and connection failures with a bounded curl policy.
  • Send Bash through WSL stdin so shell variables survive wsl.exe argument translation.
  • Preserve curl exit codes and stderr instead of reporting a misleading CLI-location error.
  • Keep setup-review wording aligned with the actual flow.

Fixes #1256. Rebuilt as one topic commit on current main (16cb6897).

Required proof pools

  • windows-wsl-gateway-e2e: the product WSL installer transport and recovery path changed.
  • windows-winui-interactive: setup-review copy changed.

Validation

Current head: d9618fd7bcb29578992691042a7f73f13d9634af

  • .\build.ps1: passed on Windows 11 ARM64; all projects and documentation validation succeeded.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,873 passed, 32 environment-gated skips.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,824 passed after one unrelated chat-queue timing flake passed on full rerun.
  • git diff --check origin/main...HEAD: passed.

Rubber-duck review confirmed the current-main reconstruction preserves WSL-stdin transport, temporary-file execution, retry coverage, and error propagation. The maintainer review's transfer-deadline and retry-classification questions remain in the review thread for disposition.

Real behavior proof

The current-head regression tests verify generated script transport through WSL stdin, retry configuration, curl exit-code/stderr preservation, and review-summary copy.

Supporting integrated-stack proof completed the full Local AI setup and download path on an RTX Spark ARM64 host. It did not inject an actual DNS failure, so it does not replace retry-path proof.

Not verified / blocked: a live current-head managed-WSL DNS-failure and recovery run still requires windows-wsl-gateway-e2e.

Security and compatibility

  • Installer content is written to a temporary file before execution and removed by the shell cleanup trap.
  • HTTPS protocol/TLS restrictions remain in place.
  • No new permissions or credential handling are introduced.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 2:14 PM ET / 18:14 UTC.

ClawSweeper review

What this changes

The PR downloads the CLI installer to a temporary file with curl retries, sends the script to WSL through standard input, and updates setup-review copy and regression tests.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 5 items remain

Keep open. The branch directly addresses the linked fresh-WSL DNS failure, but its new all-error curl retry policy delays permanent installer failures and it still lacks current-head managed-WSL and WinUI proof.

Priority: P2
Reviewed head: d9618fd7bcb29578992691042a7f73f13d9634af

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The core transport repair is promising, but a bounded retry-policy defect and missing real behavior proof prevent merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: InstallCliStep now sends a generated script through the real WSL command-runner boundary, but the supplied regression test uses FakeCommandRunner and a canned curl result. The PR body claims an integrated Local AI run without an inspectable trace and explicitly marks managed-WSL DNS recovery as blocked; add redacted current-head WSL recovery or direct failure-propagation output plus current WinUI review-copy evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: InstallCliStep now sends a generated script through the real WSL command-runner boundary, but the supplied regression test uses FakeCommandRunner and a canned curl result. The PR body claims an integrated Local AI run without an inspectable trace and explicitly marks managed-WSL DNS recovery as blocked; add redacted current-head WSL recovery or direct failure-propagation output plus current WinUI review-copy evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items PR-introduced retry behavior: The introduced curl command uses --retry 5 --retry-all-errors; because the setup step itself has two attempts, permanent curl failures can be retried up to 12 transfers before setup reports them.
Current installer failure path: The production step returns the WSL command's exit code and stderr, while the generated script is correctly passed through stdin to preserve Bash variables.
Tests are isolated: The added download-failure test uses FakeCommandRunner and supplies a canned curl exit 6, so it verifies result propagation but not an actual WSL transfer or retry.
Findings 1 actionable finding [P2] Restrict retries to transient curl failures
Security None None.

How this fits together

The setup engine provisions an app-owned WSL gateway and installs the OpenClaw CLI before configuring and starting the gateway. The installer script passes through the WSL command runner, then its result determines whether setup proceeds or rolls back.

flowchart LR
  A[Setup configuration] --> B[Install CLI step]
  B --> C[Installer shell script]
  C --> D[WSL command runner]
  D --> E[curl download and retry]
  E --> F[Bash CLI installation]
  F --> G[CLI verification]
  G --> H[Gateway setup continues]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: InstallCliStep now sends a generated script through the real WSL command-runner boundary, but the supplied regression test uses FakeCommandRunner and a canned curl result. The PR body claims an integrated Local AI run without an inspectable trace and explicitly marks managed-WSL DNS recovery as blocked; add redacted current-head WSL recovery or direct failure-propagation output plus current WinUI review-copy evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Restrict retries to transient curl failures (P2) - --retry-all-errors makes curl -f repeat permanent certificate and HTTP failures up to five times per step attempt, and the existing outer two-attempt policy can make that 12 transfers before a terminal setup error. Retry named transient failures such as DNS exit 6 instead. This concern was visible on the prior review of this unchanged head and is raised late.
  • Resolve merge risk (P1) - --retry-all-errors retries permanent certificate and HTTP failures as well as transient DNS failures, delaying a definitive setup error through nested retry layers.
  • Resolve merge risk (P1) - The declared managed-WSL recovery and WinUI proof pools have no inspectable current-head evidence, so real retry recovery and visible review-copy behavior remain unverified.
  • Complete next step (P2) - Restrict retries to transient curl failures and post redacted current-head managed-WSL plus WinUI proof before merge.

Findings

  • [P2] Restrict retries to transient curl failures — src/OpenClaw.SetupEngine/InstallCliStep.cs:184-185
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +23 net, tests +30 net The focused five-file change adds more regression coverage than production code while altering the WSL installer transport.

Merge-risk options

Maintainer options:

  1. Narrow installer retry classification (recommended)
    Retry only named transient curl failures such as fresh-WSL DNS resolution, while returning permanent TLS and HTTP failures promptly.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Restrict installer retries to explicitly transient curl failures, retain DNS retry coverage, and add focused permanent-failure regression coverage.

Technical review

Best possible solution:

Keep the temporary-file and stdin transport, but retry only explicitly transient curl failures including DNS exit 6, then attach redacted current-head WSL recovery or failure-propagation evidence and current WinUI proof.

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

Yes, source-reproducible: current main pipes curl into Bash, while this branch's generated WSL script and fake-runner test show the intended DNS exit-code propagation path. A real current-head managed-WSL failure/recovery run has not been supplied.

Is this the best way to solve the issue?

No. Download-before-execute and stdin transport are appropriate, but --retry-all-errors is broader than the stated transient-DNS goal and should be narrowed before merge.

Full review comments:

  • [P2] Restrict retries to transient curl failures — src/OpenClaw.SetupEngine/InstallCliStep.cs:184-185
    --retry-all-errors makes curl -f repeat permanent certificate and HTTP failures up to five times per step attempt, and the existing outer two-attempt policy can make that 12 transfers before a terminal setup error. Retry named transient failures such as DNS exit 6 instead. This concern was visible on the prior review of this unchanged head and is raised late.
    Confidence: 0.94
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 16cb6897941f.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The introduced all-error retry policy can delay terminal installer failures through repeated WSL download attempts.
  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 availability.

Label justifications:

  • P2: This is a bounded setup reliability repair with a concrete failure-mode regression in its retry policy.
  • merge-risk: 🚨 availability: The introduced all-error retry policy can delay terminal installer failures through repeated WSL download attempts.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: InstallCliStep now sends a generated script through the real WSL command-runner boundary, but the supplied regression test uses FakeCommandRunner and a canned curl result. The PR body claims an integrated Local AI run without an inspectable trace and explicitly marks managed-WSL DNS recovery as blocked; add redacted current-head WSL recovery or direct failure-propagation output plus current WinUI review-copy evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] ./build.ps1.
  • [P1] dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore.
  • [P1] windows-wsl-gateway-e2e proof with redacted current-head transient-DNS recovery or direct error propagation.

What I checked:

  • PR-introduced retry behavior: The introduced curl command uses --retry 5 --retry-all-errors; because the setup step itself has two attempts, permanent curl failures can be retried up to 12 transfers before setup reports them. (src/OpenClaw.SetupEngine/InstallCliStep.cs:184, d9618fd7bcb2)
  • Current installer failure path: The production step returns the WSL command's exit code and stderr, while the generated script is correctly passed through stdin to preserve Bash variables. (src/OpenClaw.SetupEngine/InstallCliStep.cs:74, d9618fd7bcb2)
  • Tests are isolated: The added download-failure test uses FakeCommandRunner and supplies a canned curl exit 6, so it verifies result propagation but not an actual WSL transfer or retry. (tests/OpenClaw.SetupEngine.Tests/SetupStepsTests.cs:1817, d9618fd7bcb2)
  • Proof declaration and gap: The PR body correctly declares the WSL gateway and WinUI proof pools, but expressly leaves managed-WSL DNS-failure recovery unverified and supplies no inspectable current-head runtime artifact. (d9618fd7bcb2)
  • Feature history: The original InstallCliStep, including its two-attempt retry policy, was introduced by the setup-step split commit; the PR's retry lines are new on the current head. (src/OpenClaw.SetupEngine/InstallCliStep.cs:25, b37307cbd51f)
  • Current-main and release check: The PR head is not contained by main or a release tag; current main is its base, so the requested repair is not already implemented on main or in the latest release. (16cb6897941f)

Likely related people:

  • Barbara Kudiess: Raw commit b37307c adds src/OpenClaw.SetupEngine/InstallCliStep.cs:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b37307cbd51f; files: src/OpenClaw.SetupEngine/InstallCliStep.cs)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Retry only explicitly transient curl failures and add coverage for a permanent curl failure.
  • Post redacted current-head managed-WSL output showing retry recovery or direct curl failure propagation.
  • Attach current-head WinUI evidence for the changed setup-review text.

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 (2 earlier review cycles)
  • reviewed 2026-08-28T08:07:14.717Z sha 0f45c88 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-02T18:06:52.859Z sha d9618fd :: needs real behavior proof before merge. :: [P2] Bound each curl transfer before the WSL deadline

@karkarl

karkarl commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Adversarial dual-model review

No CRITICAL or HIGH code defect was found. The core download-before-execute repair is correct, but the review found two cross-model retry/timeout concerns and three lower-confidence edge/test concerns.

Both models agree: HIGH consensus

Issue Opus Codex Fix confidence
InstallCliStep.cs:183-192 has no per-transfer --max-time; --retry-max-time 90 only decides whether another retry may start. A stalled response body can run until the 5-minute RunInWslAsync deadline, while InstallCliStep.cs:81-82 reports TimedOut=true only as exit -1. The outer two-attempt step retry can repeat the wait. MEDIUM MEDIUM 95%
--retry 5 --retry-all-errors plus InstallCliStep.Retry(MaxAttempts: 2) permits up to 12 transfer attempts, including permanent failures such as certificate rejection and, with -f, most HTTP 4xx responses. DNS exit 6 requires broader-than-default curl retry, but permanent failures are not classified. LOW LOW 80%

Only one model flagged: LOW consensus

Issue Opus Codex Fix confidence
A 200 response with a zero-byte body makes curl exit 0 and empty bash -s exit 0, then setup reports the unrelated "CLI installed but not found" message. Add test -s "$installer" before execution. LOW — 99%
The download-error test returns a canned exit 6 and does not execute Bash. This is partly disputed because deleting set -euo pipefail already fails the builder test at SetupStepsTests.cs:1793; the remaining gap is lack of a real shell behavior test. LOW — 80% (disputed)
Builder/review-summary tests do not pin every retained curl safety and timing flag (--proto, --tlsv1.2, --connect-timeout, --retry-delay). This is test hardening, not a demonstrated production defect. — LOW 95%

Cross-reference assessment

  1. Curl documents that --connect-timeout ends after DNS/TCP/TLS setup and --retry-max-time allows an already-started attempt to exceed 90 seconds. Add an intentional --max-time, report result.TimedOut explicitly, and decide whether timeout should consume the outer retry.
  2. The nested retry issue is real but bounded. Prefer an explicit transient-exit retry loop or suppress the outer retry for known permanent curl exits. Keep DNS exit 6 retryable.
  3. Download-before-execute, set -euo pipefail, and regular-file --output correctly prevent execution after a nonzero partial transfer. mktemp and the EXIT trap are appropriate for normal success/failure.
  4. inputViaStdin: true correctly avoids the documented wsl.exe $variable argv mutation. The C# raw string preserves Bash dollar expressions correctly.
  5. No new security vulnerability was found. Setup cancellation propagates into pipeline rollback; live WSL process/temp cleanup after forced timeout remains unproven rather than source-proven broken.

Stable-release disposition

I recommend addressing the MEDIUM timeout/deadline diagnostic before stable landing. Current repository proof policy is also not satisfied: the PR body lacks ## Required proof pools, and its live managed-WSL proof is explicitly blocked. At minimum windows-wsl-gateway-e2e applies; windows-winui-interactive also applies to the changed setup-review copy.

Current GitHub checks pass for tests, win-x64/win-arm64 builds, setup-connect, network-recovery, and revocation-recovery E2Es. The PR is 13 commits behind current main but GitHub reports it mergeable.

@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
@joelagnel
joelagnel force-pushed the fix/install-cli-wsl-dns-retry branch from 0f45c88 to fc2d2ad Compare September 2, 2026 17:40
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 openclaw#1256.
@joelagnel
joelagnel force-pushed the fix/install-cli-wsl-dns-retry branch from fc2d2ad to d9618fd Compare September 2, 2026 17:57
@joelagnel

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@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 merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Sep 2, 2026
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
@shanselman

Copy link
Copy Markdown
Collaborator

Superseded by #1297 at exact head 2ab65105. The contributor fork branch was being force-updated during repair, and advancing it would have required force-pushing. The replacement preserves normal merge history, includes current origin/main, passes full local validation, and carries fresh isolated WSL DNS/recovery/timeout/partial/cleanup proof. No merge was performed.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(setup): retry CLI installer downloads This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@joelagnel

Copy link
Copy Markdown
Collaborator Author

TBD if this is needed following scott's comment above

@shanselman

Copy link
Copy Markdown
Collaborator

Closing as superseded by #1297. The repaired branch could not be fast-forwarded into this fork because it was being force-updated externally; no force push or merge was performed. #1297 contains the current-main merge, hardened implementation, full local validation, fresh WSL proof, and exact-head hosted results.

@shanselman shanselman closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup masks fresh-WSL DNS failures during CLI installation

3 participants