mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Refactor rollout budget checks and turn completion state (#61583)
## What changed - Centralize generation admission checks before request contributors run for HTTP and non-warmup WebSocket requests. - Route pending input and inline compaction through dedicated budget checks, and centralize post-compaction budget handling. - Preserve whether any checkpoint was installed when remote compaction combines a background candidate with foreground compaction. - Track accepted final answers separately from trailing commentary and encapsulate the response state shared by stop and after-agent hooks. ## Testing Update the plan-mode contributor test to verify that contributed commentary is tracked separately from final answers, and adapt stream-event assertions to the phase-aware assistant text representation. GitOrigin-RevId: 43b663e92bfd24ec7e5a0778b711938f16a7fea4
This commit is contained in:
@@ -218,7 +218,7 @@ async fn run_remote_compact_task_inner(
|
||||
return Err(error);
|
||||
}
|
||||
}
|
||||
let started_item = if candidate.is_none() {
|
||||
let started_item = if candidate.is_none() && !sess.defer_compaction_start(turn_context, phase) {
|
||||
let item = TurnItem::ContextCompaction(ContextCompactionItem::new());
|
||||
sess.emit_turn_item_started(turn_context, &item).await;
|
||||
Some(item)
|
||||
@@ -264,7 +264,7 @@ async fn run_remote_compact_task_inner(
|
||||
attempt
|
||||
.track(sess.as_ref(), status, codex_error, analytics_details)
|
||||
.await;
|
||||
let result = result.and_then(|installed| sess.check_rollout_budget().map(|()| installed));
|
||||
let result = sess.finish_compaction(turn_context, phase, result);
|
||||
match result {
|
||||
Ok(installed) => Ok(installed),
|
||||
Err(err)
|
||||
|
||||
Reference in New Issue
Block a user