From 2e44a7f286f6ed52d83f4d538e9a1279e8a9fb0e Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 16 May 2026 03:51:27 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20listSessions=20filters=20to=20@pi-remote?= =?UTF-8?q?-managed=20sessions=20only=20=E2=80=94=20excludes=20pi-sidecar?= =?UTF-8?q?=20and=20other=20unrelated=20tmux=20sessions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/remote-control/tmux/manager.ts | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/extensions/remote-control/tmux/manager.ts b/extensions/remote-control/tmux/manager.ts index 705983c..9f27931 100644 --- a/extensions/remote-control/tmux/manager.ts +++ b/extensions/remote-control/tmux/manager.ts @@ -82,6 +82,17 @@ export async function spawnSession(opts: { if (command) args.push(command); await execFileAsync("tmux", args); + + // Mark as sidecar-managed so listSessions() can filter out unrelated + // tmux sessions (e.g. the pi-sidecar launcher session itself). + await execFileAsync("tmux", [ + "set-option", + "-t", + name, + "@pi-remote-managed", + "1", + ]).catch(() => {}); + return name; } @@ -144,6 +155,20 @@ export async function listSessions(): Promise { if (!line) continue; const [id, createdAt, lastActivityAt, w, h] = line.split(SEP); + // Only include sessions created by the sidecar. + try { + const r = await execFileAsync("tmux", [ + "show-options", + "-t", + id, + "-qv", + "@pi-remote-managed", + ]); + if (!r.stdout.trim()) continue; // unmanaged session — skip + } catch { + continue; // can't read options → skip + } + // Fetch @description option separately (may not be set) let description: string | undefined; try {