fix(remote): leave the remote-history PATH bootstrap out of this PR

Merge-time fix for #645: the PATH bootstrap for remote history reads
(src/remote-pane-history.ts, src/remote-hosts.ts and its test) is a
separate fix from the scroll work. On its own it does not reach a host
whose tmux lives only under /opt/homebrew/bin, because the link
precheck, the launch, the alive probe and discovery still run a bare
tmux through the same non-interactive ssh shell. It belongs in a
follow-up PR that routes every remote tmux call through one wrapper.
These files are restored to the PR's merge base; every scroll change
stays.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-22 19:03:04 +02:00
1 parent 242bbfcd31
commit 71bf7288e0
3 files changed
+3 -54

No files matched your search

+1 -35
View File
@@ -11,7 +11,7 @@
import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, vi } from 'vitest';
import { execFileSync } from 'node:child_process';
import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { chmodSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import {
@@ -79,40 +79,6 @@ describe('buildRemoteScrollbackCommand', () => {
});
});
describe('remote history PATH bootstrap', () => {
it('finds tmux installed under the remote home when the login shell omits it', () => {
const root = mkdtempSync(join(tmpdir(), 'remote-history-path-'));
const home = join(root, 'remote home');
const sshBin = join(root, 'local-bin');
const remoteBin = join(home, '.local', 'bin');
mkdirSync(sshBin, { recursive: true });
mkdirSync(remoteBin, { recursive: true });
writeFileSync(join(sshBin, 'ssh'), '#!/bin/sh\nfor arg do command="$arg"; done\nexec /bin/sh -c "$command"\n', {
mode: 0o755,
});
writeFileSync(
join(remoteBin, 'tmux'),
`#!/bin/sh
printf 'older row\\n${MARKER}\\n1\\ncurrent screen\\n'
`,
{ mode: 0o755 }
);
try {
const command = buildRemoteScrollbackCommand(remote, SESSION_ID, 100, 0, MARKER);
const stdout = execFileSync('/bin/sh', ['-c', command], {
encoding: 'utf-8',
env: { ...process.env, HOME: home, PATH: `${sshBin}:/usr/bin:/bin` },
});
expect(parseRemoteScrollbackOutput(stdout, MARKER, 0)).toEqual({
scrollback: 'older row\n',
screen: 'current screen\n',
});
} finally {
rmSync(root, { recursive: true, force: true });
}
});
});
describe('remoteTailBytes', () => {
it('adds room for the marker, size and screen to the cap, so a cut lands in the history', () => {
expect(remoteTailBytes(2048)).toBe(2048 + 1024 * 1024);