Skip to content

fix(computer): abort execution on stop by checking destroyed in screenshotBase64#2016

Merged
quanru merged 2 commits intomainfrom
fix/computer-stop-not-aborting
Feb 14, 2026
Merged

fix(computer): abort execution on stop by checking destroyed in screenshotBase64#2016
quanru merged 2 commits intomainfrom
fix/computer-stop-not-aborting

Conversation

@quanru
Copy link
Collaborator

@quanru quanru commented Feb 14, 2026

Summary

  • Fix Computer Playground continuing to operate the desktop after clicking "Stop"
  • Unlike Playwright/Android/iOS where destroy() breaks the device connection and causes subsequent operations to naturally fail, ComputerDevice uses stateless system calls (libnut) that don't depend on any connection — so destroy() only set a flag without actually blocking further calls
  • Add a destroyed check in screenshotBase64(), the natural chokepoint of every execution cycle (plan → screenshot → act → repeat), so the planning loop breaks on the next iteration

Test plan

  • Start a long-running task in Computer Playground
  • Click "Stop" during execution
  • Verify the agent stops operating the computer after at most one more action batch

…ution on stop

After clicking stop in Computer Playground, the agent continued operating
because ComputerDevice uses stateless system calls (libnut) that don't
depend on any connection. Unlike Playwright/Android/iOS where destroy()
breaks the connection and causes subsequent operations to naturally fail,
ComputerDevice's destroy() only set a flag without blocking further calls.

Add a destroyed check in screenshotBase64() — the natural chokepoint of
every execution cycle — so the planning loop breaks on the next iteration.
…k side effects

During cancel, recreateAgent() was creating a new agent immediately,
which triggered ComputerDevice.connect() → healthCheck() → mouse movement.
This is unnecessary since /execute always creates a fresh agent before
each run. Now cancel only destroys the old agent.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 14, 2026

Deploying midscene with  Cloudflare Pages  Cloudflare Pages

Latest commit: ff1ca64
Status: ✅  Deploy successful!
Preview URL: https://e0da2236.midscene.pages.dev
Branch Preview URL: https://fix-computer-stop-not-aborti.midscene.pages.dev

View logs

@quanru quanru merged commit c9a64e3 into main Feb 14, 2026
8 checks passed
@quanru quanru deleted the fix/computer-stop-not-aborting branch February 14, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants