mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Add durable user-message queue dispatch (#37204)
## What changed - Add a storage-neutral queue extension for listing, adding, editing, reordering, deleting, and explicitly starting queued user messages. - Dispatch queued messages in FIFO order when a thread becomes idle after a completed turn, while leaving them queued after interruptions or failures. - Wait for user input to be persisted before removing its queue item, and report hook rejection, task termination, and persistence failures distinctly. - Snapshot local image and audio attachments into validated data URLs before storing them, enforce input limits, and emit `ThreadQueueChanged` events after mutations. ## Testing - Cover queue mutations, automatic and explicit dispatch, interruption and failure behavior, hook rejection, invalid records, input limits, and local attachment snapshotting. GitOrigin-RevId: 14f39d7c8cbaccb767a6da84b82cced0edfcb4b9
This commit is contained in:
1 parent
70b4653232
commit
bc8b25ea02
42 files changed
+2114
-140
No files matched your search
@@ -1319,6 +1319,15 @@ impl Session {
|
||||
InitialHistory::Resumed(resumed_history) => {
|
||||
let turn_context = self.new_default_turn().await;
|
||||
let rollout_items = resumed_history.history;
|
||||
if matches!(
|
||||
rollout_items.iter().rev().find_map(|item| match item {
|
||||
RolloutItem::EventMsg(event) => agent_status_from_event(event),
|
||||
_ => None,
|
||||
}),
|
||||
Some(AgentStatus::Interrupted)
|
||||
) {
|
||||
self.agent_status.send_replace(AgentStatus::Interrupted);
|
||||
}
|
||||
let previous_turn_settings = self
|
||||
.apply_rollout_reconstruction(&turn_context, &rollout_items)
|
||||
.await;
|
||||
@@ -4025,7 +4034,7 @@ impl Session {
|
||||
.collect::<Vec<_>>();
|
||||
pending_input.push(TurnInput::UserInput {
|
||||
content: input,
|
||||
client_id: client_user_message_id,
|
||||
client_id: client_user_message_id.clone(),
|
||||
});
|
||||
self.input_queue
|
||||
.extend_pending_input_and_accept_mailbox_delivery_for_turn_state(
|
||||
@@ -4033,6 +4042,10 @@ impl Session {
|
||||
pending_input,
|
||||
)
|
||||
.await;
|
||||
if let Some(client_id) = client_user_message_id.as_deref() {
|
||||
self.pending_user_message_admissions
|
||||
.associate_steered_by_client_id(client_id, active_turn_id);
|
||||
}
|
||||
Ok(active_turn_id.clone())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user