fix: COD-24 stabilize remote host sessions

This commit is contained in:
Saqeb Akhter
2026-07-09 09:06:06 -04:00
committed by Aamer Akhter
parent 568d93efb0
commit 26e78daf58
11 changed files with 512 additions and 30 deletions
+12
View File
@@ -42,8 +42,10 @@ import {
type CodexConfig,
type EffortLevel,
type GeminiConfig,
type SessionRemote,
} from './types.js';
import { buildEffortCliArgs } from './session-cli-builder.js';
import { defaultRemoteCommandForMode, remoteSshTarget } from './remote-hosts.js';
import {
wrapWithNice,
SAFE_PATH_PATTERN,
@@ -669,6 +671,16 @@ function buildSpawnCommand(options: {
return '$SHELL';
}
export function buildRemoteLaunchCommand(options: { mode: SessionMode; remote: SessionRemote }): string {
const { mode, remote } = options;
const modeCommand = remote.commands?.[mode] || defaultRemoteCommandForMode(mode);
const args = ['ssh', '-o', 'BatchMode=yes', '-t'];
if (remote.port) args.push('-p', String(remote.port));
const remoteCommand = `cd ${shellescape(remote.remotePath)} && ${modeCommand}`;
args.push(remoteSshTarget(remote), `bash -lc ${shellescape(remoteCommand)}`);
return args.map((arg) => shellescape(arg)).join(' ');
}
/**
* Set sensitive environment variables on a tmux session via setenv.
* These are inherited by panes but not visible in ps output or tmux history.