mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add response processing after completion and usage accounting (#61577)
## Why Streaming can dispatch tools before a response finishes and its usage is accounted for. Allow callers to wait for completion and synchronous post-hooks so budget enforcement can block tools from the response that exhausts the budget. ## What changed - Add `responses.process_mode = "after_complete_response"` to buffer response items and release them in order after completion, synchronous post-hooks, and usage accounting. Keep `streaming` as the default and deliver safety-buffering notifications immediately. - Track whether response usage has already been charged to avoid duplicate accounting, including during compaction. - Stop new tools across the agent tree when the rollout budget is exhausted. Coordinate steering with accounting and prevent buffered tool calls from dispatching after steering or cancellation. - Bound buffered responses to 65,535 events and reject overflow. ## Testing Add configuration coverage and extend integration tests for buffered output ordering, synchronous hooks, interrupted responses and resume, steering, invalid usage, and budget exhaustion preventing tool dispatch. GitOrigin-RevId: bd06811cfd50cb701babe6353465c57dfed2a37a
This commit is contained in:
@@ -394,6 +394,7 @@ async fn new_config(
|
||||
experimental_request_user_input_enabled: true,
|
||||
update_plan_enabled: true,
|
||||
tool_registry: Default::default(),
|
||||
response_process_mode: Default::default(),
|
||||
code_mode: Default::default(),
|
||||
background_terminal_max_timeout: 300_000,
|
||||
thread_unload_delay: std::time::Duration::from_secs(/*secs*/ 60),
|
||||
|
||||
Reference in New Issue
Block a user