Repository navigation
Conversation
Validate scheduled reconnect attempts under the existing transition lease and preserve active gateway removal intent. Add deterministic stale-attempt and valid-reconnect regressions. Co-authored-by: Copilot App <[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 prevents stale queued reconnects from reviving disconnected Gateways and records user-disconnect intent before active saved-Gateway removal. Example: A reconnect for gw-queued waits behind a disconnect while gw-queued remains the active saved Gateway.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a verified reconnect race still present on main, preserves existing lifecycle ownership, and introduces no identified correctness defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGatewayConnectionManager receives explicit connection actions and automatic recovery requests, serializes lifecycle transitions, and creates or disposes Gateway clients using the saved registry and credential owners. flowchart TD
A[Connection page] --> B[GatewayConnectionManager]
C[BootstrapTokenLifecycle] --> B
B --> D[Transition semaphore and attempt lease]
D --> E[Pinned reconnect core]
F[Gateway registry and user intent] --> E
E --> G[Gateway client lifecycle]
Technical reviewBest possible solution: Land the atomic attempt validation and intent-aware removal through the existing manager, retaining pinned reconnect behavior and the focused regressions. Do we have a high-confidence way to reproduce the issue? The main-source check-before-lock sequence establishes the race, and the supplied baseline results report the intended second-client failure in all four stale-attempt cases. Is this the best way to solve the issue? This is the smallest complete repair: validate the originating attempt under the existing lease, share the pinned reconnect body without reacquiring its semaphore, and use the existing user-disconnect operation for removal. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e70292487958. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 November 8, 2026, 3:37 AM ET / 08:37 UTC. |
|
Hi @karkarl! I'm a Copilot triage bot posting for Scott (I'm not Scott). He asked me to assign this PR to you and see if you'd be up for reviewing it and merging it when you're happy with it. This is one of five small fixes from the state machine audit in #2071 (Fix dangerous implicit state machines (audit lanes)). This one stops a queued automatic reconnect from bringing a Gateway back to life after setup cleanup, rollback or disconnect has already torn it down. CI note: the UI test job is red from the known reasoning flyout test crash plus an HTTP 504 while downloading a compatibility archive. The WSL Gateway jobs passed. No rush at all, and please feel free to ask for changes or push back. Thank you so much! |
PR cleanup reviewReviewed head: Source cleanup review at a640c35 against main e59374c: the reconnect lease/epoch fix and DisconnectByUserAsync removal path are not superseded. The local merge preview conflicts only in AppRefactorContractTests.cs. Preserve the new race tests while resolving that conflict, then provide current-head proof for deleting the active gateway with a queued reconnect; ordinary reconnect/disconnect evidence is not the same scenario. Current UI/CI Gate also needs resolution before landing. Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass. |
|
Hi @karkarl, I'm a Copilot triage agent (not Scott). I looked at this overnight and I'm leaving it open for a human, with notes so it is quick to pick up. I changed no labels and pushed nothing to the branch. What I checked
Why I did not merge
Smaller notes from the same reviews:
Still open from roboclaw-bot: current-head proof for deleting the active gateway with a queued reconnect. The Connection tests cover the manager side, and the page side only has a source-contract test. I did not run that scenario in the app. The PR also shows as conflicting with Happy to help if useful. |
|
Refreshing this branch with current main ( |
Preserve transactional saved-Gateway removal and pin user-disconnect intent and teardown to the removed owner. Retain the queued reconnect attempt lease and current lifecycle owners. Co-authored-by: bkudiess <[email protected]>
|
Main refresh pushed to this original branch, without force-pushing or merging the PR.
Conflict choices:
Validation on this Linux host:
Not verified / blocked: current-head build, Shared/Tray/Connection suites, native active-row deletion with queued reconnect, exact held-queue runtime race, Release/native Gateway and full UI/compatibility proof. Earlier-head evidence in the preserved PR body is not evidence for this merge head. This update does not claim merge readiness. New head CI is running, not passed: Build and Test 43296810888, CodeQL 43296811237. No blind rerun or re-review request. PR body, attribution and draft state are unchanged; handing back with the active-work label removed. |
Co-authored-by: bkudiess <[email protected]>
The new timing-pattern guard on main rejects literal 2-6 s hang guards. Replace the four 5 s waits added by this PR with an OPENCLAW_TEST_GATEWAY_STEP_TIMEOUT_SECONDS step timeout. Co-authored-by: Copilot App <[email protected]>
Closes #2075. Related: #2071.
What Problem This Solves
Fixes: a queued automatic reconnect can revive a Gateway after setup cleanup, rollback, or disconnect has already torn it down.
User Impact
User impact: disconnected Gateways stay disconnected when teardown wins the transition queue; explicit reconnect remains available. Active saved-Gateway removal also records user intent before removing the record. No migration or new setting.
Why This Change Was Made
The reconnect now validates its originating attempt while holding the existing lifecycle lease and reuses the pinned reconnect body without taking the lock twice. Gateway-id, user-intent and cancellation checks remain intact.
Evidence
Four held-semaphore regressions failed on the baseline by creating a second client after disconnect; two current-attempt controls passed. After the fix, all six cases and three existing pinned-repair tests passed. A focused native source-wiring guard also passes. Separate isolated-app native disconnect and explicit reconnect checks passed against a synthetic Gateway. Independent rubber-duck review found no product defect; its removal-wiring coverage suggestion was addressed.
Shared Codex autoreview completed P0-P3 review of the exact committed candidate with full frozen manager, tests and caller context: two passes, zero findings, final
scoped-cleanstatus. The earlier dataset-role preparation refusal was resolved through the documented committed-source context route, without copying/renaming files or disabling safety checks.CI failed, not merge-ready: run 42462800715 tested head
a640c35dthrough merge commit661f67eb8103a153b596782955b9bc48b63f52e7. Core/tray and all three real WSL E2E jobs passed. The UI job aborted in a known reasoning-flyout crash family; latest-stable compatibility also stopped at an HTTP 504 archive download. No rerun or unrelated repair.Not verified / blocked: native Gateway package, live AI provider, Release runtime, native active-row deletion and complete UI/compatibility suites remain unverified. Hosted real WSL setup/recovery and safe node invocation results are recorded below; they are not the exact held-queue race proof.
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: active saved-row removal wiring changed. Native Connection disconnect/reconnect was inspected via Computer Use; no complete pool or active-row deletion claim.windows-wsl-gateway-e2e: operator recovery admission changed. Hosted WSL Latest setup/connect, revocation and network recovery jobs passed on the current-head merge; local shared runtimes were not mutated.Validation
.\build.ps1: passed, all five build targets and documentation gate.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --logger 'trx;LogFileName=shared-final.trx': passed 4876, failed 0, skipped 24 ordinary opt-in tests, total 4900.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --logger 'trx;LogFileName=tray-final.trx': passed 5295, failed 0, skipped 0.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --logger 'trx;LogFileName=connection-final.trx': passed 1752, failed 0, skipped 1 distinct-volume migration test, total 1753.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --filter 'FullyQualifiedName~ScheduledOperatorReconnect': baseline 4 failed, 2 passed, 0 skipped (intended second-client failures).dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --filter 'FullyQualifiedName~ScheduledOperatorReconnect|FullyQualifiedName~ReconnectIfCurrentAsync': passed 9/9, 0 skipped.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter 'FullyQualifiedName~ActiveSavedGatewayRemoval': passed 1/1, 0 skipped.git diff --check: passed.Hosted run 42462800715, attempt 1, is failure. WSL Latest jobs pin Gateway
2026.11.1:FullSetup_SafeNodeInvocation_RoutesThroughRealGateway; skipped cases do not prove MXC or AI/provider behavior.RealGateway_DeviceRemoval_RecoversThroughSharedTokenReconnect).GatewayStopAndStart_TrayLeavesReadyThenRecovers,RepeatedGatewayRestart_TrayAndNodeRecoverEachTime).ReasoningPicker_ReflectsInheritedDefaultWithoutOverridingExplicitChoices(current: "", expectedStop: 3, usesDefault: True)incomplete; last marker ischat-proof: body start, no teardown. This standaloneProofProvider/Reactor harness constructs no connection manager and exercises no reconnect/removal. The pre-existing reasoning-picker crash backlog records pristine-head and independent-run crashes in this family. Classified unrelated to this delta; native crash address/root cause remains unknown.Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $archivereturned504 Gateway Time-out. The workflow/download path is unchanged; this is acquisition infrastructure failure, not a compatibility result. Separate fixture TRX passed 81/81 UI and 38/38 profile-app; FunctionalUI 19/19; accessibility 21 passed/13 NotExecuted.No blind rerun, baseline weakening or unrelated repair was performed. CI Gate failure aggregates the UI job; it is not a separate product failure.
Real Behavior Proof
a640c35de15432a6f56ec8449fd94b764ba680b5. Checks ran before commit on the identical source delta above baselinee70292487958be9e70170e2f3affe7afc42056e8; production files were unchanged from build through live checks. No post-commit runtime rerun claimed..\scripts\run-gateway-fixture.ps1 -AppPath '.\src\OpenClaw.Tray.WinUI\bin\Debug\net10.0-windows10.0.22621.0\win-x64\OpenClaw.Tray.WinUI.exe' -ArtifactsDirectory '<session artifacts>\live-debug' -DurationSeconds 600. Discover with current-buildwinnode.exe --mcp-url http://127.0.0.1:61775/ --list-tools, then invoke--command app.connection.status --params '{}'using the printed isolated profile. Native route: Owner > Connection Status > Open Connection > Disconnect toggle, then saved Gateway Connect.{"operator":"Idle","mcpRunning":true,"pendingActions":0}. After explicit reconnect:{"operator":"Connected","protocol":4,"mcpRunning":true}; active Gateway id unchanged.Yes/No/N/A): N/A. Copied UI/MCP diagnostics; no screenshot or public artifact link claimed.refusing to include unsafe --dataset: src\OpenClaw.Connection\BootstrapTokenLifecycle.cs (sensitive filename); resolved with documented branch--source-context-filefor exact frozen tracked source. An initial branch report lacked unchanged manager internals; a complete-context two-pass assessment closed that gap, returned zero P0-P3 findings, and passed final source verification. Separate Copilot rubber-duck model identity was not surfaced. Only task-owned fixture PIDs were stopped; listeners were verified absent.Security Impact
Yes/No): NoYes/No): NoYes/No): No. Existing reconnect is suppressed for stale attempts.Yes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations
Declared runtime proof limits and the failed hosted UI/compatibility job require maintainer judgment; not merge-ready. No merge performed.