Repository navigation
fix(chat): reconnect deletes queued messages that were never sent - #1669
Conversation
Reconnect cleared every queued message, including ones the gateway had not accepted. History cannot restore those, so the text was gone. Keep those messages and mark them failed. A message that was already failed stays failed with its original error. Requests for kept messages stay. Run mappings and local echoes still clear. ChatQueueReconnectTests passed. The provider reconnect test now expects the pending text to remain as failed. ./build.ps1 exit 0. Shared 4262 passed, 33 skipped. Tray 3991 passed. Signed-off-by: Sebastien Tardif <[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 changesThe PR preserves queued chat messages across reconnects as failed cards without automatically resending them. Example: Queue queued-1669-r behind an active turn, then stop and restart the gateway.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for landing: current main still deletes unsent queued text on reconnect, and this focused repair has current-head live proof with no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherNative chat passes outgoing requests through ChatConversationState and ChatQueueState; connection transitions update queue state, which is projected into visible chat cards. flowchart TD
A[Chat composer] --> B[ChatConversationState]
B --> C[ChatQueueState]
D[Gateway connection status] --> B
C --> E[Chat snapshot]
E --> F[Chat timeline cards]
Technical reviewBest possible solution: Land the focused queue-state repair while preserving generation checks, correlation cleanup, and manual control over resending. Do we have a high-confidence way to reproduce the issue? Current-main source unconditionally clears queued messages on reconnect, and the existing provider test demonstrates a pending message reaching that path; this review did not execute a reproduction. Is this the best way to solve the issue? The repair addresses deletion in the existing queue owner and retains failed cards without making them eligible for automatic dispatch. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2f383318b5b9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes: No label 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 HistoryReview history (3 earlier review cycles)Reviewed October 14, 2026, 9:23 PM ET / October 15, 2026, 01:23 UTC (Revision 4). |
|
Global triage: NEEDS_HUMAN_TEST. Take confidence 55%; recommendation confidence 97%; effort small; risk medium. Reviewed exact head Maintainer or proof-pool owner: run every declared Windows proof pool at this exact head and replace blocked or historical evidence with current-head results. This is a triage classification, not a merge action. No branch changes were made. |
Preserve only definitely unsent queued messages, localize the failure text, and cover stale completion plus post-reconnect drain behavior. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 056d2209-1ac9-4a0c-8be9-2f7086b908d6
Exercise a held chat send through the isolated fixture gateway, reconnect the real app, and verify the definitely unsent queued card remains failed and is not resent. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 056d2209-1ac9-4a0c-8be9-2f7086b908d6
What Problem This Solves
Fixes: reconnect deletes queued messages that the gateway never accepted.
User Impact
User impact: a message queued behind an active turn stays visible after reconnect as failed, so its text is not lost. It is not sent again automatically.
Why This Change Was Made
Reconnect previously cleared every queued message. The updated queue reset preserves only messages still in the
Queuedstate, marks them failed, clears retry scheduling metadata, and drops ambiguousSendingentries because the gateway may already have accepted them.Evidence
Current head
37d77d7889c20cc10522ac308a3737076f7fb01aincludes currentmainand a real isolated WinUI regression test using the repository fixture gateway.The proof holds the first
chat.send, queuesqueued-1669-current-headbehind it, closes the gateway connection, reconnects the app, and verifies:Failedand a Remove action;The connection dropped before the gateway accepted this message.;chat.sendreached the fixture, so the queued message was not automatically resent;Before reconnect
After reconnect
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: the isolated native app used the repository fixture gateway to show the queued card before reconnect and the same failed card after reconnect.Validation
.\build.ps1: passed. Shared, CLI, WinNode CLI, SetupEngine, and WinUI built successfully.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 4310 passed, 36 skipped, 0 failed.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed, 4009 passed, 0 skipped, 0 failed.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter "FullyQualifiedName~ChatQueueReconnectTests|FullyQualifiedName~Status_ReconnectKeepsUnsentQueuedMessagesAsFailed|FullyQualifiedName~ChatComposerViewModelTests": passed, 37 passed, 0 failed.dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-arm64 -p:Platform=ARM64 -p:DevBuild=false --no-restore --filter "FullyQualifiedName~ReconnectKeepsDefinitelyUnsentQueuedMessageFailedAndVisible": passed, 1 passed, 0 failed.Real Behavior Proof
37d77d7889c20cc10522ac308a3737076f7fb01a.GatewayFixtureUiTests.ReconnectKeepsDefinitelyUnsentQueuedMessageFailedAndVisiblewith screenshot capture enabled. The fixture held the first send, admitted a second message into the native queue, closed the connection, then accepted the automatic reconnect.queued-1669-current-headchanged fromQueuedtoFailed, retained the same queue id, displayed the localized failure text and Remove action, and fixture request records contained exactly onechat.send.Security Impact
Yes, explain the risk and mitigation: N/ACompatibility and Migration
Review Conversations