From b050fda4d90eb111cc97d5111c5f33473fe4758b Mon Sep 17 00:00:00 2001 From: Prateek Date: Thu, 7 May 2026 18:55:31 +0530 Subject: [PATCH] refactor(web): move exactTmuxTarget next to attach-session Address review feedback: the `=`-prefixed target is only used by attach-session, so declare it adjacent to that call. Comment now sits above the set-option calls it actually explains. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/web/server/mux-websocket.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/web/server/mux-websocket.ts b/packages/web/server/mux-websocket.ts index 77a6a7776..60fb7fd4e 100644 --- a/packages/web/server/mux-websocket.ts +++ b/packages/web/server/mux-websocket.ts @@ -274,9 +274,9 @@ export class TerminalManager { return tmuxSessionId; } - // tmux 3.4 only honours the `=` exact-match prefix for has-session and - // attach-session — set-option silently ignores it, so use the bare id here. - const exactTmuxTarget = `=${tmuxSessionId}`; + // tmux 3.4 only honours the `=` exact-match prefix on has-session and + // attach-session; set-option silently ignores it, so we use the bare id + // here. The `=`-prefixed form is built below for attach-session. // Enable mouse mode const mouseProc = spawn(this.TMUX, ["set-option", "-t", tmuxSessionId, "mouse", "on"]); @@ -307,7 +307,9 @@ export class TerminalManager { throw new Error("node-pty not available"); } - // Spawn PTY + // Spawn PTY — use `=`-prefixed exact-match target so we never attach to + // a session whose name happens to be a prefix of the requested id. + const exactTmuxTarget = `=${tmuxSessionId}`; const pty = ptySpawn(this.TMUX, ["attach-session", "-t", exactTmuxTarget], { name: "xterm-256color", cols: 80,