From 268402d92de556087c8f6263f2cc3309b3614c5a Mon Sep 17 00:00:00 2001 From: kagura-agent Date: Tue, 21 Apr 2026 16:43:03 +0800 Subject: [PATCH] fix: use unique workspace per command execution to prevent concurrent conflicts (#1114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commands for the same site shared a workspace key based only on site name, causing concurrent commands to interfere — one command closing the automation window would detach the other mid-execution. Append a random UUID to the workspace key so each command gets its own browser session, preventing the 'Detached while handling command' error. --- src/execution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execution.ts b/src/execution.ts index 1329389c..18ab5972 100644 --- a/src/execution.ts +++ b/src/execution.ts @@ -257,7 +257,7 @@ export async function executeCommand( if (!keepOpen) await page.closeWindow?.().catch(() => {}); throw err; } - }, { workspace: `site:${cmd.site}`, cdpEndpoint, contextId }); + }, { workspace: `site:${cmd.site}:${crypto.randomUUID()}`, cdpEndpoint, contextId }); } else { // Non-browser commands: apply timeout only when explicitly configured. const timeout = cmd.timeoutSeconds;