Repository navigation
fix(setup): native Gateway setup times out validating configuration when the packaged CLI is slow - #1990
Conversation
Isolated-session 'openclaw config validate --json' on ARM64 (package 2026.10.900.0) takes ~131s, past the hardcoded 2-minute cap, so native setup failed in StepPrepare. Double the per-command deadline to 4 minutes and make it overridable via OPENCLAW_SETUP_NATIVE_CLI_TIMEOUT (seconds).
|
🦞👀 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: needs maintainer review before merge. What this changesThis PR gives packaged Gateway CLI calls during native setup a configurable four-minute timeout. Example: On Windows ARM64, packaged configuration validation returns valid configuration after 131.5 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: current main still imposes the reported two-minute limit, and this maintainer-authored PR provides a focused correction with no actionable source defect found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe native setup session delegates package-qualified CLI execution to NativeGatewaySetupHost, which passes the resolved deadline and caller cancellation to CommandRunner and returns output or a setup error. flowchart LR
A[Native setup page] --> B[Native setup session]
B --> C[NativeGatewaySetupHost]
D[Timeout policy] --> C
C --> E[CommandRunner]
E --> F[Packaged Gateway CLI]
Technical reviewBest possible solution: Keep one configurable CLI deadline in the existing setup host while preserving package lifecycle, authorization, cancellation, and stored user state. Do we have a high-confidence way to reproduce the issue? Current-main source terminates validation after 120 seconds, matching the author's reported timeout and successful package-alias executions beyond that limit; this review did not execute the setup flow. Is this the best way to solve the issue? The focused budget correction addresses Companion's premature termination using existing execution owners, while leaving the package's underlying CLI slowness to its own owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b917d7e197e5. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 3, 2026, 12:42 PM ET / 17:42 UTC. |
What Problem This Solves
Fixes: native Gateway setup fails with "Validating native Gateway configuration... Timed out." when the packaged Gateway CLI is slow to start (observed on ARM64).
User Impact
User impact: native Gateway setup gets past configuration validation on hosts where the packaged
openclawCLI needs more than 2 minutes per call. A CLI call that truly hangs now takes up to 4 minutes to fail instead of 2. Cancelling still stops it immediately.Why This Change Was Made
Companion capped every packaged
openclawCLI call during native setup (config validate, the node-capabilitiesconfig set,gateway health,devices list,devices approve) at a hardcoded 2 minutes. On the failing host,config validatealone takes about 131 s, and its answer is valid. This PR doubles the default to 4 minutes and moves it to a named constant thatOPENCLAW_SETUP_NATIVE_CLI_TIMEOUT(seconds) can override, as the repo guidelines ask. It parses the variable the same way as the existingOPENCLAW_SETUP_PACKAGE_ACQUISITION_TIMEOUT. Theclawctl setupandNativeGatewayPackageClientbounds are unchanged.Evidence
Failing run (
native-setup-*.jsonl, redacted): StepPrepare ranopenclaw.exe config validate --jsonwithtimeout_ms=120000. The process was killed at 120,070 ms withtimed_out:trueand no output, so setup failed.Manual reproduction of the same command through the package alias (Gateway package 2026.10.900.0 arm64, isolated-session contract):
{"valid":true,...,"warnings":[]}Both runs printed the stderr line
CLI cleanup timed out: shared-state after 5000ms. Because the second run was just as slow, this is a steady-state delay, not cold start. The underlying CLI slowness belongs to the packaging repo. This PR only stops Companion from giving up first.New
NativeGatewayCliTimeoutTestscover:0, negative, non-numeric and out-of-range values keep the defaultAn independent read-only review found no P0-P2 issues. Its one P3 doc imprecision is fixed in
0f33d311.Follow-up risk noted by review (not changed here)
In the same failing run, the isolated
PreparePackageAsyncstep (NativeGatewayPackageClient.SetupAsync, 3-minuteDefaultCommandTimeout) took 2 min 17 s, so it has about 43 s of headroom. It was not the failing step, and this PR doesn't change it.Change Type
Scope
winnodeRequired proof pools
none: this only changes the timeout value and how it is resolved; nothing architecture-, installer-, WSL- or UI-specific changed. The ARM64 host only reproduced the slow CLI. Native setup proof on that host is listed under Not verified below.Validation
Local, Windows ARM64, at
304b79bf:./build.ps1: exit 0dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore: 2529 passed, 4 skipped, 0 faileddotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 4810 passed, 24 skipped, 0 faileddotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 4788 passed, 0 failed--filter FullyQualifiedName~NativeGatewayCliTimeoutTests: 6 passed, which confirms the new tests ranAt
0f33d311(one-line doc change):./scripts/validate-docs.ps1passed, 69 Markdown files checked.On the first Tray run,
NativeGatewaySetupUxContractTests.NativeWizard_UsesSharedPageAndRpc_WithFailClosedStagedAuthorizationfailed. It asserted the oldPairingCommandTimeout = TimeSpan.FromMinutes(2)literal. That source-text check was removed. The assertion that the two legacy pairing calls still forwardenvironmentwas kept and updated to the new symbol.Real Behavior Proof
openclaw.exe config validate --jsonthrough the package execution alias, timed twice{"valid":true}. That is over the old 120 s cap and under the new 240 s default.Yes/No/N/A): N/ASecurity Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation:Compatibility and Migration
Yes/No): YesYes/No): Yes. New optionalOPENCLAW_SETUP_NATIVE_CLI_TIMEOUT. When unset, the default is 240 s.Yes/No): NoReview Conversations