Skip to content

fix: end browser tasks when controlled tabs leave their window - #510

Merged
iuyo5678 merged 5 commits into
mainfrom
fix/end-task-on-tab-move
Oct 28, 2026
Merged

iuyo5678 merged 5 commits into
mainfrom
fix/end-task-on-tab-move

Conversation

@iuyo5678

@iuyo5678 iuyo5678 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Moving a controlled tab out of its Agent Window previously broke the task while leaving control indicators visible. End the entire session on that move, preserve every page in its current location, and remove overlays, native task groups, and CDP ownership. The ended session cannot resume.

  • Release session ownership synchronously and cancel running/queued work with the terminal user_moved_tab reason. Guard asynchronous cleanup so it cannot close or move pages after release. Clean up pending debugger attachments while preserving connections owned by another live session; bind snapshot frame reads to their original attachment so cancelled reads cannot reconnect or use a replacement connection.
  • Match explicitly issued tab moves to their detach/attach events. Same-window reordering, programmatic borrow/return/rollback, and ordinary session_stop retain their behavior. Finish source lookups before the final control check so user input or a pause still prevents a pending move.
  • Preserve the recorded terminal reason when returning a dispatched tool's result, including outer worker-wait timeouts, evaluate cleanup timeouts, and deadlines that precede the tab move. Keep existing waiting budgets, error codes, messages, effect information, cleanup diagnostics, and confirmed successful results.
  • Add unit regressions and a Chrome regression covering created, borrowed, and observed tabs; whole-group and last-tab moves; reordering; unrelated tabs; programmatic return; and ordinary stop. Run the Chrome regression in CI.

Compatibility: protocol 1.6 is required by the new extension so older daemons cannot silently ignore session termination. Update the CLI/daemon together with the extension; connecting to an older daemon shows an explicit upgrade message.

Validation:

  • Extension suite: 3,235 passed; 276 skipped. Regression coverage includes cancelled snapshot frame reads, shared and replaced debugger attachments, and OOPIF cancellation.
  • Rust unit tests: 476 passed, 1 ignored. Relevant queue, session, cancellation, browser-liveness, and tool integration suites: 109 passed. Coverage includes an observe outer timeout before worker cleanup finishes, an ordinary user-interrupt control, evaluate cleanup timeouts in both event orders, native input effects, cleanup diagnostics, and confirmed file-transfer results. Clippy and formatting passed.
  • An earlier full local Rust workspace run stopped on two daemon shutdown assertions in auto_spawn. Standalone reruns passed all four auto_spawn tests on both 2374f0a and 46a0ba4; the initial failure could not be reproduced consistently.
  • The preceding revision's Windows CI run stopped in the unchanged remote-server capacity test while writing the authorization store (Access is denied, OS error 5), before any session or tool dispatch. Later steps in that job did not run.
  • Repository lint and DSH checks: passed, including 565 DSH tests.
  • Extension typecheck and production build: passed.
  • Chrome regression: all nine scenarios passed after the fixes. One earlier fixture startup check failed; startup diagnostics were added, and subsequent local runs and the initial PR CI run passed.
  • Browser evaluation scaffold: 17 tests passed after rebasing onto the latest main.

@iuyo5678
iuyo5678 merged commit e33464f into main Oct 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants