merge conflicts

This commit is contained in:
Roy Han
2026-03-19 13:59:01 -07:00
parent 80f3b3d1fe
commit 6c4176db18
5 changed files with 16 additions and 34 deletions

View File

@@ -2738,6 +2738,7 @@ mod tests {
content: vec![codex_protocol::models::ContentItem::InputText {
text: "plain text".into(),
}],
metadata: None,
end_turn: None,
phase: None,
}),

View File

@@ -3947,14 +3947,7 @@ impl Session {
}
}
pub async fn prepend_pending_input(&self, input: Vec<ResponseInputItem>) -> 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<UserMessageType>)>,
) -> 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<ResponseInputItem> {
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() {

View File

@@ -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)]

View File

@@ -259,6 +259,7 @@ fn parses_hook_prompt_and_hides_other_contextual_fragments() {
.to_string(),
},
],
metadata: None,
end_turn: None,
phase: None,
};

View File

@@ -212,13 +212,6 @@ impl TurnState {
self.pending_input = input;
}
pub(crate) fn take_pending_input(&mut self) -> Vec<ResponseInputItem> {
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()
}