fix(dashboard): drop a slot's buffered stream text on slot_clear - #6881
Conversation
A chat_chunk (or chat_thinking — same buffer entry) buffered just before a /clear lands would flush on the next animation frame and resurrect discarded transcript text into the just-cleared pane. slot_clear now deletes the slot's chunk-buffer entry alongside clearing the transcript. Keyed delete: other slots' in-flight buffers are untouched.
UX Review (Fable 5) — ✅ PASSUX-level review of This is a one-line race-condition fix in UX-Verdict: PASS Invisible-by-design fix: [UX-REVIEWED] e0ef425 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of The fix is a one-line keyed delete mirroring the existing Design-Verdict: PASS A narrow lifecycle fix in the right handler, mirroring the established [DESIGN-REVIEWED] e0ef425 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of No shell was available, so the author's gate claims (vitest run, tsc) can't be re-executed — but everything this lane owns was verified by reading: the First-Principles-Verdict: PASS A one-line keyed delete closing the last transcript-discard path that skipped the chunk buffer — every item traces to the reported defect. What this change shipsIntent: text discarded by
Verification I ran, since the counts are the substance of a PASS here:
[FIRST-PRINCIPLES-REVIEWED] e0ef425 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe change is a single, well-scoped one-line delete plus tests. The discovery pass found no candidates, and my inspection of the buffer machinery confirms the fix is correct (keyed delete closes the buffer-then-flush resurrection window; No findings. [OPUS-REVIEWED] e0ef425 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
NicholasRBowers
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: fix with clear root cause -- slot_clear now drops the slot's buffered stream text (keyed delete) so a chunk buffered before /clear cannot flush back into the cleared pane; frontend-only, plus a pinning test.
Problem
slot_clear(the/clearcommand) clears the transcript but leaves the slot's entry in the streaming chunk buffer (chunkBufRef). The buffer flushes once per animation frame, so achat_chunk— orchat_thinkingtext, which shares the same buffer entry since #6666 — that arrived just before the/clearlanded flushes on the NEXT frame and resurrects discarded text into the just-cleared pane.This gap predates recent work but was widened by it:
chat_thinkinginto the same buffer, so buffered reasoning text now shares the leak.Flagged as a non-blocking finding while reviewing #6666 (see the review comment there); this PR is the promised follow-up fix.
What changed
One line in the
slot_clearcase ofuseWebSocket.ts: delete the cleared slot's chunk-buffer entry alongside clearing the transcript. The delete is keyed — other slots' in-flight buffers are untouched. This mirrors whatchat_donealready does for a finished turn.Tests
New
useWebSocket.slotClearBuffer.test.ts(4 cases), driving real WS envelopes through hand-driven rAF frames:slot_cleardoes not flush back into the cleared transcript.chat_thinkingtext is discarded too (shared buffer entry).slot_clear(no stale prefix).Mutation-verified:
.clear()→ exactly test 3 red.Full gates:
tsc -bclean, eslint 0 errors on touched files, full vitest suite 26,049 passed on the rebased head.Why no screenshot: no visual delta — the fix prevents a transient race (discarded text flashing back after
/clear) that cannot be captured in a static frame; behavior is pinned by the four deterministic tests above.No linked issue — the defect was found during code review of #6666 and is fixed directly here.