openai / openai/codex

Add a hook after all tool calls from one assistant response complete

Open
#41,589 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI enhancement hooks
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:

  1. Codex emits the existing PostToolUse event for each result.
  2. After all three resolve, Codex emits one batch-level event containing all
    three calls and results.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.