Skip to content

fix(setup): native Gateway setup rolls back a slow but progressing start after 180 seconds - #1993

Merged
larroy merged 1 commit into
openclaw:mainfrom
larroy:fix/native-gateway-start-timeout-300s
Nov 3, 2026
Merged

larroy merged 1 commit into
openclaw:mainfrom
larroy:fix/native-gateway-start-timeout-300s

Conversation

@larroy

@larroy larroy commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #1969
Related: NVBug 6934228, #1903, #1990, #1750

What Problem This Solves

Fixes: native Gateway setup fails at the verify step and stops a Gateway that is still starting when the host needs more than 180 seconds to reach a listener (observed 165-210 s on slow ARM64/x64 hosts).

User Impact

User impact: native Gateway setup now completes on slow hosts whose Gateway becomes ready within five minutes. A start that never becomes ready, and keeps reporting starting or unhealthy, now takes up to five minutes (previously three) to fail. A start that reports a terminal state still fails immediately. OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT still overrides the budget (30-3600 s).

Why This Change Was Made

IsolatedGatewayRuntime gives an owned native start one budget that also covers the package start command, which waits about 90 seconds itself. When that budget expired, setup rolled back (stopped) a start that was still progressing. This raises DefaultStartupTimeoutSeconds from 180 to 300. The credential handoff, setup connection phase, chooser verification and execution window deadlines already derive from it, so every outer deadline stays longer than the runtime's own ceiling:

Budget (default) Before After
Startup (incl. start command) 180 s 300 s
Start/status ceiling with late-ack confirmation 190 s 310 s
Credential handoff / setup connection phase 210 s 330 s
Chooser verification 6 min 8 min
Setup execution window 1,620 s (27 min) 1,860 s (31 min)

Ownership checks, rollback rules and fresh listener verification are unchanged. Handoff records persisted by a 180 s build (1,620 s window) remain admissible after upgrade and keep their original deadline.

Known side effect: NativeGatewayPackageClient.CommandTimeout is max(3 min, StartupTimeout), so other package commands (setup, stop, companion prepare) can now wait up to 300 s before timing out. Status polls during startup remain bounded by the startup deadline. Left as is to keep this change minimal.

Option considered and deferred: a "Retry with more time" setup action. A durable fix is a startup progress field in the package's gateway-service status --json contract (attempt-bound phase sequence), so Companion can fail on lack of progress instead of a fixed budget; that belongs in openclaw-windows-packaging.

Evidence

  • New regression test SlowOwnedStartReachingListenerAtTwoHundredTenSecondsIsNotRolledBack replays the [Bug] Native Gateway setup stops a progressing launch after 180s; same installation needs 210s to become ready #1969 timeline with a fake clock: start acknowledged at 90 s, unhealthy while polled every 2 s, listener at 210 s. Before the fix it failed with the same message as the field log (did not report a verified listener within 180 seconds); it now passes with one start and no stop.
  • New DefaultNativeStartupBudgetCoversObservedSlowStartAndKeepsOuterDeadlinesOrdered checks the default leaves at least 60 s over 210 s and that handoff, connection, verification and execution deadlines outlive the startup ceiling. It failed before the fix.
  • Tests that hard-coded 180-second derivations (179 s, 90+90 s, 210 s, 1,620 s, 27 min) are now expressed via the constants.
  • Independent review of the diff: no P0-P2 findings; P3 doc wording and test robustness findings fixed, command-timeout side effect documented above.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-11-arm64: the reported failure is native Gateway setup on a slow ARM64 host; a native setup with Store Gateway 2026.10.900.0 that becomes ready after more than 180 s is the real-behavior proof still needed.
  • windows-wsl-mxc: required by repository policy for gateway setup/connect changes; run locally (see Validation).

Validation

Run on Windows 11 x64 (10.0.26100) from the uncommitted tree identical to this commit, OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT unset:

  • ./build.ps1: all builds succeeded; documentation validation passed (71 files).
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 4,810 passed, 24 skipped, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 4,788 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj: 2,531 passed, 4 skipped, 0 failed (with OPENCLAW_REPO_ROOT set; rerun after the final review fix).
  • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore: 1,703 passed, 1 skipped, 0 failed.
  • New tests confirmed executed via filtered runs (12 and 14 cases passed).
  • .\scripts\validate-mxc-e2e.ps1: 18/18 passed, including RealGateway_SystemRun_ExecutesThroughWindowsNodeMxcSandbox and RealGateway_SystemRun_BlocksWritesToTrayDataDirectoryInMxcSandbox.
  • .\scripts\validate-docs.ps1: passed. git diff --check (CRLF-aware): clean.

