Skip to content

fix(setup): native Gateway start timeout leaves no details or recovery actions - #1787

Merged
shanselman merged 3 commits into
openclaw:mainfrom
larroy:fix/native-gateway-start-failure-recovery
Oct 23, 2026
Merged

shanselman merged 3 commits into
openclaw:mainfrom
larroy:fix/native-gateway-start-failure-recovery

Conversation

@larroy

@larroy larroy commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: native Gateway setup stops at "Start and verify the Gateway" with a fixed "startup or listener confirmation timed out" message, no details, and no recovery actions other than Retry and Back, when the packaged Gateway does not become ready within the startup budget.

User Impact

User impact: when native setup fails, the page now says which part of the start timed out and what the package last reported. It offers Collect Gateway diagnostics (a redacted ZIP from the package), Open terminal (inside the isolated Gateway) and View setup log. On slow machines the startup budget can be raised with OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT (whole seconds, 30 to 3600, default 180). The defaults are unchanged.

Why This Change Was Made

Before this change:

  • the timeout dropped its phase and the last package status;
  • the runtime logged nothing;
  • native setup logged to a null SetupLogger, so diagnostics bundles never saw it;
  • the package's own clawctl collect-logs and clawctl pwsh were not exposed on this page.
Details
  • NativeGatewayStartupTimeoutException carries Phase (StartRequest or Readiness), Budget and LastStatus. Its message uses only validated lifecycle states and token-shaped readiness reason codes (IsolatedGatewayStatus.Describe()), never package prose. If the start request itself times out, one bounded status read runs before the existing rollback.
  • IsolatedGatewayRuntime takes the router's IOpenClawLogger and logs the start request, its acknowledgement, status changes, the timeout and the rollback.
  • NativeGatewaySetupPage writes Logs\Setup\native-setup-<utc>.jsonl (picked up by DiagnosticsBundleBuilder) and shows the recovery panel for failures after the package is installed. NativeGatewaySetupHost forwards the log to CommandRunner.
  • NativeGatewayPackageClient.CollectLogsAsync parses clawctl collect-logs --json. The per-command timeout is now max(3 min, startup budget).
  • SetupNativeCompletionTiming.Connection is max(210 s, CredentialHandoffTimeout), which is still exactly 210 s at the default.
  • SetupLogger drops file writes after dispose, because the page log is shared with a runtime and host that can outlive the page.
  • New strings are added to all six locales.

Evidence

  • Live wizard run on an ARM64 dev box with a real Store-installed Gateway package (2026.10.400.0). A timeout was forced with a 30 s budget plus CPU contention. The page showed the typed message, the guidance and the three recovery actions, and all three worked (details below).
  • Unit tests cover:
    • the phase and last status for both timeout phases;
    • dropping non-code reasons from the message;
    • which values OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT accepts;
    • parsing collect-logs output and rejecting failures;
    • SetupLogger writes after dispose.

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-winui-interactive: the native Gateway setup page has a new failure/recovery panel.
  • windows-11-arm64: the live proof ran on ARM64; the native package runtime path is architecture-specific.

Validation

Current head 00406154 (rebased on main):

  • ./build.ps1: all builds succeeded (win-arm64).
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 4636 passed, 0 failed, 24 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 4448 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj: 1690 passed, 0 failed, 1 skipped.
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj: 2425 passed, 0 failed, 1 skipped.
  • Read-only rubber-duck review of the original diff: no P0-P2 findings.

Setup-log write failures (ClawSweeper / karkarl P2)

SetupLogger now drops a failed file sink, keeps sanitized in-memory entries, and reports Setup log file writes stopped after <Type> (0x<HRESULT>) through Trace and the in-memory log. Rollback and the native setup failure/Retry presentation therefore never depend on a successful log write. IOpenClawLogger now documents that implementations must not throw for sink failures; the tray Logger already behaves this way.

New tests in SetupLoggerTests: a writer that opens, then throws IOException on the first or a later write, and the real IsolatedGatewayRuntime driven through SetupOpenClawLogger over that failing log.

Before the fix (b8b0d3dc):

Failed ...FileSinkFailureStopsFileWritesAndKeepsSanitizedEntries(failAfter: 0)
   System.IO.IOException : There is not enough space on the disk.
