The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 04:15 UTC
fix(server): SSH device-host tunnels no longer inherit ControlMaster (#17440)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Killian Cazin committed
Oct 19, 2026 at 04:26 UTC
cdb761d795f9e1f26176075170bda571a9bfd46d
2 files changed
+24
apps/server/src/device/SshDeviceHost.test.ts
+16
@@ -20,6 +20,8 @@ it.effect("preserves installed status after probes and cleans failed agent activ
20
const home = yield* fs.makeTempDirectoryScoped();
21
const modes: string[] = [];
22
const owners: string[] = [];
23
+ const tunnelArgs: string[][] = [];
24
+ const commandArgs: string[][] = [];
25
let forwards = 0;
26
let failForward = true;
27
let rejectConfig = true;
@@ -27,6 +29,7 @@ it.effect("preserves installed status after probes and cleans failed agent activ
29
Effect.gen(function* () {
30
if (command._tag !== "StandardCommand") return yield* Effect.die("Unexpected command");
31
const forwarding = command.args.includes("-N");
32
+ (forwarding ? tunnelArgs : commandArgs).push([...command.args]);
33
let output = "";
34
if (forwarding) {
35
if (failForward) {
@@ -132,6 +135,19 @@ it.effect("preserves installed status after probes and cleans failed agent activ
135
expect((yield* host.summary).agentDeviceInstalled).toBe(true);
136
yield* host.stopAgent;
137
expect(forwards).toBe(1);
138
+ const multiplexingOff = ["ControlMaster=no", "ControlPath=none", "ControlPersist=no"];
139
+ expect(tunnelArgs.length).toBeGreaterThan(0);
140
+ for (const args of tunnelArgs) {
141
+ for (const option of multiplexingOff) {
142
+ const index = args.indexOf(option);
143
+ expect(index).toBeGreaterThan(0);
144
+ expect(args[index - 1]).toBe("-o");
145
+ }
146
+ }
147
+ expect(commandArgs.length).toBeGreaterThan(0);
148
+ for (const args of commandArgs) {
149
+ for (const option of multiplexingOff) expect(args).not.toContain(option);
150
+ }
151
yield* host.stop;
152
expect(forwards).toBe(0);
153
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
apps/server/src/device/SshDeviceHost.ts
+8
@@ -242,6 +242,14 @@ export const make = Effect.fn("SshDeviceHost.make")(function* (
242
...identityArgs(config),
243
"-o",
244
"ExitOnForwardFailure=yes",
245
+ // A multiplexed client hands its -L forwards to the control master and exits,
246
+ // so the tunnel must own its own connection.
247
+ "-o",
248
+ "ControlMaster=no",
249
+ "-o",
250
+ "ControlPath=none",
251
+ "-o",
252
+ "ControlPersist=no",
253
"-o",
254
"ServerAliveInterval=10",
255
"-o",