Appearance
Terminal History & Full Reload
Opening a session does not download its entire scrollback. The daemon collapses the session's output into a snapshot. Non-touch desktop and web clients initially request the last 3000 rows (tail_rows), while mobile and other coarse-pointer touch clients initially request the last 600 rows so a long-running session attaches without overwhelming the interface. Older rows remain available in 1500-row pages as you scroll to the top of the terminal.
That is the right default, but sometimes you want the whole thing at once:
- You need to search (Ctrl+F) across output older than the loaded tail.
- The terminal drifted from the owner's screen (a flaky link dropped frames, a resize reflowed at a stale width, or a take-over swapped the writer).
- You scrolled up far enough that paging through it one page at a time is slow.
Reconnect recovery
After a reconnect, Hive eagerly refreshes history only for terminals that are mounted and visible. Persisted background panes still re-subscribe for live output, but their history refresh waits until you open them. If a mobile workspace has multiple visible terminals, Hive refreshes them one at a time to keep terminal replay work from freezing the app.
Automatic history repair
Hive normally repairs resize-related history drift without user action. When an authoritative PTY resize reduces the terminal's row count, xterm can briefly move the old top of a full-screen TUI into scrollback before the TUI repaints at the shorter height. That can strand duplicate Claude Code or Codex headers and transcript frames in the local terminal.
New terminals also start closer to their destination size. Initial geometry is estimated from the actual viewport without forcing an 80x24 minimum. Session creation ignores a keyboard open over the dialog because that dialog closes before the destination terminal appears. If a terminal mounts without a measurable pane while the keyboard remains visible, its fallback estimate uses the unobscured height instead.
Opening or closing the mobile keyboard does not resize the remote PTY, so it does not enter this row-shrink repair path. The terminal is translated, scaled, or left natural-size and scrollable entirely in the client according to the selected keyboard presentation mode.
After the repaint settles, Hive fetches the daemon's clean, VT-collapsed history and replaces the affected local buffer. Live output is held while the snapshot is applied and then appended, so the repair does not lose or splice new output. This applies to the desktop, mobile, and web clients. Plain shell output is also safe because the daemon's reconstruction preserves content that was not repainted.
The daemon resets ANSI styling before each serialized row break. This keeps a TUI's background color from bleeding into blank rows created when restored history scrolls, which would otherwise appear as full-width color bars after a reload.
The instant terminal preview persisted on the device is a cache, not the source of truth. If the current app run does not already have a continuously subscribed live buffer, Hive shows that preview immediately and validates it against fresh daemon history. A current live buffer takes priority over the cache. This automatically replaces stale previews containing duplicated TUI frames left by an older app build.
Reload full history
Ctrl+Shift+H (or right-click -> Reload full history) throws away what the terminal currently shows and re-renders it from a fresh, complete daemon snapshot - no tail limit and no scroll-up paging left to do.
On mobile there is no right-click (long-press opens touch selection instead), so the same action sits behind the chevron in the terminal's key bar as the Reload full history button.
The shortcut only fires for the terminal that has focus, so it never refetches every pane in a split workspace. While the snapshot is in flight the usual "Fetching session history…" indicator is shown, and the action is disabled so a repeated chord cannot stack requests.
Limits
The client keeps at most 10000 rows of scrollback per PTY session (xterm's buffer size). A session whose collapsed history is longer than that is still reloaded in full, then trimmed to the newest 10000 rows - the terminal cannot hold more.
Reload is read-only: it re-reads the daemon's snapshot, it does not touch the session, the PTY, or its output on disk. Read-only viewers of a claimed session can reload just like the owner.
Implementation notes
- Client:
getSessionHistory(sessionId, undefined, 0, /* force */ true, /* full */ true)incrates/clusto-app/src/stores/sessions.tssendsGetSessionHistorywithtail_rows: null, which makes the daemon return the whole collapsed snapshot (and no paging metadata, so the scroll-up paging cursor is cleared). - The arriving snapshot rides the existing history-replace path in
useTerminalManager.ts: live output is diverted, xterm's write queue is drained with a fence, the terminal is reset, and the snapshot is rewritten - so a reload cannot duplicate or splice rows. - A row-shrink boundary schedules a debounced authoritative-history refresh after the resized TUI has repainted. Persisted previews are also followed by a daemon history fetch unless the app already holds a current live buffer.
- Daemon:
session_handlers.rsbuilds the full snapshot whenlimitandtail_rowsare bothNone(see Transport & Resume).