From 0b520f6801ead9e070f463fc4fbc027c3087eb60 Mon Sep 17 00:00:00 2001 From: Valerii Kovalskii Date: Mon, 20 Jul 2026 20:28:13 +0300 Subject: [PATCH] fix(workspace): running-agent click no longer spawns a duplicate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - jumpToRunningAgent: the agent is already running, so clicking a row must not prefill a resume command (that started a 2nd instance) and must not dead-click when the session isn't indexed. Now: jump to the live pane if one exists, else open a plain terminal in the project folder — no resume, no silent no-op. - _wsRenderRunningTree: change-detection signature now keys on the full cwd, not the folder basename, so two same-named projects (or a swap) can't reuse a stale tree / wrong jump target. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/frontend/workspace.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/frontend/workspace.js b/src/frontend/workspace.js index dc6195e..1ca8730 100644 --- a/src/frontend/workspace.js +++ b/src/frontend/workspace.js @@ -189,14 +189,13 @@ function _wsPaneForCwd(cwd) { return hit; } -// Click a running-agent row: jump to its Workspace pane if one exists here, -// otherwise open the session in a new pane (best-effort) or just show Workspace. +// Click a running-agent row: jump to its Workspace pane if one is open here, +// otherwise open a plain terminal in the project folder. The agent is ALREADY +// running, so we must NOT prefill a resume command — that would spawn a second +// instance. (sessionId/kind are accepted for signature stability but unused.) function jumpToRunningAgent(cwd, sessionId, kind) { var hit = _wsPaneForCwd(cwd); if (hit) { jumpToWorkspacePane(hit.tab.id, hit.pane.id); return; } - if (sessionId && typeof openSessionInWorkspace === 'function') { - openSessionInWorkspace(sessionId); return; - } if (cwd && typeof openInWorkspace === 'function') { openInWorkspace({ name: _wsProjectBasename(cwd), cwd: cwd }); } @@ -210,7 +209,7 @@ function _wsRenderRunningTree() { if (!el) return; var groups = _wsRunningByProject(); var sig = groups.map(function (g) { - return g.name + ':' + g.items.map(function (a) { + return g.cwd + ':' + g.items.map(function (a) { return (a.sessionId || a.pid) + '=' + a.kind + '/' + a.status; }).join(','); }).join('|');