Merge pull request #602: fix(remote): load a remote session's scrollback from the remote tmux

A full-history load of a remote SSH session reads the scrollback from the
remote tmux in one bounded ssh round trip and splices it above the local
frame. A transport failure (ssh 255, timeout, unparseable output) starts a
30 s per-host back-off; a missing remote session is per-session only.

Conflict resolved in session-routes.ts: #602's remote scrollback read runs
before #601's capture helper and its alternate-screen fallback.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:01:15 +02:00
commit f9f00bdb5e
11 files changed
+720 -11

No files matched your search

+14
View File
@@ -165,6 +165,7 @@ import {
toAttachedSessionRemote,
toSessionRemote,
} from '../../remote-hosts.js';
import { fetchRemoteScrollback } from '../../remote-pane-history.js';
import {
checkDockerAvailable,
checkDockerConfigDrift,
@@ -3126,6 +3127,19 @@ export function registerSessionRoutes(
maxCaptureBytes: terminalBufferMaxBytes,
}
: {};
// A remote session's local pane only sees the remote tmux client's repaints,
// so its own scrollback is a fraction of the real one: read that from the
// remote tmux and splice it above the local frame. Null (host unreachable,
// no remote session, back-off) keeps the local capture as before.
if (isFullReload && session.remote && muxName && captureOpts.historyLimitLines !== undefined) {
const remoteScrollback = await fetchRemoteScrollback(
session.remote,
session.id,
captureOpts.historyLimitLines,
terminalBufferMaxBytes
);
if (remoteScrollback !== null) captureOpts.scrollbackOverride = remoteScrollback;
}
const capture = (opts: PaneCaptureOptions): string | null =>
muxName && typeof ctx.mux.captureActivePaneBuffer === 'function'
? ctx.mux.captureActivePaneBuffer(muxName, opts)