mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
merge conflicts
This commit is contained in:
@@ -2738,6 +2738,7 @@ mod tests {
|
||||
content: vec![codex_protocol::models::ContentItem::InputText {
|
||||
text: "plain text".into(),
|
||||
}],
|
||||
metadata: None,
|
||||
end_turn: None,
|
||||
phase: None,
|
||||
}),
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -259,6 +259,7 @@ fn parses_hook_prompt_and_hides_other_contextual_fragments() {
|
||||
.to_string(),
|
||||
},
|
||||
],
|
||||
metadata: None,
|
||||
end_turn: None,
|
||||
phase: None,
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user