mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Add host-owned turn admission to the agent runtime (#58963)
## What changed Add `AgentRuntimeOwnership::Host` and an `AgentTurnAdmission` provider so hosts can acquire execution capacity before runtime tasks run, including root turns. Require the provider at startup and retain its execution guard for the task lifetime. Controller ownership remains the default; host ownership skips controller rollout-budget accounting, budget reminders, and subagent roster context. Keep pending admission interruptible without blocking input submission. Report admission failures through the turn lifecycle, record accepted input before exposing the error, and unwind task setup such as review mode. Preserve recoverable input during suspension. On interruption, skip prompts that still require a `UserPromptSubmit` hook rather than recording them without inspection. ## Testing Add integration tests for missing-provider startup cleanup, denial and immediate retry, steering during admission, cancellation, execution guard lifetime, submit-hook handling, suspension recovery, and review-mode cleanup. Add a context snapshot verifying retained input reaches the next admitted turn. GitOrigin-RevId: 9ee85fad2ecfbfb38735bac8ef88888fb179a967
This commit is contained in:
@@ -1408,6 +1408,10 @@ impl CodexThread {
|
||||
&self,
|
||||
control: &dyn AgentControl,
|
||||
) -> CodexResult<()> {
|
||||
// The host checks and reserves capacity when the task starts.
|
||||
if self.session.host_turn_admission().is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
if self.session.active_turn.lock().await.is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user