fix(setup): keep WSL PATH scripts off the wsl.exe argv path - #1476
Conversation
Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 2:49 PM ET / 18:49 UTC (Revision 6). ClawSweeper reviewWhat this changesThe setup engine sends PATH-bearing Gateway install, configuration, pairing, restart, and verification scripts through WSL standard input and adds regression coverage. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still sends PATH-bearing Gateway setup scripts through the WSL argv path. The earlier review gaps are addressed by the current patch and its current-head native proof, with no blocking defect identified. Priority: P2 Review scores
Verification
How this fits togetherThe setup engine turns onboarding choices into commands for a Gateway running inside WSL. Those commands configure and start the Gateway, then support pairing and connection verification. flowchart LR
A[Onboarding choices] --> B[Setup engine]
B --> C[Gateway scripts]
C --> D[WSL standard input]
D --> E[Linux Bash]
E --> F[Gateway setup and pairing]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the bounded stdin transport repair and retain the regression guard for future PATH-bearing setup calls. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source uses the unsafe argv path, and the repository documents a concrete WSL variable-expansion reproduction; this read-only review did not execute it. Is this the best way to solve the issue? Yes. The patch uses the runner’s existing stdin transport and covers the setup calls identified by maintainer review. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5e0b31ab830a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 40%; recommendation confidence 90%; effort small; risk medium. Reviewed exact head |
ConfigureGateway and the setup wizard still passed PATH scripts on the wsl.exe argv path. Those calls now use bash -s stdin, with a guard so a new argv PATH script fails the test. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5571738d-2ca1-457c-8a27-6895b3a9e455
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What problem
Gateway install, uninstall, configuration, token minting, pairing approval, restart, and verification prepend the Linux OpenClaw paths with a script containing
$PATH. When that script is passed throughwsl.exe -- bash -c <script>,wsl.execan expand shell variables before Bash starts and replace the Linux PATH.Fix
All affected SetupEngine calls now pass PATH-bearing scripts through standard input with
RunInWslAsync(..., inputViaStdin: true), which selectswsl.exe -- bash -s. The contributor regression test covers install, uninstall, configure, mint, operator and node approval, restart, approval drain, and wizard reload restoration. A source-shape closure test prevents new PATH-bearingRunInWslAsynccalls from returning to argv transport.Current head
72d0cbfdcf4979deca0368258aabc896b0c25854preserves SebTardif's two contributor commits and adds a normal merge of currentmain. No force-push or replacement PR was used.Required proof pools
windows-wsl-gateway-e2e: setup transport, bootstrap, pairing, restart, existing-service behavior, and verification changed.windows-wsl-mxc: repository-required real Gateway to Windows nodesystem.runcloseout for gateway setup/connect changes.Validation
Maintainer validation on 2026-09-28, exact head
72d0cbfdcf4979deca0368258aabc896b0c25854:.\build.ps1win-x64.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restoreWslPathPrefixScripts_UseStdinSoWslExeDoesNotExpandPath.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore$env:TEMP=$env:TMP='<task-owned D:\ path>'; $env:OPENCLAW_RUN_E2E='1'; .\scripts\Invoke-CiE2e.ps1 -Name setup-connect -Filter '<CI setup-connect filter>'$env:TEMP=$env:TMP='<task-owned D:\ path>'; .\scripts\validate-mxc-e2e.ps1 -NoBuildMirroredWslSafeGatewayPort_IsListeningAndRecorded, real Gateway MXC execution, and protected tray-data write denial all passed.The first fresh-worktree
--no-restoreattempts correctly failed because test assets were absent. Each test project was then explicitly built, and the counted--no-restoreruns above were rerun sequentially. Two timeout-sensitive tests that failed only under four-suite parallel contention passed alone and in the final sequential full suites.Environment: Windows x64, .NET SDK 10.0.401, WSL 2.9.13. Process-only
TEMPandTMPpointed to a task-ownedD:\OpenClawProof\...directory for WSL VHD creation. No global ACL or system setting changed. All task-owned E2E distros, temp state, and the auxiliary Azure Crabbox lease were removed after proof.Real behavior proof
A disposable harness invoked the production
OpenClaw.SetupEngine.CommandRunneragainst the local Ubuntu WSL distro with a PATH-bearing multi-line script and a unique marker. While the command was running, Windows process inspection observed only:The unique script marker was absent from
wsl.exeargv. Product output was:This directly proves that the production runner kept the script off the
wsl.exeargv path, preserved the Linux PATH, preserved Bash variable expansion, and delivered the script tobash -sover stdin.The current-head setup-connect shard then provisioned fresh isolated gateways through the real SetupEngine and validated install, configure, service start, bootstrap, operator and node pairing, existing-running-service recognition, gateway connection, Windows node capability propagation, and teardown. The changed environment-backed approval path succeeded through real setup, closing the concern that request IDs might be lost when expansion moved from Windows argv processing to Bash.
The strict MXC script selected real BaseContainer containment and completed all 17 tests without skips. Both required real Gateway to Windows node
system.runproofs passed, including denial of a write to the isolated tray data directory.Rubber-duck review found no blocking implementation issue after the live changed-path proof. It identified only non-blocking follow-ups outside this bounded fix: richer stdin command diagnostics, an architecture-ledger entry for the closure guard, and broader documentation cross-links.
No gateway credentials, setup codes, device identities, private settings, or secret-bearing artifacts are included in this proof.