Repository navigation
Description
Summary
Open a terminal in a thread's side panel and let it collect some output. Switch to the Browser tab in the same panel, then back to the terminal. The terminal is rebuilt from scratch: it reconnects and replays its recent history, and you watch it scroll through that history before it reaches the prompt. The same happens when you switch to another thread and back. Expected: the terminal comes back as you left it, at once.
Versions and environment
- bb 0.49.0 (latest release), desktop app on macOS.
- The desktop app connects to a bb server on a remote Linux machine through bb Connect. Node 26.12.1 on the server.
- Code references below are against
mainat 7889bd2.
Steps to reproduce
- Open any thread and open a terminal in the side panel.
- Run a command that prints a few thousand lines, for example
seq 1 50000. - Click the Browser tab in the same panel, then click the terminal tab again.
- Switch to another thread, then back to the first thread.
Expected vs actual
Expected: after steps 3 and 4 the terminal shows its last screen immediately, with no reconnect.
Actual: after steps 3 and 4 the terminal starts empty and scrolls through the replayed history until it reaches the bottom. With a long history this takes a visible moment every time.
Evidence
Cause, read from the source:
- The secondary panel renders content only for the active tab. Other tabs unmount. ThreadSecondaryPanel.tsx#L678-L681
- The Browser deck avoids this with
keepMounted: true. The terminal panel loader does not have it. lazySecondaryPanelComponents.tsx#L186 - When
ThreadTerminalViewunmounts, its effect cleanup disposes both the WebSocket transport and the xterm instance. ThreadTerminalView.tsx#L1062-L1063 - On the next mount a new transport starts at
nextOutputSeq = 0and connects withsinceSeq=0. terminal-websocket-transport.ts#L84, #L227 - The server replays up to
BROWSER_TERMINAL_REPLAY_MAX_BYTES(512 KB) as separateoutputmessages. The client writes each one to the visible terminal as it arrives, so the user sees the scroll. terminal-session-lifecycle.ts#L65, ThreadTerminalView.tsx#L618
Two fixes were tried on a local 0.49.0 build:
- Hiding the terminal until the replay finished removed the visible scroll. Returning to the terminal was still just as slow, because the reconnect and the replay still happen.
- Keeping the xterm instance and its transport alive while the terminal is not shown made returning instant, for both tab switches and thread switches. A PR with this approach follows.
What you ruled out
- Not a duplicate of Built-in terminal is slow to reopen and unreliable under sustained output #1075. That issue made the first replay smaller (a 512 KB tail instead of the full 4 MB), but every remount still reconnects and replays.
- Same cause as Code review (git-diff) panel loses scroll position when switching secondary-panel tabs #6162 (the diff panel loses its scroll position when switching secondary-panel tabs): panel tabs unmount when they are not active. This issue is about the terminal only.
- Still present in the
mainsource at the commit above.
Suggested priority and effort
Hits everyone who uses the built-in terminal next to other panel tabs. No data loss. Workaround: use an external terminal.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
Investigated in a local bb thread. There is no public report.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 17, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotui,perf,partial-repro.sinceSeq=0and replays retained output.