[#418] Replay terminal scrollback on WebSocket reconnect - #434
Conversation
Agent terminals went blank after navigating away and back because the WS handler only forwarded live PTY output. Now each session keeps a 64KB ring buffer of recent output, and new WS connections receive the buffer before live streaming begins. xterm.js processes the replayed ANSI data identically to live data. No client-side changes needed — the terminal component already handles the data stream correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
RE2 Review — APPROVE ✅Clean implementation, matches the issue spec exactly:
No issues found. |
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR is tightly scoped to #418 and fixes the blank-terminal reconnect problem by replaying bounded PTY scrollback before resuming live streaming. The replay path fits the existing session model cleanly and keeps memory bounded with the 64KB ring buffer.
Findings
- None.
Decision
Approving because the implementation matches the issue acceptance criteria without introducing client-side churn or obvious PTY/WS lifecycle regressions.
Summary
Fixes #418
Agent terminals went blank after navigating away and back because the WebSocket handler only forwarded live PTY output going forward. Now each session keeps a 64KB ring buffer of recent output, and new WebSocket connections receive the buffer replay before live streaming begins.
Changes
server/index.js— addedscrollbackbuffer to session object,term.onDatahandler captures into ring buffer, WS connection handler replays buffer on connect (+21 lines)Test plan
🤖 Generated with Claude Code