Real Behavior Proof

  • Environment tested: Windows 11 Pro x64 10.0.26100 with a WSL Gateway (MXC E2E). No slow ARM64 host with the native Store Gateway was available.
  • PR head or commit tested: tree of this PR's single commit (tests run before commit; final SetupEngine and docs checks after the last edit).
  • Exact steps or command run: .\scripts\validate-mxc-e2e.ps1; focused fake-clock regression replaying the [Bug] Native Gateway setup stops a progressing launch after 180s; same installation needs 210s to become ready #1969 timeline.
  • Evidence after fix: regression test passes (one start, no stop, verified listener at 210 s); MXC real-Gateway proofs pass.
  • Observed result: owned starts that become ready between 180 s and 300 s are no longer rolled back in the runtime model; real Gateway connect path unaffected.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A
  • Not verified or blocked: native setup on a slow ARM64 host with Store Gateway 2026.10.900.0 showing budget 300s, readiness after more than 180 s and no Rolling back the Gateway start entry in Logs\Setup\native-setup-<utc>.jsonl (pool windows-11-arm64).

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A. Credentials are still sent only after fresh listener ownership proof.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No (default of OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT changes from 180 to 300; explicit values unchanged)
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

…art after 180 seconds

Slow ARM64/x64 hosts reach a verified Gateway listener after about
165-210 seconds (openclaw#1969). The 180-second startup budget, which also
covers the package start command's own ~90-second wait, expired first
and setup stopped the still-starting Gateway.

Raise IsolatedGatewayRuntime.DefaultStartupTimeoutSeconds to 300. The
credential handoff, setup connection, chooser verification and execution
window deadlines already derive from it and stay ordered.
OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT still overrides it.

Add a regression test replaying the openclaw#1969 timeline (acknowledged at
90 s, unhealthy while polled, listening at 210 s) and a test that
the outer deadlines outlive the startup ceiling. Express tests that
hard-coded the old 180-second derivations in terms of the constants.
@clawsweeper

clawsweeper Bot commented Nov 3, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Raises the default native Gateway startup allowance from 180 to 300 seconds and updates its derived deadline documentation and tests.

Example: An owned Gateway launch acknowledges at 90 seconds and reaches a verified listener at 210 seconds.

  • Before: Setup times out at 180 seconds and stops the launch.
  • After: Setup can accept the verified listener within the 300-second budget.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-correct, with reported regression and suite validation, but supplied runtime evidence does not exercise the changed native startup scenario.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Native setup stops a Gateway that would become ready shortly after its three-minute deadline.
Reason: The report demonstrates the mismatch, and the maintainer-authored PR chooses a bounded increase without adding another recovery mechanism.

Merge readiness

✅ Ready for maintainer review

Keep open: current main retains the reported 180-second limit, and this maintainer-authored PR provides a focused repair with no introduced correctness defect found.

Priority: P0
Reviewed head: 0184e96fb374e6268c3217c65fc28689774e6a53

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A current-head native Store setup completing after 180 seconds and a latest-stable upgrade preserving settings and stored deadlines are not supplied.
Agent review details

How this fits together

Native setup and connection authorization call IsolatedGatewayRuntime, which invokes the installed package, polls startup status, verifies listener ownership, and either permits connection or rolls back its owned launch.

flowchart TD
  A[Native setup or reconnect] --> B[IsolatedGatewayRuntime]
  B --> C[Package start and status commands]
  C --> D[Fresh listener ownership checks]
  D --> E[Credential authorization]
  B --> F[Owned launch rollback on failure]
Loading

Technical review

Best possible solution:

Use the existing bounded startup owner with the 300-second default, preserving cancellation, fresh ownership verification, and original persisted deadlines.

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

Current-main source establishes timeout followed by owned-start rollback, and the report supplies the corresponding log trace; this read-only review ran no builds, tests, or Windows reproduction.

Is this the best way to solve the issue?

This is the smallest complete repair for the observed 210-second startup using existing owners; the maintainer explicitly accepts the longer bounded waits, while underlying Gateway slowness remains separate.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Default startup deadline changes intended behavior with a stated reason (3e6ac76: Bound acknowledged owned-start polling while retaining listener provenance and finite completion budgets.)
  • Configurable startup budget and package-command coupling keeps the original intent (e5122db: Provide bounded overrides and actionable timeout diagnostics without shortening package commands.)
  • Persisted setup execution deadlines keeps the original intent (d318127: Charge teardown and post-restart completion against one nonrenewable execution window.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Pedro Larroy: Raw commit e5122db adds src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e5122db3c943; files: src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs)
  • Karen: Raw commit 3e6ac76 adds src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3e6ac7621eca; files: src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs)
  • Paul Campbell: Raw commit 5abfabb adds src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 5abfabb38e12; files: src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs)

Review metrics

Metric Value Why it matters
Introduced change size Production +5/-1; tests +102/-27; documentation +31/-23 Growth supports the slow-start regression, deadline relationships, and updates to existing timing expectations without adding production machinery.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1969
Summary: This PR addresses the canonical owned-start timeout report; related validation and pre-existing-start admission failures have distinct causes.

Members:

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

Labels

Label changes:

  • add P0: The linked report establishes first-run native setup rollback on a supported installation, with recovery requiring an environment change and Companion restart outside the wizard.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P0: The linked report establishes first-run native setup rollback on a supported installation, with recovery requiring an environment change and Companion restart outside the wizard.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 4:44 PM ET / 21:44 UTC.

@larroy
larroy merged commit 31d5074 into openclaw:main Nov 3, 2026
33 checks passed
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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

[Bug] Native Gateway setup stops a progressing launch after 180s; same installation needs 210s to become ready

1 participant