Lightweight coding agent that runs in your terminal
Rust
Handle exec shutdown on Interrupt (fixes immortal `codex exec` with websockets) (#10519)
Rasmus Rygaarde3d39013d328
diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rsindex 9175b100a5..cbe45b92f1 100644--- a/codex-rs/exec/src/event_processor_with_human_output.rs+++ b/codex-rs/exec/src/event_processor_with_human_output.rs@@ -593,17 +593,20 @@ impl EventProcessor for EventProcessorWithHumanOutput {view.path.display());}- EventMsg::TurnAborted(abort_reason) => match abort_reason.reason {- TurnAbortReason::Interrupted => {- ts_msg!(self, "task interrupted");- }- TurnAbortReason::Replaced => {- ts_msg!(self, "task aborted: replaced by a new task");- }- TurnAbortReason::ReviewEnded => {- ts_msg!(self, "task aborted: review ended");+ EventMsg::TurnAborted(abort_reason) => {+ match abort_reason.reason {+ TurnAbortReason::Interrupted => {+ ts_msg!(self, "task interrupted");+ }+ TurnAbortReason::Replaced => {+ ts_msg!(self, "task aborted: replaced by a new task");+ }+ TurnAbortReason::ReviewEnded => {+ ts_msg!(self, "task aborted: review ended");+ }}- },+ return CodexStatus::InitiateShutdown;+ }EventMsg::ContextCompacted(_) => {ts_msg!(self, "context compacted");}diff --git a/codex-rs/exec/src/event_processor_with_jsonl_output.rs b/codex-rs/exec/src/event_processor_with_jsonl_output.rsindex 823fa7b810..9675651ef7 100644--- a/codex-rs/exec/src/event_processor_with_jsonl_output.rs+++ b/codex-rs/exec/src/event_processor_with_jsonl_output.rs@@ -871,6 +871,7 @@ impl EventProcessor for EventProcessorWithJsonOutput {}CodexStatus::InitiateShutdown}+ protocol::EventMsg::TurnAborted(_) => CodexStatus::InitiateShutdown,protocol::EventMsg::ShutdownComplete => CodexStatus::Shutdown,_ => CodexStatus::Running,}