You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Small, well-targeted test-only fix. Previously, if a panic (e.g. a failed assert_eq!) occurred between spawning the background click thread and the explicit click.join() call, the plain thread::JoinHandle would just be dropped -- silently detaching the thread so it kept running click_with_cancel against a page/browser that unwinding then tears down (BrowserInner::drop kills the Chromium process). WorkerGuard's Drop impl now cancels the token and joins the worker on unwind, closing that race. Drop-order reasoning (guard declared after browser, so it drops -- and therefore joins -- before browser's Drop fires) is correct per Rust's LIFO drop semantics, and the guard swallows join errors (let _ = worker.join()) so a worker-thread panic during unwind can't trigger a double-panic/abort. No production code (src/lib.rs, python/, node/) is touched -- this is confined to mcp/src/actor.rs test helpers, so risk is low.
Suggestions (1)
Two other real-browser background-thread patterns in the same file don't hold a live Browser/Page across the spawn (worker at ~L5572, ~L5950 use synthetic actor state, not a real browser), so they are not affected -- but it's worth double-checking there are no other thread::spawn sites elsewhere in mcp/ (outside actor.rs) that hold a live browser/page across a fallible assertion before .join(), since this same leak pattern could exist there too.
Minor / Style (1)
WorkerGuard construction and the declared-after-browser comment are duplicated verbatim across the two call sites. Fine for two uses, but if a third shows up, consider a small helper such as spawn_guarded(cancel, f) to avoid copy-pasted construction.
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
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.
https://github.com/Skyvern-AI/rustwright-cloud/pull/198