Skip to content

Commit 900af54

Browse files
authored
🤖 fix: add SSH timeout options to bundle transfer (#1243)
The git bundle pipeline SSH command was missing timeout/keepalive options that `exec()` includes. When SSH hangs or fails mid-transfer, it closes the pipe and git receives SIGPIPE, resulting in "pack-objects died". ## Changes - Remove redundant `acquireConnection` call (Step 2 already handles this with wait semantics) - Add `-T` (no PTY), `ConnectTimeout`, `ServerAliveInterval`, `ServerAliveCountMax` to match the timeout behavior of `exec()` This ensures connection failures produce clear SSH errors rather than the cryptic git error. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_
1 parent b049fae commit 900af54

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/node/runtime/SSHRuntime.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,19 +639,27 @@ export class SSHRuntime implements Runtime {
639639
// Step 3: Create bundle locally and pipe to remote file via SSH
640640
initLogger.logStep(`Creating git bundle...`);
641641

642-
// Ensure SSH connection is established before starting the bundle transfer
643-
// Without this, the SSH command in the pipe may fail to connect, causing
644-
// the git bundle process to receive SIGPIPE and report "pack-objects died"
645-
await sshConnectionPool.acquireConnection(this.config);
646-
647642
await new Promise<void>((resolve, reject) => {
648643
// Check if aborted before spawning
649644
if (abortSignal?.aborted) {
650645
reject(new Error("Bundle creation aborted"));
651646
return;
652647
}
653648

654-
const sshArgs = [...this.buildSSHArgs(), this.config.host];
649+
// Build SSH args with timeout options to detect connection failures quickly
650+
// Without these, SSH can hang indefinitely, causing git to receive SIGPIPE
651+
// and report the cryptic "pack-objects died" error
652+
const sshArgs = [
653+
"-T", // No PTY needed for piped data
654+
...this.buildSSHArgs(),
655+
"-o",
656+
"ConnectTimeout=15",
657+
"-o",
658+
"ServerAliveInterval=5",
659+
"-o",
660+
"ServerAliveCountMax=2",
661+
this.config.host,
662+
];
655663
const command = `cd ${shescape.quote(projectPath)} && git bundle create - --all | ssh ${sshArgs.join(" ")} "cat > ${bundleTempPath}"`;
656664

657665
log.debug(`Creating bundle: ${command}`);

0 commit comments

Comments
 (0)