Failed ...FileSinkFailureStopsFileWritesAndKeepsSanitizedEntries(failAfter: 2)
   System.IO.IOException : There is not enough space on the disk.
Failed ...FailingSetupLogDoesNotSkipOwnedStartRollback
   Assert.Throws() Failure: Exception type was not an exact match
   Expected: typeof(OpenClaw.Connection.NativeGateway.NativeGatewayStartupTimeoutException)
   Actual:   typeof(System.IO.IOException)
Failed!  - Failed: 3, Passed: 16, Total: 19 (SetupLoggerTests)

After the fix: Passed! - Failed: 0, Passed: 19, Total: 19 (SetupLoggerTests). The rollback test asserts the original NativeGatewayStartupTimeoutException (Readiness phase), exactly one owned gateway-service stop, and that the rollback entry is still in the in-memory log.

Coordination: #1735 (feat(setup): stream live native Gateway activity log and typed failure diagnosis) carries the same disposed guard in SetupLogger. It should rebase onto this change and keep this single sink-failure policy rather than add a second one.

Full suites on 00406154: ./build.ps1 succeeded; Shared 4636 passed (24 skipped); Tray 4448 passed; Connection 1690 passed (1 skipped); SetupEngine 2425 passed (1 skipped); 0 failures.

Saved completion retries across startup-override changes (ClawSweeper P2)

SetupDashboardHandoffStore.AcquireCore used to require a saved retry's window to exactly match the current process's Execution. It now accepts any window in [SetupNativeCompletionTiming.MinimumExecution, MaximumExecution]: 810s to 7650s, which is what any supported OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT (30 to 3600) can produce. The stored ExecutionExpiresUtc is reused as is, so a restart keeps the original deadline without renewing it.

Before the fix, the new theory PersistedRetryFromAnotherStartupOverrideKeepsItsOriginalDeadline fails:

Failed ...(startupSeconds: 600)   Expected: RetryRequired  Actual: Invalid
Failed ...(startupSeconds: 3600)  Expected: RetryRequired  Actual: Invalid
Failed!  - Failed: 2, Passed: 29, Total: 31 (SetupDashboardHandoffStoreTests)

After the fix:

Passed!  - Failed: 0, Passed: 31, Total: 31   default env (process window 810s)
Passed!  - Failed: 0, Passed: 82, Total: 82   OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT=600 (process window 1650s),
                                              SetupDashboardHandoffStoreTests + SetupNativeHandoffTests

The override run did use a 1650s process window: under =600, the default-only pin PublishedBudgetIncludesBothConnectionsRecoveryModelAndNavigation reports Expected 00:13:30, Actual 00:27:30.

Both transitions are covered:

  • A 1650s record (written with =600) is honored by a default process: theory case 600 in the default-env run.
  • An 810s record (written by default or by released main) is honored by an =600 process: theory case 180 in the override run.

Data-model compatibility

  • PendingRecord has no new or renamed fields, so pending.json written by released builds deserializes unchanged.
  • Released builds write an 810s window. That equals MinimumExecution, so the record is accepted (ExecutionWindowFollowsStartupOverrideWithinPersistedBounds(180, 810), plus theory case 180 in both processes).
  • Records with no execution window keep their 5-minute admission deadline (LegacyUnusedRecordKeepsItsOriginalAdmissionDeadline passes).
  • Out-of-range windows (MinimumExecution - 1s, MaximumExecution + 1s) and a missing expiry remain Invalid (MissingOrOutOfRangeExecutionWindowCannotAcquireNewTime).

Native Gateway start time (default budget headroom)

10 of 10 runs on the npm-latest dev patch (Package 0.1.2484.45924, Payload 2026.10.5), Windows 11 ARM64 build 28000, idle host. Each run did gateway-service stop, a 10s quiet window, then gateway-service start --json, then status polling until running on the expected port. The Store Gateway was untouched (its listener PID was unchanged).

Metric (s) Mean StdDev P99 Min Median Max
Until running 65.519 0.482 66.348 64.953 65.472 66.348
Until start returns 65.308 0.480 66.122 64.740 65.269 66.122
Until a TCP connection is accepted 65.521 0.484 66.363 64.954 65.474 66.363

