codex
codex copied to clipboard
[codex] Add a bounded runtime for async hooks
Stack 1/3: this PR → #27452 → #27772
Purpose
Async hooks need to finish independently of the operation that launched them, while making their output eligible only for a later model request. That requires session-scoped ownership, deterministic delivery gates, and hard resource limits.
This PR adds that internal foundation without enabling async hooks. Discovery continues to skip handlers configured with async: true until #27452.
What this establishes
- a session-scoped runtime for detached hook commands
- accepted-request generations that determine when output becomes eligible
- a readiness cutoff that prevents completions during prompt submission from racing into the same request
- launch-ordered delivery without letting an unfinished command block later ready output
- limits of 32 in-flight commands, 64 queued completions, and 8 completions or 10,000 estimated tokens per request
- informational-only parsing:
additionalContextandsystemMessageare retained, while blocking, steering, and input mutation are ignored - output spilling and explicit shutdown for runtime-owned tasks