Repository navigation
fix(chat): show user messages before replies when busy state is stale - #9757
Conversation
|
Intent: Make an immediately accepted dashboard send visible before assistant output, even when a stale busy snapshot prevented an optimistic user bubble. Reconcile the server echo with any existing local row by sendId so echo/receipt reordering does not create duplicates. |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Sound root-cause fix — the server now owns busy-send insertion — but an unrelated shutdown-test rewrite is bundled into this chat PR. Watch
Suggestions
[DESIGN-REVIEWED] c4a4f34 |
UX Review (Fable 5, fork) — 🟡 CONCERNSUX-level review of All evidence reviewed. The diff adds no new controls or strings — it changes when existing elements appear: the user bubble now shows above a streaming reply on a busy send, a false "Delivery not confirmed" notice is suppressed once a server echo confirms delivery, and a provisional Steer row demotes in place to an ordinary message. The demotion mechanism is verified continuous in the diff ( UX-Verdict: CONCERNS Sound behavioral fix — bubble appears above its reply, false retry warnings stop — but this fork lane cannot open the committed evidence or run a blind read. Evidence gaps
[UX-REVIEWED] c4a4f34 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of All verification done. The base already keeps First-Principles-Verdict: PASS One human check: #3898 item 2's What this change shipsInventory (10 items) — 9 justified, 1 declared riderIntent: a message sent while the dashboard wrongly thinks the conversation is busy must appear above the streaming reply, and a delivered send must not be restored or flagged after an HTTP timeout/reset — a FIX.
Counts run: [FIRST-PRINCIPLES-REVIEWED] c4a4f34 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsThe discovery pass produced no candidates, so Step 1 has nothing to falsify. My independent examination confirms the change is sound: the backend echo ( No findings. [OPUS-REVIEWED] c4a4f34 |
558b1a1 to
95fe998
Compare
|
self-added: yes fixed — Demoted Steer loses late-delivery correlation.
|
|
self-added: yes rebutted — Committed verification media.
|
|
self-added: yes kept — Capture script and recordings.
|
|
self-added: yes kept — Harness dist option.
|
|
self-added: yes acknowledged — The fork reviewer cannot fetch the visual proof.
|
|
Additional
Checked |
95fe998 to
b6dc668
Compare
|
self-added: yes fixed — Correlated prompt echo authorization.
|
A stale busy snapshot can suppress the optimistic user bubble even when the server starts a new turn. Echo correlated dashboard sends before the reply starts so the user message appears in event order. Use the existing per-client slot-authorized WebSocket path for raw user content. Reconcile echoes by sendId while preserving the row rendering identity. Keep the correlation so an HTTP timeout or connection reset cannot restore an already delivered send. HTTP receipts confirm existing rows without inserting duplicates after streaming or navigation. Cover delivery ordering, app scope isolation, interleaved steers and ambiguous HTTP failures, with controlled browser recordings. Synchronize the shutdown drain test on provider entry so it verifies cancellation independent of scheduling.
7be21cc to
c4a4f34
Compare
|
needs-a-decision — Bundled Windows test repair.
|
|
rebutted — Additional append broadcast mode.
|
|
needs-a-decision — Busy-send visual evidence access.
|
|
needs-a-decision — Steer-demotion visual evidence access.
|
|
rebutted — Additional false-notice recording.
|
|
Checked the original issue requested by First Principles: #3898, item 2 explicitly objected to keeping the wire correlation ID in durable message metadata. It proposed stripping it server-side or moving it to a request-only field. I found no additional reason or retention constraint in that issue's comments. #3963 implemented the strip in the frontend echo reconciler. The current base already keeps The original durable-metadata concern is real historical context, so it is not being dismissed as absent. Moving correlation outside persisted metadata would be a separate protocol/storage change; restoring the frontend-only deletion would break the delivery checks this fix requires. |
…kirodotdev#9757) A stale busy snapshot can suppress the optimistic user bubble even when the server starts a new turn. Echo correlated dashboard sends before the reply starts so the user message appears in event order. Use the existing per-client slot-authorized WebSocket path for raw user content. Reconcile echoes by sendId while preserving the row rendering identity. Keep the correlation so an HTTP timeout or connection reset cannot restore an already delivered send. HTTP receipts confirm existing rows without inserting duplicates after streaming or navigation. Cover delivery ordering, app scope isolation, interleaved steers and ambiguous HTTP failures, with controlled browser recordings. Synchronize the shutdown drain test on provider entry so it verifies cancellation independent of scheduling. Co-authored-by: Rui Tao <ruit@amazon.com>
Problem / Motivation
A message sent while the dashboard still considers a conversation busy can be missing until the assistant finishes replying. If a Steer starts a new turn, a later HTTP timeout can also restore the already-delivered text and display a false retry warning.
Why it matters
A successful send looks lost, and the streaming answer appears without its question. Restoring a confirmed message also invites an accidental duplicate send.
What changed (motivation → approach → change)
The busy composer can skip its optimistic user bubble. Immediate dashboard sends previously suppressed the server's user-message event because they assumed that bubble existed. WebSocket-mode sends carrying
sendIdnow publish the persisted user row before starting the reply, through the canonical serializer and the existing per-client slot-authorized WebSocket broadcaster. Raw prompts stay off the unfiltered global SSE queues; ordinary SSE and relay sends preserve their stream contract.The event inserts the missing row or reconciles an existing one by exact
sendId, including across a newer, unrelated Steer. Reconciliation preserves render identity and demotes a provisional Steer when the server starts an ordinary turn. RetainingsendIdlets both composers recognize confirmed delivery after an HTTP timeout or connection reset. HTTP receipts confirm existing rows without inserting a skipped bubble late. Queued sends, actual steers and uncorrelated sends retain their existing event paths. The owning dashboard specification is updated.flowchart LR subgraph Before direction TB B1[Busy snapshot skips bubble]:::ctx --> B2[Reply starts without user echo]:::removed --> B3[Completion refresh reveals message]:::removed end subgraph After direction TB A1[Busy snapshot skips bubble]:::ctx --> A2[User echo inserts or confirms bubble]:::added --> A3[Reply appears below the message]:::changed end Before ~~~ After classDef added fill:#DCFCE7,stroke:#16A34A classDef changed fill:#FEF3C7,stroke:#D97706 classDef removed fill:#FEE2E2,stroke:#DC2626,stroke-dasharray:4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7 linkStyle 0,1 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 2,3 stroke:#16A34A,stroke-width:2px🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
Tests
sendIdmust not confirm a send.CancelledErrorfails withDID NOT RAISE TimeoutError. Windows shard 3 with the repair and the other three Windows shards passed.steer_pushpath owns the confirmed row.Local full-suite validation at
0e8459279, basef1cc1b736:Local baseline exception: forty backend failures match host/tooling failures previously reproduced on clean base
7b2a16041and the feature. Two additional full-run failures (test_reset_with_pid_survives_shutdown_force_killsandtest_a_failed_temp_lockdown_leaves_no_temp_and_no_leak) pass on cleanf1cc1b736; all six tests pass when the four new scope cases run immediately before them in one worker. No fixture leak was reproduced. The local full-backend gate remains non-green on this host.Full GitHub CI on
7be21cc8passed: all four Linux and four Windows backend shards, all four frontend shards, backend/frontend lint and types, Electron, offline E2E, and the coverage combine/gate. Build workflows also passed. Linux shard 4, which had previously hit the job limit after a worker crash, passed in this run. No timeout, worker-restart or coverage setting was relaxed.Current revision
c4a4f3464is one commit on base10bdc51fe. The cleanup preserves the executable application change verified by the full CI run above: Python AST and comment-free TypeScript output for the modified application files are unchanged. Local verification passes 32 backend regressions and 346 frontend tests, plus types, formatting, documentation and duplication checks. After syncing the two upstream registry/Slack changes, 381 related backend tests pass with 5 skips. The ordinary-send parameter removed from one new backend test remains covered by the real authorization/stream tests; the idle-Steer metadata/ordering case is retained. A focused independent review reports no findings. Current-head CI results are shown in the PR checks.Manual verification
Recorded and inspected the built dashboard with a local Playwright generator. It drives mouse/keyboard actions with synthetic text and controlled transport, holding HTTP receipts while the reply streams. The recording generator and its shared-helper extension are excluded from this PR; the media remain committed as required by the PR template. The recordings still represent this revision because the cleanup does not change the emitted application behavior.
The before/after pair sends through the busy composer's Queue option while the backend contract accepts an immediate turn. Assertions find zero user bubbles during streaming under the old event contract, and exactly one above the reply under the fixed contract. Both runs finish with one bubble.
The Steer recording starts with a visible pending
Steering…row, then delivers an ordinary server echo for that same send. The pending badge disappears, the message remains above the reply, and both the user-row DOM node and its inner message-bubble node are preserved. Exactly one user row remains after completion. Backend tests separately verify real handler ordering and authorization. No live model or user session is involved.Screenshots / video
Before recording · After recording · Steer becoming an ordinary message
Steer transition stills (the recording above shows continuity)
Related Issues
no linked issue: reported during local dashboard use. Includes the merged send/Steer refactor in #8689.
Pattern harvest
Rule candidate: review-prompt
Pattern: A missing optimistic row needs an ordered server echo with per-recipient authorization. A shared serializer is not an authorization boundary. Correlation must survive asynchronous delivery decisions; receipts must not independently insert duplicates.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement