Repository navigation
Closed
Labels
P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateThis issue is about session, memory, transcript, context, or agent state drift.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.leverLever delivery tracking issueno-staleExempts this issue from stale automation.
Description
Lane 1 of 5 for #2071. Filed by a Copilot agent.
Problem:
WebSocketClientBase.ListenForMessagesAsynccallsOnDisconnectedonly on a Close frame, a premature close, or a keepalive OCE. It skips it in two cases:- a client-initiated abort (
AbortCurrentWebSocket, for example from a bad chat stream), which is filtered by_clientAbortedGeneration - the oversized-message
CloseAsync(MessageTooBig)+breakpath
- a client-initiated abort (
- In both cases it goes straight to
ReconnectWithBackoffAsync, soOpenClawGatewayClient.OnDisconnectednever runs. In-flight requests (chat send, etc.) wait for their full timeout instead of failing fast withGatewayConnectionLostException, and the handshake snapshot,MainSessionKeyand advertised methods stay stale until the next connect. OnError(OpenClawGatewayClient.cs ~415) only drains pending requests.CheckHealthAsync(~636-664) callsReconnectWithBackoffAsync()with no owner. A(null, 0)owner always passesIsReconnectOwnerLocked, so after the delay the loop can dispose a socket the manager has just connected.
Fix:
- Report the connection loss exactly once per current connection on every listen-loop exit, using one invalidate path shared by
OnError. - Pass the current socket and generation as the owner from
CheckHealthAsync.
Coordinate with: #1574, which concerns the same reconnect loop.
Done when: a WebSocketClientBaseTests regression test shows OnDisconnected runs after AbortCurrentWebSocket and after an oversized message, and the required validation passes.
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateThis issue is about session, memory, transcript, context, or agent state drift.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.leverLever delivery tracking issueno-staleExempts this issue from stale automation.
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsBacklog
Activity
clawsweeper commentedon Nov 8, 2026
Codex review: this still needs some work.
Summary
Keep this issue open: current main still skips disconnect cleanup on the reported paths and permits health retries to replace a newer connection; collaborator authorship also prevents automatic closure.
Reproducibility: Current source establishes both skipped cleanup paths and the unowned health retry; existing loopback fixtures can exercise them, but no tests or live reproduction ran during this read-only review.
Next step
Fix generation-bound loss cleanup and health-retry ownership after establishing failing regressions for abort, oversized input, error invalidation and superseded retries.
Review details
Best possible solution:
Use one generation-fenced loss cleanup path and capture health-retry ownership before any asynchronous work.
Do we have a high-confidence way to reproduce the issue?
Current source establishes both skipped cleanup paths and the unowned health retry; existing loopback fixtures can exercise them, but no tests or live reproduction ran during this read-only review.
Is this the best way to solve the issue?
The proposed cleanup and ownership repair fits the existing contracts, provided it preserves request-specific exceptions, stale-generation isolation and terminal retry policies.
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: Current source establishes bounded disconnect and retry defects without evidence of a widespread outage or blocked first-use flow.impact:session-state: Handshake identity, canonical session key and advertised capabilities remain stale after affected transport losses.impact:ux-friction: Pending chat sends can wait for their 30-second timeout, and stale health retries can interrupt a recovered connection.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: Current source establishes bounded disconnect and retry defects without evidence of a widespread outage or blocked first-use flow.impact:session-state: Handshake identity, canonical session key and advertised capabilities remain stale after affected transport losses.impact:ux-friction: Pending chat sends can wait for their 30-second timeout, and stale health retries can interrupt a recovered connection.Evidence reviewed
Acceptance criteria:
WebSocketClientBaseTests|FullyQualifiedNameWebSocketInboundLimitTests|FullyQualifiedNameOpenClawGatewayClientTests|FullyQualifiedNamePendingRequestRegistryTests'What I checked:
src/OpenClaw.Shared/WebSocketClientBase.cs:551, e70292487958)src/OpenClaw.Shared/OpenClawGatewayClient.cs:381, e70292487958)src/OpenClaw.Shared/OpenClawGatewayClient.cs:640, e70292487958)tests/OpenClaw.Shared.Tests/WebSocketClientBaseTests.cs:293, e70292487958)src/OpenClaw.Shared/PendingRequestRegistry.cs:270, 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.