Add a hook after all tool calls from one assistant response complete
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Problem
Codex currently invokes PostToolUse once per tool result. When one assistant
response issues parallel tool calls, each hook invocation sees only a partial
set of results.
A hook cannot reliably act on the complete set before the next model inference
without guessing batch boundaries.
Requested behavior
Add a batch-level hook that runs exactly once after all tool calls from one
assistant response have completed and before the next model inference.
The hook input should include every tool call and its result, including failures,
cancellations, and interruptions. Context returned by the hook should be
included in the immediately following model inference.
The same event should be emitted for assistant responses containing a single
tool call, so consumers have one consistent control point.
Acceptance example
If one assistant response launches three tools in parallel:
- Codex emits the existing
PostToolUseevent for each result. - After all three resolve, Codex emits one batch-level event containing all
three calls and results. - Context returned by that event is present in the immediately following model
inference.
The batch-level event is not emitted early or more than once.
Related: #21753 tracks PostToolBatch as a missing hook at the umbrella level.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing where existing PostToolUse events are emitted and where an assistant response's parallel tool calls are considered complete. Done means one batch event is emitted after every result, including failures and interruptions, and its returned context reaches the next model inference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100