From bac94585e754de268a595fe978f826e638e05823 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Mon, 18 May 2026 21:01:55 -0700 Subject: [PATCH] Ensure listener for thread settings updates --- .../src/request_processors/turn_processor.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codex-rs/app-server/src/request_processors/turn_processor.rs b/codex-rs/app-server/src/request_processors/turn_processor.rs index 44f01beb11..50cefaf4f0 100644 --- a/codex-rs/app-server/src/request_processors/turn_processor.rs +++ b/codex-rs/app-server/src/request_processors/turn_processor.rs @@ -784,6 +784,14 @@ impl TurnRequestProcessor { .inspect_err(|error| { self.track_error_response(request_id, error, /*error_type*/ None); })?; + let thread_state = self.thread_state_manager.thread_state(thread_id).await; + super::thread_lifecycle::ensure_listener_task_running( + self.listener_task_context(), + thread_id, + thread.clone(), + thread_state.clone(), + ) + .await?; self.wait_for_pending_thread_settings(thread_id).await?; let before_snapshot = thread.config_snapshot().await; let before_thread_settings = thread_settings_from_snapshot(&before_snapshot); @@ -816,7 +824,6 @@ impl TurnRequestProcessor { })?; let update_id = Uuid::now_v7().to_string(); let (thread_settings_applied, notification_lock) = { - let thread_state = self.thread_state_manager.thread_state(thread_id).await; let mut thread_state = thread_state.lock().await; thread_state.track_pending_thread_settings(update_id.clone()) }; @@ -831,7 +838,6 @@ impl TurnRequestProcessor { }) .await { - let thread_state = self.thread_state_manager.thread_state(thread_id).await; let mut thread_state = thread_state.lock().await; thread_state.cancel_pending_thread_settings(&update_id); return Err(internal_error(format!(