## Why
A launch failure can still be publishing its command events after the turn
is interrupted. If the session shuts down during publication, the failed
command can be lost from persisted thread history.
## What changed
Track in-flight launch failure publications and wait for them to finish
before running session-end hooks and emitting the thread-stop event.
Once shutdown closes the tracker, skip new launch failure publications.
## Testing
Add a regression test that pauses publication for a command with a missing
working directory, interrupts the turn, and requests shutdown. It checks
that shutdown waits and that persisted history records the command as failed
in the interrupted turn.
GitOrigin-RevId: 1fb33d1fd3c11939c0013f5feb4edb737702b0ad