Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/server/src/terminal/Manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2153,9 +2153,14 @@ it.layer(
T3CODE_PORT: "3773",
VITE_DEV_SERVER_URL: "http://localhost:5173",
TEST_TERMINAL_KEEP: "keep-me",
TMUX: "/tmp/tmux-1000/default,1234,0",
TMUX_PANE: "%3",
ZELLIJ_SESSION_NAME: "work",
ZELLIJ_CONFIG_DIR: "/home/user/.config/zellij",
},
});
yield* manager.open(openInput());
yield* manager.open(openInput({ terminalId: "explicit", env: { TMUX_PANE: "%9" } }));
const spawnInput = ptyAdapter.spawnInputs[0];
expect(spawnInput).toBeDefined();
if (!spawnInput) return;
Expand All @@ -2164,6 +2169,11 @@ it.layer(
expect(spawnInput.env.T3CODE_PORT).toBeUndefined();
expect(spawnInput.env.VITE_DEV_SERVER_URL).toBeUndefined();
expect(spawnInput.env.TEST_TERMINAL_KEEP).toBe("keep-me");
expect(spawnInput.env.TMUX).toBeUndefined();
expect(spawnInput.env.TMUX_PANE).toBeUndefined();
expect(spawnInput.env.ZELLIJ_SESSION_NAME).toBeUndefined();
expect(spawnInput.env.ZELLIJ_CONFIG_DIR).toBe("/home/user/.config/zellij");
expect(ptyAdapter.spawnInputs[1]?.env.TMUX_PANE).toBe("%9");
}),
);

Expand Down
15 changes: 14 additions & 1 deletion apps/server/src/terminal/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,20 @@ const DEFAULT_PROCESS_KILL_GRACE_MS = 1_000;
const DEFAULT_MAX_RETAINED_INACTIVE_SESSIONS = 128;
const DEFAULT_OPEN_COLS = 120;
const DEFAULT_OPEN_ROWS = 30;
const TERMINAL_ENV_BLOCKLIST = new Set(["PORT", "ELECTRON_RENDERER_PORT", "ELECTRON_RUN_AS_NODE"]);
// The tmux/screen/Zellij keys name the multiplexer pane that launched the server,
// so inheriting them points multiplexer-aware tools at that unrelated pane.
const TERMINAL_ENV_BLOCKLIST = new Set([
"PORT",
"ELECTRON_RENDERER_PORT",
"ELECTRON_RUN_AS_NODE",
"TMUX",
"TMUX_PANE",
"STY",
"WINDOW",
"ZELLIJ",
"ZELLIJ_SESSION_NAME",
"ZELLIJ_PANE_ID",
]);
const nowIso = Effect.map(DateTime.now, DateTime.formatIso);
const MAX_TERMINAL_LABEL_LENGTH = 128;
const decodeClaudeSettings = Schema.decodeUnknownOption(ClaudeSettings);
Expand Down
Loading