# RB-06 MAJOR: native capture worker is detached, can outlive stop/start **Severity:** MAJOR **Path:** `src-tauri/src/commands/audio.rs:46-228` **Source:** [2026-04-22 code review](../code-review-2026-04-22.md) **Labels:** release-blocker, major, concurrency, audio ## Problem `start_native_capture` and `stop_native_capture` coordinate through a channel but never retain the spawned worker handle. A previous capture can still be flushing / appending after `stop_native_capture` clears `all_samples` and before a new `start_native_capture` takes it — output can be truncated or contaminated with cross-session samples. ## Acceptance - Store the worker's `JoinHandle` in the native capture state. - `stop_native_capture` awaits the handle before returning — start/stop/start is fully serialised. - Regression test: rapid start → stop → start sequence produces two distinct samples vectors with no cross-session leakage. ## Fix scope Medium. Requires adding `JoinHandle` storage and making the stop path `await` cleanly — probably needs a small refactor of the native capture state struct. ## Dependencies - Independent of other items, though the fix pattern (retain handles, join on stop) mirrors what RB-04 will do for the live-session worker.