P99 is nearest rank, which with n=10 is the slowest run. The default 180s budget is about 2.7 times the observed p99.

Real Behavior Proof

  • Environment tested: Windows 11 ARM64. Isolated tray data (OPENCLAW_TRAY_DATA_DIR, OPENCLAW_TRAY_APPDATA_DIR and OPENCLAW_TRAY_LOCALAPPDATA_DIR under %TEMP%). Gateway MSIX OpenClawFoundation.OpenClawGateway 2026.10.400.0, installed by the wizard through WinGet.
  • PR head or commit tested: working tree identical to 76e72e9 for the UI proof below. The follow-up commit b8b0d3dc changes only handoff-window validation, which is covered in Validation.
  • Exact steps or command run:
    1. Launch the Debug tray with OPENCLAW_FORCE_ONBOARDING=1, OPENCLAW_SKIP_UPDATE_CHECK=1 and OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT=30.
    2. Choose Install a local native gateway, then Set up gateway.
    3. During the prepare step, run AboveNormal-priority busy loops on all cores for 75 s to simulate a slow cold start.
    4. Invoke each recovery button through UI Automation.
    5. Restart Companion without the override and run setup again.
  • Evidence after fix:
    • Status text: "The Gateway package did not finish its start request within 30 seconds. Last status: gateway unhealthy, session running, readiness startup-eligible (gateway-mode-local). Run clawctl gateway-service status or clawctl collect-logs for details, then retry."
    • Guidance text names the 30 seconds and OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT.
    • Collect Gateway diagnostics showed "Gateway diagnostics saved to ...\LocalState\OpenClawGatewayMSIX\openclaw-diagnostics-20261020-182534.zip." and opened Explorer there.
    • View setup log opened Logs\Setup. native-setup-20261020-182257.jsonl contains, in order:
      • [WS] Native Gateway start requested on port 18789 (budget 30s).
      • the timeout message
      • [WS] Rolling back the Gateway start requested by this attempt.
      • an error entry with "phase":"StartRequest","budget_seconds":30,"last_status":"gateway unhealthy, session running, readiness startup-eligible (gateway-mode-local)"
    • Open terminal opened a terminal, and the log recorded "Opened the isolated Gateway terminal."
    • Real clawctl collect-logs --json output matched the parser: command: collect-logs, bundle.path, included: host-and-session, notes: [].
  • Observed result:
    • With the override: the Start step showed "Needs attention", and the typed message, guidance and recovery actions all worked.
    • Without the override: the log shows a 180s budget, the start was acknowledged after 33.8 s, and setup continued to Connect your AI.
  • Screenshot or artifact links verified? Yes. The screenshot below shows the failed state with the typed message, guidance and recovery actions; the attachment link returns 200 image/png.
  • Not verified or blocked: the windows-winui-interactive pool run (native compositor capture harness) was not run. The proof above used UI Automation plus a PrintWindow capture on a dev desktop. The page-level failure path under a real full disk was not reproduced live. Coverage is the logger contract plus the real-runtime rollback test, and the page code that reaches these log calls is unchanged.
failed

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No. The new log goes through the SetupLogger sanitizer; status text keeps only validated states and token-shaped reason codes.
  • New or changed network calls? No
  • Command or tool execution surface changed? Yes
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: on explicit user action, setup can now run the installed package's own clawctl collect-logs --json and clawctl pwsh, through the package-qualified alias for the draft's verified package family. These are the same alias and the same terminal the existing setup recovery flow already uses.

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? Yes. New optional OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT; when it is unset, behavior is unchanged.
  • Migration needed? No
  • If yes, list the exact upgrade steps:

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.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@larroy
larroy requested review from joelagnel and karkarl and removed request for joelagnel October 20, 2026 19:30
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

The PR adds native Gateway timeout details, persistent setup logs, recovery buttons, and an optional startup timeout override.

