diff --git a/codex-rs/app-server-protocol/src/protocol/thread_history.rs b/codex-rs/app-server-protocol/src/protocol/thread_history.rs index d7482b10c3..549bf966ba 100644 --- a/codex-rs/app-server-protocol/src/protocol/thread_history.rs +++ b/codex-rs/app-server-protocol/src/protocol/thread_history.rs @@ -2738,6 +2738,7 @@ mod tests { content: vec![codex_protocol::models::ContentItem::InputText { text: "plain text".into(), }], + metadata: None, end_turn: None, phase: None, }), diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 5023f9ee39..59d05f58a8 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -3947,14 +3947,7 @@ impl Session { } } - pub async fn prepend_pending_input(&self, input: Vec) -> Result<(), ()> { - self.prepend_pending_input_with_metadata( - input.into_iter().map(|item| (item, None)).collect(), - ) - .await - } - - async fn prepend_pending_input_with_metadata( + pub(crate) async fn prepend_pending_input_with_metadata( &self, input: Vec<(ResponseInputItem, Option)>, ) -> Result<(), ()> { @@ -3965,10 +3958,12 @@ impl Session { ts.prepend_pending_input( input .into_iter() - .map(|(input, user_message_type)| crate::state::PendingInputItem { - input, - user_message_type, - }) + .map( + |(input, user_message_type)| crate::state::PendingInputItem { + input, + user_message_type, + }, + ) .collect(), ); Ok(()) @@ -3977,17 +3972,6 @@ impl Session { } } - pub async fn get_pending_input(&self) -> Vec { - let mut active = self.active_turn.lock().await; - match active.as_mut() { - Some(at) => { - let mut ts = at.turn_state.lock().await; - ts.take_pending_input() - } - None => Vec::with_capacity(0), - } - } - pub async fn has_pending_input(&self) -> bool { let active = self.active_turn.lock().await; match active.as_ref() { diff --git a/codex-rs/core/src/codex_tests.rs b/codex-rs/core/src/codex_tests.rs index 6805ca07ad..d8e3e7129c 100644 --- a/codex-rs/core/src/codex_tests.rs +++ b/codex-rs/core/src/codex_tests.rs @@ -4514,8 +4514,8 @@ async fn prepend_pending_input_keeps_older_tail_ahead_of_newer_input() { .await .expect("inject initial pending input into active turn"); - let drained = sess.get_pending_input().await; - assert_eq!(drained, vec![blocked, later.clone()]); + let drained = sess.get_pending_input_with_metadata().await; + assert_eq!(drained, vec![(blocked, None), (later.clone(), None)]); sess.inject_response_items(vec![newer.clone()]) .await @@ -4523,11 +4523,14 @@ async fn prepend_pending_input_keeps_older_tail_ahead_of_newer_input() { let mut drained_iter = drained.into_iter(); let _blocked = drained_iter.next().expect("blocked prompt should exist"); - sess.prepend_pending_input(drained_iter.collect()) + sess.prepend_pending_input_with_metadata(drained_iter.collect()) .await .expect("requeue later pending input at the front of the queue"); - assert_eq!(sess.get_pending_input().await, vec![later, newer]); + assert_eq!( + sess.get_pending_input_with_metadata().await, + vec![(later, None), (newer, None)] + ); } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] diff --git a/codex-rs/core/src/event_mapping_tests.rs b/codex-rs/core/src/event_mapping_tests.rs index 5c77991d97..befd9463bd 100644 --- a/codex-rs/core/src/event_mapping_tests.rs +++ b/codex-rs/core/src/event_mapping_tests.rs @@ -259,6 +259,7 @@ fn parses_hook_prompt_and_hides_other_contextual_fragments() { .to_string(), }, ], + metadata: None, end_turn: None, phase: None, }; diff --git a/codex-rs/core/src/state/turn.rs b/codex-rs/core/src/state/turn.rs index 4718f24c14..1aac95ae0a 100644 --- a/codex-rs/core/src/state/turn.rs +++ b/codex-rs/core/src/state/turn.rs @@ -212,13 +212,6 @@ impl TurnState { self.pending_input = input; } - pub(crate) fn take_pending_input(&mut self) -> Vec { - self.take_pending_input_with_metadata() - .into_iter() - .map(|item| item.input) - .collect() - } - pub(crate) fn has_pending_input(&self) -> bool { !self.pending_input.is_empty() }