Repository navigation
Description
Priority: P2. Reproduced at commit 6c7a6fbe on 2026-09-05.
TerminalPane can append the same output multiple times when a read takes longer than its 250 ms polling interval. This makes test/log output unreliable even when replies arrive in order.
Reproduction
- Mount the actual TerminalPane with a running session and cursor 0.
- Fire two 250 ms polling ticks before resolving the first read.
- Both read requests carry since=0.
- Return the first snapshot as text="first\n", cursor=6, reset=false.
- Return the second as text="first\nsecond\n", cursor=13, reset=false.
- The pane renders "first\nfirst\nsecond\n", although the shell produced each line once.
The audit drives the real polling callback deterministically and uses fake transport replies matching electron/terminal.js toState's delta contract. This models read latency over 250 ms; no response reordering is needed.
Cause
src/components/TerminalPane.tsx:85 uses setInterval without an in-flight guard. Each request reads cursorRef before the previous reply advances it. applyState always appends state.text for reset=false; it does not reconcile overlapping cursor ranges. Command writes also return deltas and share this consumer, so read/write overlap should be covered by the fix.
Acceptance
- Each output byte/line appears once when reads overlap or read/write replies overlap.
- Cursor never regresses when an older reply arrives.
- Preserve reset handling and trimmed-buffer recovery.
- Add delayed-reply coverage alongside the existing sequential cursor tests.
Related #147 introduced the terminal; this is a concrete delta-consumption bug.
Sources: TerminalPane polling, delta contract.
Runnable audit evidence
Local artifact: docs/issue-drafts/2026-09-05-actions-reproduce.mjs.
node --import=./test/support/disable-grok-mcp.mjs --import=./test/support/render.mjs --experimental-strip-types docs/issue-drafts/2026-09-05-actions-reproduce.mjsExited 0 with three CONFIRMED assertions against actual app modules. The assertions demonstrate existing defects, not implemented fixes. Artifact currently exists in the audit checkout; the reproduction above stands alone.
Requested disposition: separate Planboard issue, plan:todo.
Activity
currentbits commentedon Sep 10, 2026
Landed from Solenta thread "Overlapping terminal reads duplicate scrollback on slow conn". Closed on merge.