Example: A packaged Gateway start exceeds a 30-second startup budget on Windows 11 ARM64.

  • Before: Setup shows a generic startup timeout with Retry and Back.
  • After: Setup identifies the start-request timeout and last package status, then offers diagnostics collection, an isolated terminal, and the setup log.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with applicable shipped-path evidence and both previous blockers resolved; hosted validation was still running when inspected.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied ARM64 Store-package wizard output exercises the startup timeout, all three recovery actions, and default-budget continuation through production owners whose blobs match the reviewed head. Current-head regression output covers sink failure and saved retry compatibility; launcher coverage rejects changed authority before navigation. The compositor harness and live full-disk UI case are explicitly unrun. Screenshot retrieval was blocked on the review host, so no independent image inspection is claimed.
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 Gateway startup failure gives users too little information or access to diagnostics to recover.
Reason: The collaborator-authored direction has clear support value, exposes existing package recovery capabilities, and keeps the default startup budget unchanged.

Merge readiness

✅ Ready for maintainer review

Keep open: this collaborator-authored PR addresses a concrete recovery gap still present on main, and both prior findings are resolved with no new blocking defect found.

Priority: P2
Reviewed head: 0040615459258392116c9cc9099725ff70ae2ca6

Before merge

None.

Findings

None.

Agent review details

How this fits together

The native setup page calls the package client and isolated runtime to prepare and verify the installed Gateway, then presents either an AI setup session or failure details and recovery actions.

flowchart TD
  A[Native setup page] --> B[Setup service]
  B --> C[Isolated runtime]
  C --> D[Qualified package CLI]
  D --> E[Gateway session]
  C --> F[Sanitized setup logger]
  A --> D
  F --> G[Setup log and diagnostics]
Loading

Technical review

Best possible solution:

Land the focused recovery repair while preserving package-owned diagnostics, shared nonfatal logging, and immutable retry deadlines.

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

Main's timeout exception and setup page establish the generic-error recovery gap; the author also supplies a real ARM64 package-backed timeout reproduction.

Is this the best way to solve the issue?

The repair uses the existing runtime, package commands, logger, and receipt store, and resolves both prior defects at their shared owners without replacing listener or completion authorization.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native startup and completion budgets changes intended behavior with a stated reason (3e6ac76: Bound slow native startup and completion while preserving listener attribution, caller cancellation, and non-renewable execution.)
  • Saved completion retry validation keeps the original intent (3e6ac76: Reject malformed execution timing and prevent retries or restarts from renewing a receipt; the PR preserves absolute expiry while accommodating its supported override.)
  • Shared setup logger keeps the original intent (cefce39: Provide structured diagnostics for the out-of-process transactional setup engine; dropping a failed file sink preserves that diagnostic role without interrupting rollback.)
  • Native setup recovery placement keeps the original intent (dba8121: Keep native installation and onboarding in the guided setup flow; the new controls remain on that page and invoke package-owned operations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Main still lacks the central repair: Fetched main retains the fixed startup-timeout exception text; the introduced diff adds phase, budget, last status, logging, and recovery controls. (src/OpenClaw.Connection/NativeGateway/NativeGatewayStartupTimeoutException.cs:3, fb45902950fd)
  • Prior logging finding resolved: SetupLogger catches expected file-write failures, drops the failed sink, and retains sanitized events; the new runtime regression protects the original timeout and owned-start rollback. The full PR body supplies failing-before and passing-after results, addressing the finding also confirmed by karkarl. (src/OpenClaw.SetupEngine/SetupLogger.cs:115, 004061545925)
  • Prior saved-retry finding resolved: Acquisition accepts supported persisted execution windows while reusing the original absolute expiry. Tests cover restart across override values, expiry, legacy admission, and malformed windows; the body reports both default and 600-second process configurations. (src/OpenClaw.Tray.WinUI/Services/SetupDashboardHandoffStore.cs:95, 004061545925)
  • Live proof remains applicable: The complete body reports a real Store-package timeout, successful use of all three recovery buttons, and successful default-budget continuation. GitHub tree identities match the proof revision to the reviewed head for the page, XAML, host, runtime, and package client. Attachment inspection was blocked by local scratch-write restrictions and remote retrieval failure; the supplied runtime output was readable. Body source identity: SHA-256 66f7add29538f4ce262a407c39a03d74eba5154949634161e9c678cf698b8dd2. (src/OpenClaw.SetupEngine.UI/Pages/NativeGatewaySetupPage.xaml.cs:284, 004061545925)
  • Fresh authority remains required: The receipt remains profile-local and non-renewable. The launcher checks current endpoint binding and expiry before verification and navigation, while the verifier obtains fresh authenticated route and model evidence. Existing launcher tests reject Gateway, device, agent, model, session, and endpoint drift before opening. (src/OpenClaw.Tray.WinUI/Services/SetupNativeHandoffLauncher.cs:34, 004061545925)
  • Authoritative package protocol and policy checked: The PR executes the installed package's collect-logs and pwsh commands, establishing dependency-policy applicability. Its JSON bundle fields match ClawCtlJson, and the package retains diagnostics collection, redaction, and isolated-shell ownership; Companion adds buttons rather than competing implementations. (src/OpenClaw.Launcher/ClawCtlJson.cs:241, fe8430f9a242)

Likely related people:

  • 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: high; commits: 5abfabb38e12; files: src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs)
  • Dallin Romney: Raw commit 5a8830e adds src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5a8830e6bc4c; files: src/OpenClaw.Connection/NativeGateway/IsolatedGatewayRuntime.cs)

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is live_output.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: The PR improves diagnosis and recovery after native Gateway startup failure while preserving default timing and existing authorization checks.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-20T19:51:28.739Z sha 76e72e9 :: blocked before merge. :: [P2] Preserve saved completion retries when the timeout override changes
  • reviewed 2026-10-21T02:07:58.261Z sha b8b0d3d :: needs changes before merge. :: [P2] Keep setup-log write failures from blocking cleanup and recovery

