fix: use unique workspace per command execution (fixes #1114)#1117
Open
kagura-agent wants to merge 1 commit intojackwener:mainfrom
Open
fix: use unique workspace per command execution (fixes #1114)#1117kagura-agent wants to merge 1 commit intojackwener:mainfrom
kagura-agent wants to merge 1 commit intojackwener:mainfrom
Conversation
… conflicts (jackwener#1114) 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.
|
any update about this PR ? |
Contributor
Author
|
Hi @Henry-G-H-Huang — thanks for the ping! The PR is still up to date and mergeable. Waiting on maintainer review. Let me know if there's anything I can help with! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix concurrent commands for the same site failing with
Detached while handling command.Closes #1114
Root Cause
Browser command execution uses a workspace key based only on site name (
site:${cmd.site}). When two commands for the same site run concurrently, they share the same browser session. If one finishes first and callspage.closeWindow(), the other command's page is detached mid-execution.Fix
Append
crypto.randomUUID()to the workspace key so each command gets its own isolated browser session:Testing
npx tsc --noEmitcleansrc/execution.ts