fix(web): F3 defer parked tabs' cache replay to first activation (WI-127) - #669
Closed
thedancingdeveloper wants to merge 1 commit into
Closed
thedancingdeveloper wants to merge 1 commit into
thedancingdeveloper wants to merge 1 commit into
Conversation
On reload every retained terminal tab replayed its cached tail (up to 1 MiB) immediately, through the single global replay FIFO, round-robin with the active pane. With N retained tabs the pane the user is actually looking at got 1/N of the parser — the reload-is-slow half of the terminal budget bug. A parked pane (a retained tab that is not active, or the unfocused half of a split) now keeps its prepared cache tail in memory and replays it lazily on first activation in resumeSocket(), before connect(), instead of scheduling it into the shared FIFO on load. The active pane still replays immediately, so its restore is no longer time-sliced against tabs the user cannot see. The cache position is adopted at load time so a warm reattach resumes correctly even if the deferred replay is later cancelled by a re-park. The decision is a pure helper, shouldDeferCacheReplay(parked, hasCachedBytes), unit-tested here; the six-cached-tabs end-to-end assertion lands with H3's mocked Playwright spec (WI-124). Verification: pnpm typecheck clean; pnpm vitest 909 passed. WI-127. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UtEFLJAhLiq4NfZCN2vuBb
This was referenced Sep 9, 2026
Contributor
Author
|
Cleanup: superseded by the single promotion PR #676. All of this work is already integrated into |
thedancingdeveloper
deleted the
feat/terminal-attach-f3-lazy-cache-replay
branch
September 9, 2026 20:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third PR of the terminal-attach-budget initiative (WI-121). Stacked on #668 (F1) so the diff is F3-only; all land on
feat/terminal-attach-budget.The bug (WI-127)
On reload, every retained terminal tab replayed its cached tail (≤ 1 MiB each) immediately, through the single global replay FIFO, round-robin with the active pane. With N retained tabs the visible pane got 1/N of the parser — the "reload is slow" half of the terminal budget bug — then pre-warm cold-attached up to 8 more sessions on top.
The fix
A parked pane (retained-but-not-active, or the unfocused half of a split) now keeps its prepared cache tail in memory and replays it lazily on first activation (
resumeSocket, beforeconnect()), instead of scheduling into the shared FIFO on load. The active pane still replays immediately, so its restore is no longer time-sliced against tabs the user cannot see. The cache position is adopted at load time, so a warm reattach resumes correctly even if a re-park cancels the deferred replay before it runs.The decision is a pure helper
shouldDeferCacheReplay(parked, hasCachedBytes), unit-tested here. The six-cached-tabs end-to-end assertion (active pane replay unaffected by other tabs) lands with H3's mocked Playwright spec (WI-124) — that is F3's stated acceptance.Verification
pnpm typecheckclean;pnpm vitest— 909 passed (incl. newshouldDeferCacheReplay.test.ts).🤖 Generated with Claude Code
https://claude.ai/code/session_01UtEFLJAhLiq4NfZCN2vuBb