diff --git a/packages/coding-agent/src/ssh/connection-manager.ts b/packages/coding-agent/src/ssh/connection-manager.ts index 9658cebff..81158887a 100644 --- a/packages/coding-agent/src/ssh/connection-manager.ts +++ b/packages/coding-agent/src/ssh/connection-manager.ts @@ -68,6 +68,7 @@ async function validateKeyPermissions(keyPath?: string): Promise { function buildCommonArgs(host: SSHConnectionTarget): string[] { const args = [ + "-n", "-o", "ControlMaster=auto", "-o", diff --git a/packages/coding-agent/test/ssh/connection-manager.test.ts b/packages/coding-agent/test/ssh/connection-manager.test.ts new file mode 100644 index 000000000..655e602c2 --- /dev/null +++ b/packages/coding-agent/test/ssh/connection-manager.test.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from "bun:test"; +import { buildRemoteCommand } from "../../src/ssh/connection-manager"; + +describe("buildRemoteCommand", () => { + it("includes -n to bind stdin to /dev/null for mux channel opens", async () => { + const args = await buildRemoteCommand( + { + name: "host", + host: "192.168.3.146", + }, + "ls -la", + ); + + expect(args[0]).toBe("-n"); + expect(args).toContain("ControlMaster=auto"); + expect(args.at(-2)).toBe("192.168.3.146"); + expect(args.at(-1)).toBe("ls -la"); + }); +});