You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stop queued operator reconnects from reviving a disconnected gateway #2075
P2Normal priority bug or improvement with limited blast radius.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.leverLever delivery tracking issue
GatewayConnectionManager.ScheduleOperatorReconnectAsync (~3351) checks IsCurrentLifecycle(request.Attempt) without holding _transitionSemaphore. It then calls ReconnectIfCurrentAsync, which checks only the user-disconnect intent and the active gateway id.
A plain DisconnectAsync does not change either of those. Plain disconnects are used for:
the setup connector timeout cleanup (ConnectionManagerOperatorConnector ~111/162)
Summary
Current main still permits a queued operator reconnect to outlive a plain disconnect; this collaborator-authored issue also remains part of an open coordinated audit.
Reproducibility: Source establishes the interleaving: hold the transition semaphore, queue plain DisconnectAsync, let a scheduled reconnect pass its generation check and wait behind the disconnect, then release the semaphore; the disconnect advances the generation but the subsequent reconnect accepts unchanged gateway ID and intent.
Next step
Within the coordinated audit, establish the queued-disconnect regression, validate the attempt under the reconnect lease, and use user-disconnect intent for active-gateway removal.
Review details
Best possible solution:
Reject stale reconnect requests under one semaphore hold and make active-gateway removal record disconnected intent.
Do we have a high-confidence way to reproduce the issue?
Source establishes the interleaving: hold the transition semaphore, queue plain DisconnectAsync, let a scheduled reconnect pass its generation check and wait behind the disconnect, then release the semaphore; the disconnect advances the generation but the subsequent reconnect accepts unchanged gateway ID and intent.
Is this the best way to solve the issue?
The proposed lease is the appropriate existing seam, provided the reconnect executes under that lease through core logic rather than calling ReconnectIfCurrentAsync and deadlocking on semaphore reacquisition; preserve pinned-gateway, cancellation, and user-intent checks.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
The precise interleaving is established from source but still needs a deterministic failing regression; no runtime reproduction or tests were run during this read-only review.
Codex review notes: model internal, reasoning medium; reviewed against e70292487958.
Label changes
Label changes:
add P2: A narrow asynchronous ordering race can undo connection teardown, with no evidence of a widespread outage or unrecoverable onboarding failure.
add impact:other: Connection lifecycle correctness: a retired operator attempt can unexpectedly reopen a gateway connection.
add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
add clawsweeper:source-repro: Current issue advisory state selects this label.
Label justifications:
P2: A narrow asynchronous ordering race can undo connection teardown, with no evidence of a widespread outage or unrecoverable onboarding failure.
impact:other: Connection lifecycle correctness: a retired operator attempt can unexpectedly reopen a gateway connection.
Evidence reviewed
What I checked:
Current default branch verified: The checkout and GitHub main both resolve to e702924; the working tree remained clean. (e70292487958)
Generation validation precedes serialization: ScheduleOperatorReconnectAsync checks the request's lifecycle before calling ReconnectIfCurrentAsync, which waits for the semaphore without carrying the expected generation. (src/OpenClaw.Connection/GatewayConnectionManager.cs:3358, e70292487958)
Plain disconnect does not block the queued reconnect: DisconnectCoreAsync increments the generation, but plain DisconnectAsync leaves user intent and the registry's active gateway unchanged; ReconnectIfCurrentAsync checks those latter conditions rather than the request generation. (src/OpenClaw.Connection/GatewayConnectionManager.cs:1130, e70292487958)
Production teardown callers confirmed: Setup timeout cleanup calls plain DisconnectAsync at lines 111 and 162, direct-connect rollback does so at line 203, and active-gateway removal does so before registry mutation. (src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs:2667, e70292487958)
Existing coverage does not force this ordering: The manager tests cover active-gateway checks, ordinary reconnects, and user-disconnect intent; the examined cases do not queue a stamped reconnect behind a plain disconnect while holding the transition semaphore. (tests/OpenClaw.Connection.Tests/GatewayConnectionManagerTests.cs:4607, e70292487958)
Recorded ownership boundary: The architecture ledger assigns bootstrap timing to BootstrapTokenLifecycle and lifecycle/reconnect ports to the manager; the repair should preserve that split. (docs/ARCHITECTURE.md:1042, e70292487958)
How this review workflow works
ClawSweeper keeps one durable marker-backed review comment per issue or PR.
Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
Maintainers can also comment @clawsweeper review to request a fresh review only.
Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Reviewed November 8, 2026, 1:29 AM ET / 06:29 UTC.
P2Normal priority bug or improvement with limited blast radius.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.leverLever delivery tracking issue
Activity
clawsweeper commentedon Nov 8, 2026
Codex review: this still needs some work.
Summary
Current main still permits a queued operator reconnect to outlive a plain disconnect; this collaborator-authored issue also remains part of an open coordinated audit.
Reproducibility: Source establishes the interleaving: hold the transition semaphore, queue plain DisconnectAsync, let a scheduled reconnect pass its generation check and wait behind the disconnect, then release the semaphore; the disconnect advances the generation but the subsequent reconnect accepts unchanged gateway ID and intent.
Next step
Within the coordinated audit, establish the queued-disconnect regression, validate the attempt under the reconnect lease, and use user-disconnect intent for active-gateway removal.
Review details
Best possible solution:
Reject stale reconnect requests under one semaphore hold and make active-gateway removal record disconnected intent.
Do we have a high-confidence way to reproduce the issue?
Source establishes the interleaving: hold the transition semaphore, queue plain DisconnectAsync, let a scheduled reconnect pass its generation check and wait behind the disconnect, then release the semaphore; the disconnect advances the generation but the subsequent reconnect accepts unchanged gateway ID and intent.
Is this the best way to solve the issue?
The proposed lease is the appropriate existing seam, provided the reconnect executes under that lease through core logic rather than calling ReconnectIfCurrentAsync and deadlocking on semaphore reacquisition; preserve pinned-gateway, cancellation, and user-intent checks.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against e70292487958.
Label changes
Label changes:
P2: A narrow asynchronous ordering race can undo connection teardown, with no evidence of a widespread outage or unrecoverable onboarding failure.impact:other: Connection lifecycle correctness: a retired operator attempt can unexpectedly reopen a gateway connection.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.Label justifications:
P2: A narrow asynchronous ordering race can undo connection teardown, with no evidence of a widespread outage or unrecoverable onboarding failure.impact:other: Connection lifecycle correctness: a retired operator attempt can unexpectedly reopen a gateway connection.Evidence reviewed
What I checked:
src/OpenClaw.Connection/GatewayConnectionManager.cs:3358, e70292487958)src/OpenClaw.Connection/GatewayConnectionManager.cs:1130, e70292487958)src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs:2667, e70292487958)tests/OpenClaw.Connection.Tests/GatewayConnectionManagerTests.cs:4607, e70292487958)docs/ARCHITECTURE.md:1042, e70292487958)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 8, 2026, 1:29 AM ET / 06:29 UTC.