Repository navigation
fix(tui): preserve shared prompts when scrollback is full - #115165
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 7:58 AM ET / 11:58 UTC. ClawSweeper reviewWhat this changesThe PR changes TUI chat-log pruning so a delayed prompt synchronized from another client remains beside its already-streaming assistant reply when a full scrollback evicts older entries. Merge readinessKeep open and clear the prior P2 concern: Likely related people: Priority: P2 Review scores
Verification
How this fits togetherThe TUI chat log receives local and Gateway-synchronized conversation events, keeps a bounded list of renderable components, and displays them in terminal order. This change applies only when an authoritative shared prompt must be inserted before an existing live assistant response. flowchart LR
A[Gateway or local chat event] --> B[TUI chat log]
B --> C[Find active assistant reply]
C --> D[Insert shared prompt before reply]
D --> E[Prune older unprotected entry]
E --> F[Bounded terminal scrollback]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +32. Total +35 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current Do we have a high-confidence way to reproduce the issue? Yes. The regression test gives a high-confidence source-level reproduction: fill the effective 20-component log, retain a streaming assistant, then deliver its delayed authoritative user prompt. Is this the best way to solve the issue? Yes. Protecting the inserted prompt and its owning active reply only during that insertion is the narrowest fix; the existing minimum effective capacity of 20 preserves the component-limit invariant. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 89b6d85cdd86. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where users sharing a TUI conversation with another client would lose that other client's delayed prompt once the terminal scrollback reached its component limit. The assistant response remained visible, making the synchronized conversation look as if it had no user message.
Why This Change Was Made
The new shared-chat synchronization inserts an authoritative prompt immediately before its already-streaming assistant. At full capacity, ordinary oldest-first eviction immediately removed that newly inserted prompt. Protect both the prompt and its owning assistant during that insertion only, and evict the oldest genuinely unprotected component instead. Keep all other chat-log pruning, run state, and component limits unchanged.
User Impact
Busy, long-running shared TUI sessions retain both the other client's prompt and its live assistant reply in the correct order, without duplicate prompts or unbounded scrollback.
Evidence
Fresh main, before fix:
Final regression on the reviewed patch:
Blacksmith Testbox tbx_01kym6yazh45w0wd8we3cfpe9p:
Additional live Gateway contract proof
The actual web and TUI websocket regression in src/gateway/session-message-events.test.ts also passes independently in all three configured Gateway projects on Blacksmith Testbox tbx_01kym6yazh45w0wd8we3cfpe9p. It connects real web and TUI subscribers to one authoritative transcript, persists turns from both clients, verifies matching session.message delivery, reconnects the TUI client, and verifies the complete chat.history result. This supplements the 61 passing full-screen terminal scenarios and proves that the owner-local scrollback fix does not change Gateway synchronization.