mxc icon indicating copy to clipboard operation
mxc copied to clipboard

[IsolationSession] A failing concurrent one-shot Rust test can leave a session's agent account on the host

Open adpa-ms opened this issue 4 weeks ago • 1 comments

Relevant area(s)

Windows

Brief description of your issue

concurrent_one_shot_runs_stay_isolated (src/mxc-sdk/tests/isolation_session.rs) runs its sessions on worker threads and joins them only after its last check. If the test fails before then, or a worker panics, some workers are never joined, and the test binary can exit while a session is still held. Process exit runs no other thread's destructors, so that session's agent account stays on the host.

Steps to reproduce

Read from the code at d22e3515; not run.

  1. The main thread's expect calls before the join loop, such as "every run must report that it started", panic without joining the workers.
  2. Its dropped channel ends make waiting workers panic and drop their sandbox handles, which starts each session's teardown, but nothing waits for it, and a worker still reading its output keeps its session.
  3. The join loop's expect("a run thread must not panic") stops at the first worker that panicked and leaves the rest unjoined.

Expected behavior

A failing run of the test ends every session it started before the test binary exits.

Actual behavior

A session can still be held when the test binary exits, leaving its agent account on the host.

adpa-ms avatar Nov 03 '26 21:11 adpa-ms

[AgentAssisted] A possible fix: on any failure, release the runs that are still held, then join every worker with a bounded wait, continuing past one that panicked, and only then fail the test.

adpa-ms avatar Nov 17 '26 19:11 adpa-ms