Repository navigation
fix(setup): native Gateway start timeout leaves no details or recovery actions - #1787
Conversation
|
🦞👀 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 changesThe 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes:
Label justifications:
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 HistoryReview history (2 earlier review cycles)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.
76e72e9 to
b8b0d3d
Compare
…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.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Native Gateway start timing (10 runs)These numbers show how much headroom the default 180s Setup
Method: each run did
P99 is nearest rank, which with 10 runs is the slowest run. Observations
|
Review verdict: HOLD_FOR_AUTHORReviewed head: 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
The new persistent log sink can interfere with the operation it is diagnosing.
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 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
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
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.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
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:
SetupLogger, so diagnostics bundles never saw it;clawctl collect-logsandclawctl pwshwere not exposed on this page.Details
NativeGatewayStartupTimeoutExceptioncarriesPhase(StartRequestorReadiness),BudgetandLastStatus. 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.IsolatedGatewayRuntimetakes the router'sIOpenClawLoggerand logs the start request, its acknowledgement, status changes, the timeout and the rollback.NativeGatewaySetupPagewritesLogs\Setup\native-setup-<utc>.jsonl(picked up byDiagnosticsBundleBuilder) and shows the recovery panel for failures after the package is installed.NativeGatewaySetupHostforwards the log toCommandRunner.NativeGatewayPackageClient.CollectLogsAsyncparsesclawctl collect-logs --json. The per-command timeout is now max(3 min, startup budget).SetupNativeCompletionTiming.Connectionis max(210 s,CredentialHandoffTimeout), which is still exactly 210 s at the default.SetupLoggerdrops file writes after dispose, because the page log is shared with a runtime and host that can outlive the page.Evidence
OPENCLAW_NATIVE_GATEWAY_START_TIMEOUTaccepts;collect-logsoutput and rejecting failures;SetupLoggerwrites after dispose.Change Type
Scope
winnodeRequired 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.Setup-log write failures (ClawSweeper / karkarl P2)
SetupLoggernow drops a failed file sink, keeps sanitized in-memory entries, and reportsSetup 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.IOpenClawLoggernow documents that implementations must not throw for sink failures; the trayLoggeralready behaves this way.New tests in
SetupLoggerTests: a writer that opens, then throwsIOExceptionon the first or a later write, and the realIsolatedGatewayRuntimedriven throughSetupOpenClawLoggerover that failing log.Before the fix (
b8b0d3dc):After the fix:
Passed! - Failed: 0, Passed: 19, Total: 19 (SetupLoggerTests). The rollback test asserts the originalNativeGatewayStartupTimeoutException(Readiness phase), exactly one ownedgateway-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.ps1succeeded; 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.AcquireCoreused to require a saved retry's window to exactly match the current process'sExecution. It now accepts any window in[SetupNativeCompletionTiming.MinimumExecution, MaximumExecution]: 810s to 7650s, which is what any supportedOPENCLAW_NATIVE_GATEWAY_START_TIMEOUT(30 to 3600) can produce. The storedExecutionExpiresUtcis reused as is, so a restart keeps the original deadline without renewing it.Before the fix, the new theory
PersistedRetryFromAnotherStartupOverrideKeepsItsOriginalDeadlinefails:After the fix:
The override run did use a 1650s process window: under
=600, the default-only pinPublishedBudgetIncludesBothConnectionsRecoveryModelAndNavigationreportsExpected 00:13:30, Actual 00:27:30.Both transitions are covered:
=600) is honored by a default process: theory case 600 in the default-env run.main) is honored by an=600process: theory case 180 in the override run.Data-model compatibility
PendingRecordhas no new or renamed fields, sopending.jsonwritten by released builds deserializes unchanged.MinimumExecution, so the record is accepted (ExecutionWindowFollowsStartupOverrideWithinPersistedBounds(180, 810), plus theory case 180 in both processes).LegacyUnusedRecordKeepsItsOriginalAdmissionDeadlinepasses).MinimumExecution - 1s,MaximumExecution + 1s) and a missing expiry remainInvalid(MissingOrOutOfRangeExecutionWindowCannotAcquireNewTime).Native Gateway start time (default budget headroom)
10 of 10 runs on the
npm-latestdev patch (Package 0.1.2484.45924, Payload 2026.10.5), Windows 11 ARM64 build 28000, idle host. Each run didgateway-service stop, a 10s quiet window, thengateway-service start --json, then status polling untilrunningon the expected port. The Store Gateway was untouched (its listener PID was unchanged).runningstartreturnsP99 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
OPENCLAW_TRAY_DATA_DIR,OPENCLAW_TRAY_APPDATA_DIRandOPENCLAW_TRAY_LOCALAPPDATA_DIRunder%TEMP%). Gateway MSIXOpenClawFoundation.OpenClawGateway2026.10.400.0, installed by the wizard through WinGet.76e72e9for the UI proof below. The follow-up commitb8b0d3dcchanges only handoff-window validation, which is covered in Validation.OPENCLAW_FORCE_ONBOARDING=1,OPENCLAW_SKIP_UPDATE_CHECK=1andOPENCLAW_NATIVE_GATEWAY_START_TIMEOUT=30.OPENCLAW_NATIVE_GATEWAY_START_TIMEOUT.Logs\Setup.native-setup-20261020-182257.jsonlcontains, in order:[WS] Native Gateway start requested on port 18789 (budget 30s).[WS] Rolling back the Gateway start requested by this attempt."phase":"StartRequest","budget_seconds":30,"last_status":"gateway unhealthy, session running, readiness startup-eligible (gateway-mode-local)"clawctl collect-logs --jsonoutput matched the parser:command: collect-logs,bundle.path,included: host-and-session,notes: [].Yes. The screenshot below shows the failed state with the typed message, guidance and recovery actions; the attachment link returns200 image/png.windows-winui-interactivepool 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.Security Impact
NoNo. The new log goes through theSetupLoggersanitizer; status text keeps only validated states and token-shaped reason codes.NoYesNoYes, explain the risk and mitigation: on explicit user action, setup can now run the installed package's ownclawctl collect-logs --jsonandclawctl 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
YesYes. New optionalOPENCLAW_NATIVE_GATEWAY_START_TIMEOUT; when it is unset, behavior is unchanged.NoReview Conversations