codex icon indicating copy to clipboard operation
codex copied to clipboard

[codex] Add a bounded runtime for async hooks

Open abhinav-oai opened this issue 5 months ago • 0 comments

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: additionalContext and systemMessage are retained, while blocking, steering, and input mutation are ignored
  • output spilling and explicit shutdown for runtime-owned tasks

abhinav-oai avatar Jun 12 '26 05:06 abhinav-oai