Skip to content

[codex] Add subagent identity to hook inputs#22882

Draft
abhinav-oai wants to merge 1 commit into
abhinav/subagent-stop-stackfrom
abhinav/subagent-hook-context-stack
Draft

[codex] Add subagent identity to hook inputs#22882
abhinav-oai wants to merge 1 commit into
abhinav/subagent-stop-stackfrom
abhinav/subagent-hook-context-stack

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

@abhinav-oai abhinav-oai commented May 15, 2026

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. SubagentStart and SubagentStop keep their existing required agent_id and agent_type fields 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 UserPromptSubmit still ignores matchers. Only SubagentStart and SubagentStop match on agent_type.

Lifecycle Scope

Only thread-spawned subagents receive agent_id and agent_type on 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

  • Add the top-level effort field to hook inputs that run with model effort context, including SubagentStop.

Stack

  1. Add SubagentStart hook #22782: add SubagentStart.
  2. Add SubagentStop hook #22873: add SubagentStop.
  3. This PR: add subagent identity to normal hook inputs.

This was referenced May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant