Repository navigation
fix(setup): avoid premature Gateway restart timeouts - #1539
Conversation
Bound post-wizard recovery with a shared deadline, preserve sanitized CLI diagnostics, and stop automatic retries after unknown timeout outcomes. Retain guarded ownership checks and existing reload ordering. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 06d057bc-5146-47e7-b299-c4a543244f9a
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 2:21 PM ET / 18:21 UTC (Revision 9). ClawSweeper reviewWhat this changesExtends WSL Gateway start and restart command limits, bounds post-wizard recovery, preserves guarded retry classification, and adds setup tests and documentation. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open. Current main retains the premature Gateway command cutoff, and the earlier refusal-classification finding is repaired. No new code defect is established, but the maintainer-requested final-head MXC run and direct proof of the changed restart path remain outstanding. Priority: P2 Review scores
Verification
How this fits togetherThe Windows Setup Engine runs the Gateway wizard in WSL, restores its reload setting, and restarts the Gateway. Command outcomes feed reachability and managed-ownership checks before setup reports success or failure. flowchart LR
A[WSL setup wizard] --> B[Restore reload mode]
B --> C[Gateway command]
C --> D{Command outcome}
D -->|Timeout| E[Terminal setup failure]
D -->|Guarded refusal| F[Managed ownership check]
F -->|Trusted| C
D -->|Success| G[Reachability and final ownership]
G --> H[Setup result]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Let an owned Gateway complete a slow restart within a bounded setup lifecycle, while preserving fail-closed ownership checks and useful redacted failure details. Do we have a high-confidence way to reproduce the issue? Yes at the source boundary: current main passes a 30-second limit to Gateway restart although the pinned Gateway contract permits a longer stop and replacement window. A live current-main restart exceeding 30 seconds was not captured. Is this the best way to solve the issue? Yes for the Companion cutoff. The longer CLI allowance shares a restoration deadline, and uncertain timeouts and unverified ownership still fail closed; the changed path needs native proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dd69815999ba. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
Adversarial review verdictReviewed commit No confirmed introduced correctness or security defects. No shared defect findings. Both reviewers checked cancellation, terminal outcome propagation, guarded retries, and ownership preservation. Codex accepted no findings.
A reachable endpoint is not proof of authenticated readiness or managed ownership. We should not enlarge the budget or weaken final verification based on the first observation. At the user's request, I am implementing the two diagnostic improvements with focused regression coverage. Ownership rules, deadlines, and restart ordering will remain unchanged. This successful dual-model review is separate from the previously failed external autoreview-helper attempts; it does not claim the helper passed. |
Distinguish completed CLI and HTTP reachability from final ownership-stage deadline exhaustion, and retain the first refusal when a guarded retry fails. Add eight deterministic diagnostic cases without changing deadlines, ordering, or ownership policy. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 06d057bc-5146-47e7-b299-c4a543244f9a
|
Implemented the diagnostic follow-up in
Final validation: full build passed; Shared 4,145 passed / 34 skipped; Tray 3,180 passed; SetupEngine 1,416 passed / 1 skipped; focused lifecycle suite 27 passed; strict pinned Gateway 2026.9.6/MXC 17 passed / 0 skipped, with successful teardown. Both Opus 4.8 and GPT-5.3-Codex reviewed the final follow-up and accepted no remaining findings. Separate autoreview-helper engine remains unavailable (exit 1), not claimed passed. The PR body now contains current-head proof and limitations. Exact timeout diagnostic branches have deterministic coverage, not live fault-injection proof. |
Preserve exact guarded-recovery classification independently of bounded display text. Keep timeout outcomes terminal and retain existing ownership, ordering, and retry budgets. Cover long-output recovery and negative timeout/partial-marker cases. Co-authored-by: Karen Lai <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: be3c6e86-d414-4bc9-b397-4d370a88f02c
|
Addressed the confirmed truncation finding in Independent app-native GPT-6 Astra and Claude Opus5.5 reviews found no accepted introduced source defects. Full build passed; Shared4143 passed/36 skipped, Tray3180 passed, Setup1426 passed/1 skipped. The body records the full review reconciliation and limitations. Maintainer decision: keep the existing standalone retry policy in this PR, accepting up to roughly1260s of CLI work (2520s with every start-limit inner retry), plus reset/health/backoff. This is an explicit wait-time tradeoff, not a new retry mechanism. @karkarl, please rerun strict MXC on your capable ARM64 host at 86cc2f6. Your17/17 proof at32ea886e remains useful historical evidence, but does not cover this final repair. In an isolated worktree at that SHA: $env:OPENCLAW_REPO_ROOT=(Get-Location).Path
$env:OPENCLAW_E2E_GATEWAY_VERSION='2026.9.6'
.\scripts\validate-mxc-e2e.ps1 -ResultsDirectory .\TestResults\RestartClassificationFinal\MxcPlease include exact SHA, command, TRX counters with zero skips, and teardown result. Do not use |
Strict final-head MXC proof: passedResponding to Scott's exact-head rerun request: validated $env:OPENCLAW_REPO_ROOT=(Get-Location).Path
$env:OPENCLAW_E2E_GATEWAY_VERSION='2026.9.6'
.\scripts\validate-mxc-e2e.ps1 -ResultsDirectory .\TestResults\RestartClassificationFinalRetry\MxcNo TRX: total 17, executed 17, passed 17, failed 0, notExecuted 0, timeout 0, aborted 0. All six MXC fixture cases passed, including actual Gateway -> Windows node -> MXC execution, sandbox write rejection and executable allowlist cases. The strict validator explicitly passed its three required proof checks and exited 0. Teardown: Local evidence:
First attempt retained, not hiddenThe preceding fresh-build run used This was not the restart CLI exhausting its 420-second allowance. The captured logs do not establish why the distro stopped or whether Windows/WSL forwarding also contributed. The unchanged, fresh-fixture retry passed; this does not prove the original failure's root cause or eliminate intermittent setup failures. First-run artifacts remain in Final-head CI Gate is also green. No MXC waiver or gate bypass is needed. This proof does not claim live typed-contention fault injection, a successful CLI restart exceeding 30 seconds, or elimination of the broader reload/restart race. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(setup): avoid premature Gateway restart timeouts This is item 1/1 in the current shard. Shard 0/1. This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Related: #1498
What Problem This Solves
Fixes premature failure of WSL Gateway setup when the post-wizard restart exceeds Companion's old 30-second CLI cutoff. Timeout details were lost, and captured refusal text could invite another restart despite an unknown outcome.
Maintainer follow-up
86cc2f61b2dceec74c12b7c5806475fcfa205f9efixes the reproduced diagnostic-truncation regression: recovery classification uses complete captured streams before display truncation, rather than searching the shortened message. Two internal init-only facts on existingStepResultcarry classification without retaining raw output or adding a public/wire/config contract.User Impact
Gateway restart gets 420 seconds and start gets 90 seconds. Post-wizard restoration shares a default 570-second lifecycle deadline across CLI attempts, guarded recovery, reachability and ownership checks. A timed-out command remains terminal and is not automatically repeated. Long diagnostic prefixes no longer suppress existing guarded recovery.
Accepted maintainer decision: retain the existing standalone three-attempt retry policy in this bounded PR. Completed non-timeout failures can consume nearly 1,260 seconds of restart CLI time, or 2,520 seconds when every attempt also takes the existing start-limit inner retry, plus reset/health/backoff. The first CLI timeout stops retries. No new standalone budget or retry mechanism is introduced.
Why This Change Was Made
Pinned Gateway 2026.9.6 permits 330 seconds for service stop and 60 seconds for replacement health. Companion adds preparation margin instead of killing the command at 30 seconds.
StartGatewayStep owns command execution; SetupWizardRunner owns restoration orchestration; GatewayWizardRestartRecoveryPolicy retains exact-marker policy. Ownership gates, reload-before-restart ordering, cancellation and sanitized/bounded diagnostics are preserved. No direct systemd restart fallback or ownership bypass.
Evidence
Four long-output regression cases failed on
32ea886ebefore repair and pass afterward: generic serving-owner and paired typed-contention refusal markers, each beyond a 3,000-character prefix in stdout or stderr. Four additional cases keep long-output timeouts terminal. Two negative cases require both exact contention markers. Final lifecycle suite: 37/37.Independent app-native review used GPT-6 Astra (
gpt-6-astra, high, long_context) and Claude Opus 5.5 (claude-opus-5.5, high) on the same frozen final-source diff. No accepted introduced source defects remain. Opus independently ran 148 affected tests successfully. Structured CLI autoreview was explicitly waived by the maintainer and was not run for this repair.Both models agree: high consensus
Only one model flagged: low consensus
Change Type
Scope
winnodeRequired proof pools
windows-wsl-gateway-e2e: post-wizard restart, managed ownership and recovery. Exact-head hosted setup/connect proof passed.windows-wsl-mxc: exact-head strict ARM64 proof passed on a fresh-build retry, 17/17 with zero skips and teardown exit 0. Initial fixture failure is recorded below, not discarded.The earlier proof-scope waiver question is superseded by capable-host final-head validation. No MXC waiver or gate bypass is claimed or required.
Validation
Final source:
86cc2f61b2dceec74c12b7c5806475fcfa205f9e. Local validation used worktreeOPENCLAW_REPO_ROOTand isolated tray data. The committed patch exactly matches the reviewed and validated diff; no subsequent source edits..\build.ps1: passed.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj: 4,143 passed, 36 skipped, 0 failed. Restore enabled for first-run worktree validation.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj: 3,180 passed, 0 skipped, 0 failed. Restore enabled for first-run worktree validation.dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore: 1,426 passed, 1 skipped, 0 failed.GatewayRestartLifecycleTests: 37 passed, 0 skipped, 0 failed.86cc2f61b2dceec74c12b7c5806475fcfa205f9e.e2e-test-results-setup-connectartifact. Hosted skips are not containment proof.-NoBuildor-AllowSkip. Exact-head proof and both attempts.Real behavior proof
Exact-head hosted E2E at
86cc2f61passed these real Gateway cases:FullSetup_WslAndGatewayConfiguration_FilesValidatedFullSetup_ForeignWslListener_IsRejectedBeforeGatewayStartFullSetup_AlreadyRunningGateway_IsRecognizedAsServiceOwnedFullSetup_GatewayRestart_ReconnectsTrayAndNodeFullSetup_TrayConnects_OperatorAndNodeFullSetup_SafeNodeInvocation_RoutesThroughRealGatewayEvidence: Setup and connect E2E job, artifact
e2e-test-results-setup-connect,OpenClaw.E2ETests.setup-connect.trx. Six MXC tests explicitly report hosted runners lack a working MXC/AppContainer runtime.Current-head ARM64 MXC: all six MXC fixture cases and eleven port-lease cases passed. This exercised real Gateway -> Windows node -> MXC command execution, sandbox write rejection and executable allowlist behavior. Local TRX:
TestResults\RestartClassificationFinalRetry\Mxc\OpenClaw.E2ETests.Mxc.trx; fixtureTestResults\E2E\d011631d. Uninstall exited 0 at 18:44:14.690 UTC and teardown completed at 18:44:14.706 UTC on 2026-09-29. Full result.Initial attempt retained: 11 passed, 6 failed, zero skips. All six failures came from shared fixture initialization at Windows-side operator pairing, before MXC assertions. Gateway startup returned HTTP 200 inside WSL; pairing then timed out and saw connection refusals. Rollback reported the test distro not running. Teardown exited 0. The logs do not establish why the distro stopped or whether forwarding contributed. This was not exhaustion of the 420-second restart CLI allowance. The unchanged fresh-fixture retry passed; intermittent setup reliability is not thereby proven fixed. Initial evidence remains in
TestResults\RestartClassificationFinal\Mxcand fixtureTestResults\E2E\97a2e49e.Historical evidence: strict Gateway 2026.9.6/MXC validation at
32ea886efdef04798eca0f4dff0d13226f0e572balso passed 17/17 with zero skips and teardown exit 0. Earlier evidence. Final-head proof above supersedes the earlier coverage gap and satisfies Scott's rerun request.Not verified / blocked: live typed-contention recovery; live successful CLI taking more than 30 seconds; live ownership-deadline fault injection; upstream watcher race determinism; root cause of the initial pairing/distro failure. Deterministic tests establish classification branches, not live fault injection. HTTP 200/401/403 means reachability, not authenticated readiness. No UI claims or screenshots.
Security Impact
Compatibility and Migration
Review Conversations