Repository navigation
fix(ui): reconnect-uncertain sends stay inline and prove delivery by run id - #131171
Conversation
…run id After a reconnect lost the chat.send ack, the outbox reconcile only accepted the transcript idempotency marker as delivery proof, so a send whose run was actively streaming parked as a red 'Delivery uncertain' composer chip for the whole run. The reconcile now also retires a queued send when the session row reports its run id in activeRunIds or as lastRunId — the same fact live terminal-event retirement already trusts. Attempted unconfirmed messages now stay in the conversation as ordinary bubbles with an amber 'Delivery unconfirmed · Retry' footer (failed keeps the red 'Not sent'); the duplicate pane banner is suppressed for them since the bubble owns the outcome. Command chips, never-attempted failures, and storage errors keep their existing surfaces. Calmer copy for the remaining honest uncertainty case.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Before/after from the mock-gateway e2e harness (sanitized, same ACK-lost reconnect flow). Before — message trapped in a red "Delivery uncertain" composer chip (not in the conversation), plus a duplicate red top-bar banner, even when the send was delivered: After (genuine uncertainty) — the message stays in the conversation as an ordinary bubble with an amber "Delivery unconfirmed · Retry" footer; no chip, no banner: After (delivery proven by run id) — the bubble is clean, run streams; no error surface at any point: |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 4:33 PM ET / 20:33 UTC. ClawSweeper reviewWhat this changesThe Control UI now treats a matching active or last Gateway run ID as delivery proof after reconnect and renders unresolved attempted sends inline with an amber retry footer. Merge readinessKeep open. This maintainer-authored PR has a coherent, source-backed repair for a real reconnect race; current main still relies only on a persisted transcript marker, so the work remains necessary. Priority: P1 Review scores
Verification
Live VerificationEntry: Result: FAIL (partial) — step 2 Steps:
How this fits togetherThe Control UI stores attempted sends in its outbox while a browser reconnects to the Gateway. It reconciles those entries against Gateway history and session lifecycle data, then either retains a visible retryable message or hands it off to the transcript. flowchart LR
A[Operator sends message] --> B[Control UI outbox]
B --> C[Gateway chat send]
C --> D[Session run lifecycle]
D --> E[Reconnect reconciliation]
E --> F[Transcript or inline retry footer]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +42, Tests +212, Docs +6. Total +260 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the exact Gateway client-run-ID proof and canonical inline pending-send renderer, with the focused reconnect regressions retained as their owner-boundary guard. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current main removes an attempted send only after finding its transcript marker, while the Gateway already exposes the matching active or terminal client run ID. Is this the best way to solve the issue? Yes. The patch reuses the Gateway’s exact client-run identity and the existing inline pending-send renderer rather than introducing a second delivery mechanism, setting, or compatibility path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d56e2c42c934. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Addressing the review checklist before landing:
|
|
Merged via squash.
|
…run id (openclaw#131171) After a reconnect lost the chat.send ack, the outbox reconcile only accepted the transcript idempotency marker as delivery proof, so a send whose run was actively streaming parked as a red 'Delivery uncertain' composer chip for the whole run. The reconcile now also retires a queued send when the session row reports its run id in activeRunIds or as lastRunId — the same fact live terminal-event retirement already trusts. Attempted unconfirmed messages now stay in the conversation as ordinary bubbles with an amber 'Delivery unconfirmed · Retry' footer (failed keeps the red 'Not sent'); the duplicate pane banner is suppressed for them since the bubble owns the outcome. Command chips, never-attempted failures, and storage errors keep their existing surfaces. Calmer copy for the remaining honest uncertainty case.



What Problem This Solves
Fixes an issue where a Control UI operator whose WebSocket reconnected while a
chat.sendwas in flight would see a red "Delivery uncertain" error chip in the composer — and keep seeing it for the entire run — even though the message was delivered and the agent was visibly replying. The message also vanished from the conversation into the composer chip area, plus a duplicate red top-bar banner.Why This Change Was Made
Two root causes:
sessionInfo.activeRunIds, or aslastRunIdafter completion) was never consulted, even though live terminal-event retirement (removeDeliveredQueuedChatSendForRun) already trusts exactly that identity (gateway chat runs use the client idempotency key as run id,src/gateway/server-methods/chat-send-session.ts:41). So a send admitted during the reconnect race parked as "unconfirmed" and stayed red until the run ended.failedsends render as a normal conversation bubble with a quiet "· Not sent · Retry" footer.unconfirmedwas the one attempted state excluded from that path, falling back to a red composer chip styled like a hard failure.The reconcile now retires a queued send when the session row proves its run (active or last), and
unconfirmedjoins the inline bubble path: the message stays in the conversation as an ordinary bubble, and only genuine, concluded uncertainty gets an amber "Delivery unconfirmed · Retry" footer (tooltip carries the calmer diagnostic). The duplicate pane banner is suppressed for parked attempted messages since the bubble owns the outcome; hidden sessions still get the named toast, and local-command chips, never-attempted failures, and storage errors keep their existing surfaces.User Impact
Evidence
pnpm test ui/src/pages/chat/chat-send.test.ts -t 'retires a reconnect send proved by'fails 2/2 on pre-fix code (active-run case stayswaiting-reconnect, completed-run case staysunconfirmed); both pass post-fix.pnpm test ui/src/pages/chat/chat-send.test.ts— 284 passed (new regressions: active-run proof, last-run proof, unrelated-run still parks, banner suppressed for parked bubbles).pnpm test ui/src/e2e/chat-flow.history-recovery.e2e.test.ts— 7 passed (real UI + mock-gateway WebSocket reconnect: ACK-lost park, same-key Retry, uncertainty surviving unrelated history, single authoritative bubble after proof).chat-thread,chat-composer-queue,chat-message,chat-responsive.browserincl. Chromium layout/theme color assertions) — 516 passed; fullpnpm test ui/src/pages/chat— 11,174 passed.pnpm check:changedgreen (typecheck, lint, styles, i18n catalog);pnpm ui:i18n:baselinebyte-identical.