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
@@ -123,6 +123,9 @@ impl Session {
|
||||
));
|
||||
}
|
||||
|
||||
let (input_persisted_sender, input_persisted_receiver) =
|
||||
has_user_input.then(tokio::sync::oneshot::channel).unzip();
|
||||
let original_input = input.clone();
|
||||
let task_input = if has_user_input {
|
||||
self.clear_connector_selection().await;
|
||||
for item in &input {
|
||||
@@ -141,9 +144,18 @@ impl Session {
|
||||
turn_context,
|
||||
task_input,
|
||||
RegularTask::new(),
|
||||
input_persisted_sender,
|
||||
MailboxParentProvenance::Ignore,
|
||||
)
|
||||
.await;
|
||||
if let Some(receiver) = input_persisted_receiver {
|
||||
return receiver
|
||||
.await
|
||||
.unwrap_or(Err(
|
||||
TryStartTurnIfIdleRejectionReason::TaskEndedBeforePersistence,
|
||||
))
|
||||
.map_err(|reason| TryStartTurnIfIdleError::new(reason, original_input));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user