mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:50:52 +00:00
Drain unified exec launch failure events before session shutdown (#64346)
## 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
This commit is contained in:
@@ -466,6 +466,10 @@ pub(super) async fn shutdown_session_runtime(sess: &Arc<Session>) {
|
||||
|
||||
sess.drain_code_mode_messages().await;
|
||||
|
||||
let writes = &sess.services.unified_exec_manager.launch_failure_writes;
|
||||
writes.close();
|
||||
writes.wait().await;
|
||||
|
||||
crate::hook_runtime::run_session_end_hooks(sess).await;
|
||||
emit_thread_stop_lifecycle(sess).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user