Skip to content

Cap the transcript's retained row history at 600 - #338

Merged
TheGreatAxios merged 1 commit into
release/tui-bugfixesfrom
cl-5551-transcript-rows-are-retained-forever-the-600-block-cap-was
Aug 7, 2026
Merged

Cap the transcript's retained row history at 600#338
TheGreatAxios merged 1 commit into
release/tui-bugfixesfrom
cl-5551-transcript-rows-are-retained-forever-the-600-block-cap-was

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Restore the retention cap the Ink cutover dropped: shell.streamLog (and the parent snapshot held during subagent observe) evicts its oldest rows once it exceeds 600, instead of growing for the life of the process.
  • Thread an absolute-index base (streamLogBase) through every index the bridge and shell hold across calls — tool-call rows, the open streaming row, the retry rollback boundary, row-expand closures — so a trim only bumps the base instead of invalidating stored positions.
  • A rewrite or lookup targeting a row the cap has already evicted is now a safe no-op / undefined, not a write to whatever row now occupies that array slot.

Verification

  • bun run typecheck, bun run build, and bun test all pass.
  • New tests in src/tui-opentui/wave6.test.ts push a session past the cap and assert shell.streamLog.length stays at 600 while streamRowCount keeps reporting the true absolute total, and that replaceStreamRowAt/streamRowAt stay correct (or safely no-op) once the row they were pointed at has been evicted.
  • The retention cap (600) sits above the existing paint-window collapse threshold (500), so eviction never interferes with scroll/window reachability — history within the paint window is unaffected by this change.

Closes CL-5551

…ugh its indices

The Ink cutover deleted use-stream.ts's MAX_RETAINED_BLOCKS=600 cap without
porting it, so shell.streamLog grows without bound over a long session.
LONG_LOG_WINDOW only limits the paint tree, not the backing array.

Cap streamLog (and the parent snapshot held during subagent observe) at
600 rows, evicting from the front. Every index the bridge holds across
calls — tool-call rows, the open streaming row, the retry boundary,
row-toggle closures — is absolute (streamLogBase + local position), so a
trim only has to bump the base rather than rewrite stored indices.
@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

CL-5551

@TheGreatAxios
TheGreatAxios changed the base branch from main to release/tui-bugfixes August 7, 2026 04:20
@TheGreatAxios
TheGreatAxios merged commit d864400 into release/tui-bugfixes Aug 7, 2026
2 checks passed
TheGreatAxios added a commit that referenced this pull request Aug 7, 2026
…ot a smaller window

PR #338 already caps shell.streamLog at MAX_RETAINED_STREAM_ROWS (600) and
threads an absolute streamLogBase through every touch point, so the paint
tree no longer needs a second, smaller window on top of that cap — painting
every retained row is what makes all of it reachable by scrolling, and it
composes with the retention machinery instead of duplicating it.

Drop the LONG_LOG_WINDOW/collapse-marker path from shell.ts: repaintTranscriptWindow
now paints shell.streamLog directly, paintAppendStreamRow adds one node per
append and removes only what trimRetainedLog actually evicted, and
replaceStreamRowAt's cheap single-node retext no longer has a windowing
condition gating it off past 500 rows.
@TheGreatAxios
TheGreatAxios deleted the cl-5551-transcript-rows-are-retained-forever-the-600-block-cap-was branch August 7, 2026 06:35
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