mirror of
https://github.com/openai/codex.git
synced 2026-11-11 14:32:25 +00:00
Simplify queued user message admission (#38092)
## What changed - Resolve user message admission when Core accepts the input as a new turn or a steer, without waiting for rollout persistence. - Remove persistence- and hook-specific admission errors and task bookkeeping. - Delete queued messages after Core accepts them for turn processing, including messages subsequently stopped by a prompt hook. ## Testing - Update concurrent admission and queue service tests for acceptance-based admission. GitOrigin-RevId: 7dcc311cfecd3d710733b420f2add546edb86153
This commit is contained in:
1 parent
4c89139da9
commit
da2803c73c
14 files changed
+41
-600
No files matched your search
@@ -18,7 +18,6 @@ use crate::hook_runtime::drain_async_hook_results;
|
||||
use crate::hook_runtime::inspect_pending_input;
|
||||
use crate::hook_runtime::record_additional_contexts;
|
||||
use crate::hook_runtime::record_pending_input;
|
||||
use crate::hook_runtime::reject_pending_input;
|
||||
use crate::hook_runtime::run_legacy_after_agent_hook;
|
||||
use crate::hook_runtime::run_pending_session_start_hooks;
|
||||
use crate::hook_runtime::run_turn_stop_hooks;
|
||||
@@ -603,34 +602,26 @@ pub(crate) async fn run_hooks_and_record_inputs(
|
||||
) -> bool {
|
||||
let mut blocked_input = false;
|
||||
let mut accepted_user_input = false;
|
||||
let mut persistence_failed = false;
|
||||
for input_item in input {
|
||||
let hook_outcome = inspect_pending_input(sess, turn_context, input_item).await;
|
||||
if hook_outcome.should_stop {
|
||||
blocked_input = true;
|
||||
reject_pending_input(sess, turn_context, input_item).await;
|
||||
record_additional_contexts(sess, turn_context, hook_outcome.additional_contexts).await;
|
||||
} else {
|
||||
if matches!(input_item, TurnInput::UserInput { content, .. } if !content.is_empty()) {
|
||||
accepted_user_input = true;
|
||||
}
|
||||
if record_pending_input(
|
||||
record_pending_input(
|
||||
sess,
|
||||
turn_context,
|
||||
input_item.clone(),
|
||||
hook_outcome.additional_contexts,
|
||||
persist_context,
|
||||
)
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
// Preserve later drained inputs, but stop before sampling so a
|
||||
// later queue retry cannot execute this message twice.
|
||||
persistence_failed = true;
|
||||
}
|
||||
.await;
|
||||
}
|
||||
}
|
||||
persistence_failed || (blocked_input && !accepted_user_input)
|
||||
blocked_input && !accepted_user_input
|
||||
}
|
||||
|
||||
fn turn_user_input(input: &[TurnInput]) -> Vec<UserInput> {
|
||||
|
||||
Reference in new issue
Block a user