I was wrapping a long-running node subprocess (an ACP bridge) and surfacing it to SwiftUI via async/await. withTaskCancellationHandler's onCancel runs on an arbitrary thread, so a Task { await actor.method() } posted from there sometimes never executes; the actor is being deallocated during autorelease pool drain by the time the inner Task tries to attach to it. continuation gets orphaned, the view sits spinning forever. The fix that finally held was wrapping the CheckedContinuation in an NSLock-guarded box with a generation token. onCancel resumes the box synchronously, no Task hop, no actor at all. if the generation already moved on, the resume becomes a no-op because a newer subprocess message already won the race. a few dozen lines of plain swift. Separate but related: SwiftUI's WindowGroup wasn't enough to keep multiple detached chat windows independent.…