Skip to content

Coalesce terminal replay batches server-side#397

Merged
danshapiro merged 1 commit into
mainfrom
fix-replay-server-batching
Jun 8, 2026
Merged

Coalesce terminal replay batches server-side#397
danshapiro merged 1 commit into
mainfrom
fix-replay-server-batching

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Summary

  • Coalesce contiguous ReplayRing replay batches before TerminalStreamBroker sends terminal.output payloads
  • Preserve existing seqStart/seqEnd, attachRequestId, replay gap, and byte-budget behavior
  • Remove the client replay-specific drain budget so replay mode only coalesces adjacent queued writes and does not change live/replay fairness

Investigation

  • Current merged main sends 1,000 small live frames as 1 terminal.output payload, but 1,000 small replay frames as 1,000 terminal.output payloads
  • This branch changes the same 1,000-frame replay probe to 1 payload spanning seq 1-1000, within MAX_REALTIME_MESSAGE_BYTES

Verification

  • Red test before fix: coalesces contiguous replay frames before sending terminal.output payloads failed with 1,000 replay outputs instead of 1
  • timeout 120s npm run test:vitest -- --run test/unit/client/components/terminal/terminal-write-queue.test.ts
  • timeout 180s npm run test:vitest -- --run test/e2e/terminal-create-attach-ordering.test.tsx test/unit/client/components/TerminalView.lifecycle.test.tsx test/unit/client/components/terminal/terminal-write-queue.test.ts
  • timeout 240s npm run test:vitest -- --run test/unit/server/terminal-stream/replay-ring.test.ts test/unit/server/terminal-stream/client-output-queue.test.ts test/unit/server/ws-handler-backpressure.test.ts test/server/ws-terminal-stream-v2-replay.test.ts test/server/ws-edge-cases.test.ts --config vitest.server.config.ts
  • FRESHELL_TEST_SUMMARY="verify server-side terminal replay batching correction" timeout 1800s npm run check

@danshapiro danshapiro merged commit 6faf470 into main Jun 8, 2026
1 check 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.

2 participants