Skip to content

Fix duplicated streaming frames on terminals without in-place redraw - #175

Merged
chauncygu merged 1 commit into
mainfrom
fix-stream-render
Jul 20, 2026
Merged

Fix duplicated streaming frames on terminals without in-place redraw#175
chauncygu merged 1 commit into
mainfrom
fix-stream-render

Conversation

@chauncygu

Copy link
Copy Markdown
Contributor

auto_stream_mode fell back to 'live' (in-place cursor-up redraw) for any unrecognized terminal; where that erase does not take effect (tmux/screen, plain xterm, unknown PTYs) every frame appended instead of overwriting, reprinting the response's first line hundreds of times.

  • Allowlist the risky 'live' tier: only positively-recognized capable emulators get it; everything else fails safe to append-only 'commit' (issues no cursor movement, so it can never duplicate frames).
  • Force 'commit' under tmux/screen even on a capable outer terminal.
  • Default module _STREAM_MODE to 'commit' so entry points that never call set_stream_mode stay safe too. 'live' remains available via config.
  • Update/extend tests; full suite green (2574 passed).

auto_stream_mode fell back to 'live' (in-place cursor-up redraw) for any
unrecognized terminal; where that erase does not take effect (tmux/screen,
plain xterm, unknown PTYs) every frame appended instead of overwriting,
reprinting the response's first line hundreds of times.

- Allowlist the risky 'live' tier: only positively-recognized capable
  emulators get it; everything else fails safe to append-only 'commit'
  (issues no cursor movement, so it can never duplicate frames).
- Force 'commit' under tmux/screen even on a capable outer terminal.
- Default module _STREAM_MODE to 'commit' so entry points that never call
  set_stream_mode stay safe too. 'live' remains available via config.
- Update/extend tests; full suite green (2574 passed).
@chauncygu
chauncygu merged commit 4f1fa95 into main Jul 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant