Expose root/subagent metadata in hook payloads
What variant of Codex are you using?
CLI
What feature would you like to see?
Codex hook payloads identify the emitting session and turn, but they do not say whether the hook came from the root agent or from a spawned subagent.
This matters for hook integrations that update shared external state. For example, workmux marks a tmux window working on UserPromptSubmit and done on Stop. If a subagent finishes before its parent, the subagent Stop marks the window as done while the parent is still running. (Claude Code does not behave like this, subagents don't trigger hooks at all.)
The parent and subagent have distinct session_id and turn_id values, but the hook payload does not expose a root/subagent indicator, parent id, depth, or agent path. A hook handler therefore cannot tell whether a Stop event belongs to the root agent or a child agent.
Codex appears to already track this internally via subagent session metadata:
ThreadSpawn {
parent_thread_id: ThreadId,
depth: i32,
agent_path: Option<AgentPath>,
agent_nickname: Option<String>,
agent_role: Option<String>,
}
My request is to include some kind of stable root/subagent relationship metadata in hook payloads, for example:
{
"agent_path": "/root/task_1",
"parent_session_id": "019de386-3b26-7a10-9109-fff7621fd637",
"depth": 1,
"is_subagent": true
}
This would let hook integrations handle nested Codex agent flows without parsing transcripts or relying on (session_id, turn_id) heuristics.
Related https://github.com/raine/workmux/commit/309188b764f8cbffbc07cb4d8aba698a6b576b0d
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