Repository navigation
fix(setup): wait safely for native Gateway operator admission - #1926
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 real behavior proof before merge. What this changesThis PR shares one native Gateway admission deadline and adds optional attempt-qualified launch cleanup. Example: A verified native Gateway needs 21 seconds of startup retries before accepting Companion.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 7 items remain Keep open: current main retains the premature admission timeout, and this maintainer-authored PR contains useful, distinct work; its expired-session recovery path needs correction. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherNative setup prepares a staged Gateway session, verifies package and listener ownership, and opens an authenticated operator connection; the package executes lifecycle commands inside its isolated Windows session. flowchart LR
A[Native setup UI] --> B[Setup session]
B --> C[Setup connection]
C --> D[Gateway operator socket]
B --> E[Isolated runtime]
E --> F[Package command client]
F --> G[Package controller and session host]
G --> H[Gateway process]
Technical reviewBest possible solution: Keep the deadline and receipt logic in the existing owners, route exhausted sessions to fresh setup preparation, and preserve independent listener verification. Do we have a high-confidence way to reproduce the issue? Source establishes the current-main twenty-second wait and the introduced exhausted-session recovery failure; no target code, builds or tests were executed during this read-only review. Is this the best way to solve the issue? Sharing the monotonic allowance and delegating conditional termination to the existing package owner is appropriate, but the retained UI recovery actions must recognize permanent session exhaustion. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4cbbe51c45a7. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source preserves conditional cleanup and process-identity checks, but cross-session termination authority still needs final-effect evidence. EvidenceWhat I checked:
Likely related people:
Review metrics
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 Reviewed October 29, 2026, 6:40 PM ET / 22:40 UTC. |
85bc001 to
0149479
Compare
0149479 to
1c4ca89
Compare
1c4ca89 to
0ee5bc2
Compare
Share the launch-to-operator budget across preparation, authorization and retries. Use optional packaging launch receipts for conditional, attempt-owned cleanup without changing shipping v1 compatibility. Co-authored-by: Copilot App <[email protected]>
Update the existing ownership guard for preparation's linked caller, session and admission-deadline token. Co-authored-by: Copilot App <[email protected]>
Capture the current transport rejection before prompt cancellation disposal and synchronize the callback before classifying a delayed continuation. Preserve caller and session cancellation, and reject stale startup state after a fresh transport. Co-authored-by: Copilot App <[email protected]>
Use the existing logged package invocation and result parser for receipt operations. Align independent fake-clock thresholds and documentation with the inherited five-minute startup budget plus thirty-second handoff allowance, preserving the existing production deadlines. Co-authored-by: Copilot App <[email protected]>
0ee5bc2 to
242c97b
Compare
Stack layer 3. Base:
karkarl-gateway-handshake-diagnosticsate4ce43f01bd4759f8748e0b510dfe39e27941495.Depends on #1924 (improve(setup): diagnose native Gateway handshake delays (Layer 2)), above #1917 (fix(connection): retry promptly while the Gateway is starting).
Stronger launch ownership requires openclaw/openclaw-windows-packaging#225 (fix: prevent onboarding cleanup from stopping another Gateway launch), head
cf04dfaaa30f67415a8434c146fe61a278c12aeb, above openclaw/openclaw-windows-packaging#224 (fix: keep accepted Gateway launches starting until listener readiness).What Problem This Solves
Fixes premature native setup connection failure while an owned Gateway is still starting, and prevents receipt-capable cleanup from stopping a different launch after an uncertain start.
User Impact
User impact: slow native starts can reach authenticated operator admission within one finite allowance rather than an unrelated nested twenty-second wait. Exhausted unadmitted sessions need new setup preparation. Shipping v1 packages retain existing lifecycle behavior; stronger attempt-owned cleanup needs the optional newer packaging extension.
Why This Change Was Made
NativeGatewaySetupSessionremains the runtime/finalization owner and now retains the monotonic admission start through failed connection retries.NativeGatewaySetupConnectionspends only the remaining existing native allowance: 180-second start plus ten-second confirmation plus twenty-second admission margin, 210 seconds by default. Initial preparation, command time, challenge authorization, startup-sidecar retries, pairing and token recovery all count. No outer deadline increases or HTTP/startupzgate are introduced. Terminal failures remain terminal, cancellation remains cancellation, and current-generation typed startup state explains deadline expiry.NativeGatewayPackageClientvalidates optionalintegration.gatewayLaunch={version:1}and launch receipts even for non-running or failed status responses.IsolatedGatewayRuntimeretains a fresh caller-selected GUID-N before dispatch, so lost acknowledgement does not lose correlation. A successfulcreatedreceipt is intent, not listener readiness; anadoptedlaunch grants no cleanup authority. Receipt-capable rollback/detach usesstop --if-attempt-idonly, with no unconditional fallback after refusal, malformed data or uncertain response. Fresh listener/process-sequence proof stays independent and is still required immediately before credentials.No ownership transfer, Gateway configuration API, installation, shared-runtime mutation, finalization-deadline change, merge or auto-merge is included.
Evidence
Fake-clock tests demonstrate initial 90-second preparation plus 90-second authorization, progress at 209.999 seconds and exact expiry at 210 seconds, startup retry admission after 21 seconds, command-time exhaustion before hello, and failed same-session retries without budget renewal. Package/runtime tests cover missing/malformed/unsupported advertisements and receipts, created versus adopted, lost acknowledgement, replacement before stop and refusal with no unconditional fallback. Existing cancellation, token precedence/recovery, listener provenance and lower current/stale transport-generation regressions remain intact.
Independent Copilot
rubber-duckP0-P3 narrative source and proof-plan review covered the implementation candidate. It identified renewal across failed top-level retries; this was corrected and protected by a focused regression. A subsequent one-line existing source guard was updated to require preparation's linked cancellation token rather than its old direct caller token; its ownership assertions were retained and the focused test passed. Those corrective edits were verified locally, not independently re-reviewed. Model identity is unverified. Codex CLI was unavailable; this route does not provide helper-enforced isolation, frozen-input checks or structured helper status. Review is not packaged/runtime proof.Change Type
Scope
winnodeRequired proof pools
windows-11-arm64: native ARM64 Store cold-start and operator admission, not inferred from mocks or cross-compilation.windows-winui-interactive: current-head onboarding progress/error state and associated local MCP diagnostics.windows-wsl-gateway-e2e: connection/setup regression boundary and real Gateway-mediated operator/node flow.windows-wsl-mxc: required setup/connect MXC path proof.All are not verified / blocked by the explicit runtime/provisioning authority exclusions for this task. Real x64 native packaged/Store launch-receipt compatibility is also not verified.
Validation
Tested head:
d99b6a7cc591de722d325f73f58c3822ae6e3427.OPENCLAW_REPO_ROOTpoints at the task worktree; settings are isolated for tests. Required test projects received genuine initial builds before--no-restoreruns.Before native stack registration, product build/test CI had not triggered for this feature-base layer under the existing
main/masterpush/pull-request filters; the earlier not-triggered report describes that historical state only. The native Companion stack is now registered as stack 1928, ordered 1917 -> 1924 -> 1926 -> 1927. After registration, real Build and Test CI, run 40964791695, attempt 1 automatically started viapull_requestat exact headd99b6a7cc591de722d325f73f58c3822ae6e3427. GitHub reportsin_progresswith no conclusion as of 2026-10-29 22:23 UTC: running, not yet green. ClawSweeper dispatch checks are not build/test validation. No workflow dispatch, retarget or workflow change was performed. Root #1917 has an unresolved unchanged UI composer draft-text assertion failure, classified by its owner as unrelated to typed startup retry, not established as baseline or flaky..\build.ps1: passed all five Debug projects, nativewin-arm64, including WinUI.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --verbosity minimal: passed 4,847, skipped 24, failed 0 (4,871 total).dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --verbosity minimal: passed 4,754, skipped 0, failed 0.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --verbosity minimal: passed 1,723, skipped 1, failed 0 (1,724 total).dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore --verbosity minimal: failed 15, passed 2,477, skipped 1 (2,493 total). All 15 failures are unchangedGatewayPackageCleanupTests: the host refuses their temporary PowerShell scripts because script execution is disabled. This file has no delta against the lower base; the same limitation is recorded on the lower layer. No policy change or bypass was used.dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore --filter 'FullyQualifiedName~NativeGatewaySetupConnectionTests|FullyQualifiedName~NativeGatewaySetupTests' --verbosity quiet: passed 135, skipped 0, failed 0..\scripts\validate-docs.ps1: passed, 68 Markdown files and proof-pool documentation checks.git -c core.whitespace=cr-at-eol diff e4ce43f01bd4759f8748e0b510dfe39e27941495 HEAD --check: passed. The repository's existing C# index blobs are CRLF; plaingit diff --checkreports CR as trailing whitespace.The first closeout found one task-coupled Tray source guard still requiring the old direct cancellation argument. It was corrected without removing the guard; its focused case and the complete final build/Shared/Tray/Connection/Setup closeout were rerun. Ordinary opt-in skips are not completed native proof.
Real Behavior Proof
win-arm64Debug build, isolated managed tests and loopback synthetic Gateway only.d99b6a7cc591de722d325f73f58c3822ae6e3427.Passed: 135, Failed: 0, Skipped: 0; full ConnectionPassed: 1723, Failed: 0, Skipped: 1; full TrayPassed: 4754, Failed: 0, Skipped: 0. Deterministic clock/loopback/qualified-command-boundary regressions are described above.Yes/No/N/A): N/A. Dependency links are canonical GitHub URLs; no private local artifact is presented as public evidence.Security Impact
Yes/No): No.Yes/No): No. Device-token precedence, credential retirement guards and fresh endpoint proof are preserved.Yes/No): No. Existing authenticated operator connection only; no new HTTP readiness call.Yes/No): Yes.Yes/No): No.Yes, explain the risk and mitigation: only a qualified package advertising optional launch receipt v1 receives fresh--attempt-idstart and--if-attempt-idstop arguments. Strict schema/ID checks and package-side lifecycle-lock ownership checks reject malformed or replaced attempts. Refusal never becomes an unconditional stop.Compatibility and Migration
Yes/No): Yes for genuinely absent optional receipt support. Shipping schemaVersion 1, isolated-session version 1 behavior is preserved.Yes/No): No new setting. ExistingOPENCLAW_NATIVE_GATEWAY_START_TIMEOUTvalidated whole seconds 30..3600 remains the owner of the startup allowance.Yes/No): No.Review Conversations