@devries-cameron20 / t3code-1 / commits / 88d104a35f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): terminals no longer inherit the launching tmux session (#13359)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Uzair Sajid committed Oct 19, 2026 at 10:22 UTC 88d104a35f700fdd55c635db616ad60aae6dc98a
2 files changed +24 -1
apps/server/src/terminal/Manager.test.ts
+10
@@ -2256,9 +2256,14 @@ it.layer(
2256 T3CODE_PORT: "3773",
2257 VITE_DEV_SERVER_URL: "http://localhost:5173",
2258 TEST_TERMINAL_KEEP: "keep-me",
2259 + TMUX: "/tmp/tmux-1000/default,1234,0",
2260 + TMUX_PANE: "%3",
2261 + ZELLIJ_SESSION_NAME: "work",
2262 + ZELLIJ_CONFIG_DIR: "/home/user/.config/zellij",
2263 },
2264 });
2265 yield* manager.open(openInput());
2266 + yield* manager.open(openInput({ terminalId: "explicit", env: { TMUX_PANE: "%9" } }));
2267 const spawnInput = ptyAdapter.spawnInputs[0];
2268 expect(spawnInput).toBeDefined();
2269 if (!spawnInput) return;
@@ -2267,6 +2272,11 @@ it.layer(
2272 expect(spawnInput.env.T3CODE_PORT).toBeUndefined();
2273 expect(spawnInput.env.VITE_DEV_SERVER_URL).toBeUndefined();
2274 expect(spawnInput.env.TEST_TERMINAL_KEEP).toBe("keep-me");
2275 + expect(spawnInput.env.TMUX).toBeUndefined();
2276 + expect(spawnInput.env.TMUX_PANE).toBeUndefined();
2277 + expect(spawnInput.env.ZELLIJ_SESSION_NAME).toBeUndefined();
2278 + expect(spawnInput.env.ZELLIJ_CONFIG_DIR).toBe("/home/user/.config/zellij");
2279 + expect(ptyAdapter.spawnInputs[1]?.env.TMUX_PANE).toBe("%9");
2280 }),
2281 );
2282
apps/server/src/terminal/Manager.ts
+14 -1
@@ -98,7 +98,20 @@ const DEFAULT_PROCESS_KILL_GRACE_MS = 1_000;
98 const DEFAULT_MAX_RETAINED_INACTIVE_SESSIONS = 128;
99 const DEFAULT_OPEN_COLS = 120;
100 const DEFAULT_OPEN_ROWS = 30;
101 -const TERMINAL_ENV_BLOCKLIST = new Set(["PORT", "ELECTRON_RENDERER_PORT", "ELECTRON_RUN_AS_NODE"]);
101 +// The tmux/screen/Zellij keys name the multiplexer pane that launched the server,
102 +// so inheriting them points multiplexer-aware tools at that unrelated pane.
103 +const TERMINAL_ENV_BLOCKLIST = new Set([
104 + "PORT",
105 + "ELECTRON_RENDERER_PORT",
106 + "ELECTRON_RUN_AS_NODE",
107 + "TMUX",
108 + "TMUX_PANE",
109 + "STY",
110 + "WINDOW",
111 + "ZELLIJ",
112 + "ZELLIJ_SESSION_NAME",
113 + "ZELLIJ_PANE_ID",
114 +]);
115 const nowIso = Effect.map(DateTime.now, DateTime.formatIso);
116 const MAX_TERMINAL_LABEL_LENGTH = 128;
117 const decodeClaudeSettings = Schema.decodeUnknownOption(ClaudeSettings);