Repository navigation
fix(setup): Companion shows Disconnected for a minute after native onboarding finishes - #1747
Conversation
…boarding finishes Verified isolated completion restarted and verified the Gateway, then stopped it before publishing the profile, so the post-setup Companion restart had to cold-start it again. Keep the verified isolated Gateway running through publication and release ownership afterward through a new INativeGatewayRuntime.ReleaseAsync. The isolated runtime drops its owned-start and proof state without stopping the package service; the default still stops, so legacy runtimes are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🦞👀 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 keeps a verified isolated Gateway running after setup publishes its connection, avoiding another cold start when Companion restarts. Example: Complete native onboarding on Windows 11 ARM64 with Gateway 2026.9.900.0.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses an onboarding delay still present on main, and source review found no introduced correctness defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherNativeGatewaySetupSession verifies and publishes the staged Gateway record; IsolatedGatewayRuntime manages package-service ownership, and GatewayConnectionManager independently authorizes subsequent credential handoffs. flowchart LR
A[Native onboarding] --> B[Restart and verify Gateway]
B --> C[Publish Gateway record]
C --> D[Release setup ownership]
D --> E[Restart Companion]
E --> F[Fresh listener verification]
F --> G[Connect to running Gateway]
Technical reviewBest possible solution: Retain the verified package service through successful publication while preserving failure cleanup, legacy stopping and fresh successor authorization. Do we have a high-confidence way to reproduce the issue? Main visibly stops the just-verified setup-owned service before publication, matching the supplied Windows ARM64 timeline; this read-only review ran no application, build or tests. Is this the best way to solve the issue? The repair addresses the unnecessary stop at its lifecycle owner and preserves independent listener verification rather than weakening credential checks or adding retries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9ac0169aa0f1. Provenance checked
TestingProof path: in-process harness. 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 Reviewed October 16, 2026, 3:06 PM ET / 19:06 UTC. |
What Problem This Solves
Fixes: Companion shows "Disconnected / Connect to gateway to start chatting" with no agents for about 60–90 seconds right after native Gateway onboarding finishes.
User Impact
User impact: after finishing onboarding with an isolated (package-managed) Gateway, the restarted Companion connects to the Gateway that setup just verified instead of waiting through another cold start. Legacy same-user Gateways keep the existing stop-before-publish behavior.
Why This Change Was Made
Verified isolated completion restarted the Gateway, verified it, then stopped it before publishing the profile. The post-setup Companion restart then had to start it again, and an isolated cold start currently takes 50–90 seconds. During that window the startup credential handoff is denied and the Home page shows the disconnected empty state.
Setup now keeps a verified isolated Gateway running through publication and calls a new
INativeGatewayRuntime.ReleaseAsyncafterward. The isolated runtime implements it by dropping its owned-start and proof state without stopping the package service, so the next owner adopts it through its own fresh status and listener-ownership proof. The default implementation still stops, so runtimes whose Gateway cannot outlive their owner are unchanged. If publication fails, the Gateway is still owned and is stopped by the existingfinally.Evidence
Redacted timeline from a fresh install (Gateway
2026.9.900.0, Companion2026.9.905.0, Windows 11 ARM64):With this change the 11:27:51 stop and the 11:28:02 cold start no longer happen for verified isolated completion.
Change Type
Scope
winnodeRequired proof pools
windows-clean-installer-upgrade: clean native install through onboarding completion should show Companion connected right after the post-setup restart.windows-11-arm64: the slow isolated cold start was observed on ARM64.Validation
Run with
-p:DisableGitVersionTask=true(GitVersion cannot read the partial clone used) andOPENCLAW_REPO_ROOTset to the repo root:dotnet test ./tests/OpenClaw.Connection.Tests: Passed 1583, Skipped 5, Failed 0 (includes newReleasedServiceKeepsRunningForItsNextOwner)dotnet test ./tests/OpenClaw.SetupEngine.Tests: Passed 2333, Skipped 1, Failed 0 (extendedFocusedAi_AllDestinationsReverifyAfterNativeRestartBeforePublication)dotnet test ./tests/OpenClaw.Shared.Tests: Passed 4313, Skipped 36, Failed 0dotnet test ./tests/OpenClaw.Tray.Tests: Passed 4083, Failed 0dotnet build ./tests/OpenClaw.Tray.UITests -p:Platform=ARM64: compiles; a later provider-icon asset copy step fails in this partial clone (unrelated)./build.ps1not run locally; relying on CI.Real Behavior Proof
ReleasedServiceKeepsRunningForItsNextOwnershows release, stop and dispose issue nogateway-service stop;FocusedAi_AllDestinationsReverifyAfterNativeRestartBeforePublicationasserts isolated completion releases only after publication and legacy completion never releases.Yes/No/N/A): N/ASecurity Impact
Yes/No): NoYes/No): No. Credentials are still sent only after the next owner's fresh listener-ownership proof.Yes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations
🤖 Generated with Claude Code