mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
## Why A thread can reserve a turn slot and assign a turn ID while it still waits for host admission. Callers need to distinguish a pending turn from one cleared to execute. ## What changed Add `turn_admission_state()` to report `Idle`, `Pending` with an optional turn ID, or `Admitted` with a turn ID in a single snapshot. Host-managed turns become admitted after a grant is installed. Native turns are admitted synchronously, including when no execution guard is needed. The current slot retains its admitted state through finishing. Reject superseded submissions before they can overwrite an owned slot, and verify that a host grant still belongs to the current turn and task before recording admission. ## Testing Cover the admission state while a host decision is pending, after an interrupt, during execution after a grant, and after the slot returns to idle. Cover native admission without a host guard. GitOrigin-RevId: 0633dc036aef99433505559c92b0b1b26a023352