[codex] Add subagent identity to hook inputs#22882
Draft
abhinav-oai wants to merge 1 commit into
Draft
Conversation
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a normal hook fires inside a thread-spawned subagent, Codex now includes these optional top-level fields in the hook input:
agent_id: the child thread id.agent_type: the resolved subagent type.Root-agent hook inputs omit these fields.
SubagentStartandSubagentStopkeep their existing requiredagent_idandagent_typefields because those events are inherently subagent-scoped.This does not change matcher behavior. Tool hooks still match on tool name, compact hooks still match on trigger, and
UserPromptSubmitstill ignores matchers. OnlySubagentStartandSubagentStopmatch onagent_type.Lifecycle Scope
Only thread-spawned subagents receive
agent_idandagent_typeon normal hook inputs.Internal/system subagents such as Review, Compact, MemoryConsolidation, and Other do not receive identity metadata. This PR also does not broaden hook dispatch for those internal paths.
Follow Ups
effortfield to hook inputs that run with model effort context, includingSubagentStop.Stack
SubagentStart.SubagentStop.