Skip to content

Raise terminal history/scrollback/buffer defaults (50k→100k, 2MB→32MB)#138

Merged
Ark0N merged 2 commits into
Ark0N:masterfrom
aakhter:cod-80-raise-terminal-defaults
Jul 12, 2026
Merged

Raise terminal history/scrollback/buffer defaults (50k→100k, 2MB→32MB)#138
Ark0N merged 2 commits into
Ark0N:masterfrom
aakhter:cod-80-raise-terminal-defaults

Conversation

@aakhter

@aakhter aakhter commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Raises the centralized terminal-history defaults introduced in #137:

value before (#137) this PR
tmux history-limit 50,000 100,000
terminal scrollback lines 50,000 100,000
PTY buffer max 2 MB 32 MB
PTY buffer trim 1.5 MB 24 MB

All values remain env- and settings-overridable (CODEMAN_MAX_TERMINAL_BUFFER / CODEMAN_TRIM_TERMINAL_TO) and bounds-clamped via resolveTerminalHistoryConfig().

Why split from #137

#137 introduced the config mechanism with no behavior change (defaults kept at the prior hardcoded values), so the plumbing could be reviewed on its own. This PR is the follow-up policy change: larger defaults so a full default scrollback is retained and replayable. Keeping them separate lets the larger memory budget be weighed independently.

Trade-off

Worst-case terminal-buffer budget for 20 concurrent sessions rises 40 MB → 640 MB (comment updated to match). Operators who want the smaller footprint can set CODEMAN_MAX_TERMINAL_BUFFER / CODEMAN_TRIM_TERMINAL_TO.

Tests

test/terminal-history.test.ts updated to assert the raised defaults; tsc --noEmit, the terminal-history + schema tests, and npm run build all pass.

aakhter and others added 2 commits July 1, 2026 13:00
Bump the centralized terminal-history defaults: tmux scrollback 50k->100k and
PTY buffer cap 2MB->32MB (trim 1.5MB->24MB). Both remain env/settings overridable
and bounds-clamped. Worst-case 20-session buffer budget rises 40MB->640MB.
Stacked on the terminal-history config commit.
… raise (PR Ark0N#138)

- UNBOUNDED-MEMORY: DEFAULT_TERMINAL_BUFFER_TRIM_BYTES from CODEMAN_TRIM_TERMINAL_TO
  had no relation to DEFAULT_TERMINAL_BUFFER_MAX_BYTES — setting only
  CODEMAN_MAX_TERMINAL_BUFFER=2097152 left the 24MB trim default in force, making
  BufferAccumulator.trim() (slice(-trimSize)) a no-op: unbounded growth past the cap
  plus a full string re-join on every append (O(n²)). Trim default is now clamped to
  75% of the resolved max (the 24MB/32MB default ratio, preserved as hysteresis);
  regression test re-evaluates the module under the env via vi.resetModules.
- OVERCLAIM: reverted DEFAULT_TERMINAL_SCROLLBACK_LINES 100k -> 50k — it has zero
  consumers; browser xterm scrollback is the separate hardcoded DEFAULT_SCROLLBACK
  (50k) in constants.js and deliberately stays 50k (mobile-memory hazard). The tmux
  history-limit raise (50k -> 100k) and PTY 32MB/24MB raise remain (those are wired).
  Module docstring now claims only what is wired; fixed the stale tmux-manager.ts
  comment saying the tmux limit "matches the xterm-side default in constants.js".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Ark0N Ark0N merged commit a9749ea into Ark0N:master Jul 12, 2026
2 checks passed
@Ark0N

Ark0N commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Merged — thank you @aakhter! The raised tmux history (100k) and PTY buffer caps (32MB/24MB) land in the next release. During review we appended one commit: the env-path trim default is now clamped below the max (an operator setting only CODEMAN_MAX_TERMINAL_BUFFER could otherwise disable trimming entirely), and the scrollback-lines constant was scoped back to what's actually wired so the docs don't overclaim. Appreciate the steady stream of solid infra work you've been sending in! 🙏

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.

3 participants