Skip to content

fix(terminal): bound shell history replay - #331

Merged
Ark0N merged 2 commits into
Ark0N:masterfrom
dignfei:fix/shell-history-performance
Aug 21, 2026
Merged

fix(terminal): bound shell history replay#331
Ark0N merged 2 commits into
Ark0N:masterfrom
dignfei:fix/shell-history-performance

Conversation

@dignfei

@dignfeidignfei commented Aug 21, 2026

Copy link
Copy Markdown

Summary

  • load a bounded 1 MiB tail when selecting Shell sessions, while keeping full scrollback available through the explicit Load full history action
  • prevent ordinary Shell wheel/touch scrolling from triggering a multi-megabyte reset and full xterm replay at the top of the bounded buffer
  • add server/client timing that separates tmux capture, response preparation, transfer/JSON, and xterm parse time
  • avoid duplicate Shell cache replay and fix long-buffer row scanning / replay completion races
  • apply tmux history limits correctly on both legacy tmux and tmux 3.7+ without globally trimming unrelated live panes

Measurements

  • tmux capture-pane: about 0.03s at 10k lines, 0.15-0.18s at 50k, and 0.31-0.36s at 100k
  • Chromium + project xterm replay: 1 MiB ~117ms parse, 8 MiB ~368ms, 32 MiB ~698ms; next paint opportunity averaged ~135ms, ~392ms, and ~717ms respectively

[TERMINAL-PERF] and Server-Timing now expose the same stages on real installations. The xterm metric ends at parser completion; it is not a direct GPU/compositor measurement.

Validation

  • targeted terminal/tmux tests for the original bounded-history change
  • frontend syntax and diff checks for the explicit Shell scroll guard
  • tsc --noEmit
  • ESLint, public-asset, formatting, and diff checks
  • production build

@Ark0N

Copy link
Copy Markdown
Owner

Thanks a lot for this one! Went through it in detail and the split is exactly right: shell selection starts from the bounded 1 MiB tail, full history stays behind the explicit button, and TUI sessions keep their one canonical full replay per page. The tmux version gating is a subtle problem handled well (global default set in the same command queue right before new-session on legacy tmux, per-pane targeting on 3.7+ so unrelated live panes never get resized or trimmed). Nice catch on scrollToLastNonEmptyLine double-counting baseY too, and the parse marker that releases the live-output gate while keeping later output ordered behind the snapshot is a clean solution.

Verified locally on top of master together with #327: full test gate green (5510 tests), typecheck/lint/format/frontend-syntax/public-assets, production build. The Server-Timing + [TERMINAL-PERF] stages will make the next scrollback investigation much less guesswork.

Merging, this ships in 1.20.1.

@Ark0N
Ark0N merged commit 12a996b into Ark0N:masterAug 21, 2026
2 checks passed
Sign up for freeto 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.

2 participants

@dignfei@Ark0N