Reviewed October 23, 2026, 2:15 PM ET / 18:15 UTC (Revision 3).

…y actions

Native setup reported a static startup-timeout message with no diagnostics
and only Retry/Back.

- NativeGatewayStartupTimeoutException carries phase (start request or
  readiness), budget and a display-safe last package status.
- IsolatedGatewayRuntime logs the start timeline and rollback.
- NativeGatewaySetupPage persists Logs\Setup\native-setup-*.jsonl and offers
  Collect Gateway diagnostics (clawctl collect-logs), Open terminal and View
  setup log on failure.
- OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT (30-3600s, default 180) overrides the
  startup budget; package command and setup connection budgets follow it.
- SetupLogger drops writes after dispose instead of throwing.
@larroy
larroy force-pushed the fix/native-gateway-start-failure-recovery branch from 76e72e9 to b8b0d3d Compare October 21, 2026 02:03
…hanges

Persisted execution windows are validated against the range any supported OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT can produce (810s to 7650s) instead of the current process's exact window, so a restart with a different override keeps the stored deadline without renewing it.
@larroy

larroy commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@larroy

larroy commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Native Gateway start timing (10 runs)

These numbers show how much headroom the default 180s OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT budget has.

Setup

  • Windows 11 ARM64 (build 28000), idle host.
  • Gateway: npm-latest dev patch OpenClawFoundation.OpenClawGateway-npm-latest, Package 0.1.2484.45924 (403e5ba3), Payload 2026.10.5 (1b58cb9a).
  • The Store Gateway was not touched; its listener PID was the same before and after.

Method: each run did gateway-service stop, waited for stopped, then a 10s quiet window. It then ran gateway-service start --json and polled gateway-service status --json every 250 ms until it reported running on port 18789, then checked that 127.0.0.1:18789 accepted a TCP connection. All times are measured from the moment start was called.

Run start returned (s) running (s) TCP accepted (s)
1 66.122 66.348 66.363
2 64.910 65.131 65.132
3 65.775 65.994 65.995
4 65.129 65.340 65.341
5 65.504 65.702 65.703
6 64.750 64.971 64.972
7 65.764 65.975 65.976
8 64.740 64.953 64.954
9 65.410 65.605 65.606
10 64.977 65.168 65.169
Metric (s, n=10) Mean Std dev (n-1) P99 Min Median Max
Until running 65.519 0.482 66.348 64.953 65.472 66.348
Until start returned 65.308 0.480 66.122 64.740 65.269 66.122
Until TCP accepted 65.521 0.484 66.363 64.954 65.474 66.363

P99 is nearest rank, which with 10 runs is the slowest run.

Observations

  • gateway-service start blocks for almost the entire startup. The first status check after it returns (about 0.2s later) already reports running, and the listener accepts connections within about 1 ms of that.
  • The default 180s budget is about 2.7 times the observed p99. The minimum allowed override, 30s, would time out every start on this host during the start request.
  • A separate attempt that overlapped with dotnet builds was thrown away; its first run took 70.7s.

@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 Oct 21, 2026
@karkarl

karkarl commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Review verdict: HOLD_FOR_AUTHOR

Reviewed head: b8b0d3dc97cf2e2126319c6a5d4da25a2eaae508, against merge-base f6741aa100f55882bf8af867caea38020b642896.

The recovery UX is useful, but one logging failure path needs repair before acceptance. Take confidence: 75%. Recommendation confidence: 99%.

Both models agree: HIGH consensus

Issue Opus 5.5 GPT-6 Astra Fix Confidence
File-log failure can prevent setup from displaying its failure and recovery actions MEDIUM MEDIUM 95%

The new persistent log sink can interfere with the operation it is diagnosing. SetupLogger.Write lets append/flush exceptions escape. If the file opens successfully but storage or quota fails during setup:

  • RunOperationAsync can fail on its initial log write after setting busy but before entering try/finally.
  • Its failure handler logs again before showing the failed row, error, recovery panel and Retry. A second sink failure prevents that UI from appearing.
  • The runtime rollback also logs before StopAsync, so the immediate stop can be bypassed. The owned-start record is retained and later disposal may still stop it; this is not a claim of permanent ownership loss.

The logger's throwing behavior is older, but supplying a file sink to these previously null-file/native paths introduces the exposure. This confirms the existing log-sink finding rather than adding a separate defect.

Requested repair: contain expected file-sink failures, stop writing to the failed sink, preserve sanitized in-memory/event diagnostics, and surface the sink failure through a safe channel. Rollback and failure/cancellation rendering must not depend on a successful log write. Moving only the initial write inside try is insufficient.

Add coverage for a sink that opens successfully but fails on its first or a later append: the original timeout remains available, owned rollback is attempted, busy clears, and recovery/Retry remain visible. The post-disposal test does not exercise this case.

Only one model flagged: LOW consensus

Issue Opus 5.5 GPT-6 Astra Fix Confidence
A long startup override also lengthens non-start command and cleanup timeouts LOW not flagged 65%

CommandTimeout applies to every package invocation. With the supported 3600-second override, a hung rollback/disposal stop can wait up to an hour while holding the runtime gate; those callers pass CancellationToken.None.

Nonblocking policy question, not another required rewrite: defaults are unchanged, and this follows the shared command-budget design. If the override is intended to affect startup only, retain a separate bounded timeout for cleanup and other commands. The lower fix confidence reflects that policy choice.

Evidence and remaining gates

  • Exact-head Build and Test / CI Gate passed. The collected checks contain 13 successes and 13 skips; skipped jobs, including C# CodeQL, are not executed proof.
  • The supplied native failure screenshot was retrieved and inspected. The setup XAML/code-behind, runtime and logger match the declared proof revision 76e72e91; all nine added English recovery strings also match. This credits the relevant visible behavior without claiming whole-tree equivalence or a fresh full-head runtime run.
  • The native compositor harness is explicitly unrun. Native UI/ARM64 proof remains qualified, not waived.
  • These findings were verified against source. This review did not rerun product tests or reproduce the storage failure at runtime.

Both requested models reviewed the same pinned scope separately. The Opus reviewer disclosed that the existing advisory comment prompted its log-write trace; this is source confirmation, not a claim of two blind discoveries. Fix confidence is a coordinator assessment, not runtime proof.

The bounded logger repair should stay coordinated with the same author's #1735 (feat(setup): stream live native Gateway activity log and typed failure diagnosis), rather than creating competing implementations.

…recovery

SetupLogger drops a failed file sink, keeps sanitized in-memory entries, and reports the failure type through Trace and the in-memory log, so rollback and the native setup failure UI never depend on a successful log write.
@larroy

larroy commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. labels Oct 23, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 23, 2026
@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 23, 2026
@shanselman
shanselman merged commit e5122db into openclaw:main Oct 23, 2026
30 checks passed
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

3 participants