From 1c2469ada4cabec2a5e7916a115e1cd83b2081de Mon Sep 17 00:00:00 2001 From: Friel Date: Thu, 2 Apr 2026 22:57:28 +0000 Subject: [PATCH] Fix duplicate watchdog helper completion forwarding --- codex-rs/core/src/agent/control.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/codex-rs/core/src/agent/control.rs b/codex-rs/core/src/agent/control.rs index 4ea68fc46b..6db9c6a8b5 100644 --- a/codex-rs/core/src/agent/control.rs +++ b/codex-rs/core/src/agent/control.rs @@ -1106,23 +1106,11 @@ impl AgentControl { .owner_for_active_helper(child_thread_id) .await { - let helper_sent_input = match control.upgrade() { - Ok(state) => state - .get_thread(child_thread_id) - .await - .ok() - .map(|thread| thread.last_completed_turn_used_agent_send_input()) - .unwrap_or(false), - Err(_) => false, - }; - if !helper_sent_input { - let fallback_message = watchdog_fallback_message_from_status(&status); - if let Some(message) = fallback_message { - let _ = control - .send_watchdog_wakeup(owner_thread_id, child_thread_id, message) - .await; - } - } + // The watchdog manager owns helper fallback delivery and cleanup. + // Returning here avoids duplicate `agent_inbox` injections for one helper + // completion: the generic child completion watcher and the watchdog manager + // should not both forward the same helper's final assistant message. + let _ = owner_thread_id; return; }