mirror of
https://github.com/openai/codex.git
synced 2026-05-23 12:34:25 +00:00
# What `SubagentStart` runs once when Codex creates a thread-spawned subagent, before that child sends its first model request. Thread-spawned subagents use `SubagentStart` instead of the normal root-agent `SessionStart` hook. Configured handlers match on the subagent `agent_type`, using the same value passed to `spawn_agent`. When no agent type is specified, Codex uses the default agent type. Hook input includes the normal session-start fields plus: - `agent_id`: the child thread id. - `agent_type`: the resolved subagent type. `SubagentStart` may return `hookSpecificOutput.additionalContext`. That context is added to the child conversation before the first model request. # Lifecycle Scope Only thread-spawned subagents run `SubagentStart`. Internal/system subagents such as Review, Compact, MemoryConsolidation, and Other do not run normal `SessionStart` hooks and do not run `SubagentStart`. This avoids exposing synthetic matcher labels for internal implementation paths. Also the `SessionStart` hook no longer fires for subagents, this matches behavior with other coding agents' implementation # Stack 1. This PR: add `SubagentStart`. 2. #22873: add `SubagentStop`. 3. #22882: add subagent identity to normal hook inputs.
195 lines
4.1 KiB
JSON
Generated
195 lines
4.1 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"AbsolutePathBuf": {
|
|
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
|
|
"type": "string"
|
|
},
|
|
"HookEventName": {
|
|
"enum": [
|
|
"preToolUse",
|
|
"permissionRequest",
|
|
"postToolUse",
|
|
"preCompact",
|
|
"postCompact",
|
|
"sessionStart",
|
|
"userPromptSubmit",
|
|
"subagentStart",
|
|
"stop"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookExecutionMode": {
|
|
"enum": [
|
|
"sync",
|
|
"async"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookHandlerType": {
|
|
"enum": [
|
|
"command",
|
|
"prompt",
|
|
"agent"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookOutputEntry": {
|
|
"properties": {
|
|
"kind": {
|
|
"$ref": "#/definitions/HookOutputEntryKind"
|
|
},
|
|
"text": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"kind",
|
|
"text"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"HookOutputEntryKind": {
|
|
"enum": [
|
|
"warning",
|
|
"stop",
|
|
"feedback",
|
|
"context",
|
|
"error"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookRunStatus": {
|
|
"enum": [
|
|
"running",
|
|
"completed",
|
|
"failed",
|
|
"blocked",
|
|
"stopped"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookRunSummary": {
|
|
"properties": {
|
|
"completedAt": {
|
|
"format": "int64",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
},
|
|
"displayOrder": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"durationMs": {
|
|
"format": "int64",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
},
|
|
"entries": {
|
|
"items": {
|
|
"$ref": "#/definitions/HookOutputEntry"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"eventName": {
|
|
"$ref": "#/definitions/HookEventName"
|
|
},
|
|
"executionMode": {
|
|
"$ref": "#/definitions/HookExecutionMode"
|
|
},
|
|
"handlerType": {
|
|
"$ref": "#/definitions/HookHandlerType"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"scope": {
|
|
"$ref": "#/definitions/HookScope"
|
|
},
|
|
"source": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/HookSource"
|
|
}
|
|
],
|
|
"default": "unknown"
|
|
},
|
|
"sourcePath": {
|
|
"$ref": "#/definitions/AbsolutePathBuf"
|
|
},
|
|
"startedAt": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"status": {
|
|
"$ref": "#/definitions/HookRunStatus"
|
|
},
|
|
"statusMessage": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"displayOrder",
|
|
"entries",
|
|
"eventName",
|
|
"executionMode",
|
|
"handlerType",
|
|
"id",
|
|
"scope",
|
|
"sourcePath",
|
|
"startedAt",
|
|
"status"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"HookScope": {
|
|
"enum": [
|
|
"thread",
|
|
"turn"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookSource": {
|
|
"enum": [
|
|
"system",
|
|
"user",
|
|
"project",
|
|
"mdm",
|
|
"sessionFlags",
|
|
"plugin",
|
|
"cloudRequirements",
|
|
"legacyManagedConfigFile",
|
|
"legacyManagedConfigMdm",
|
|
"unknown"
|
|
],
|
|
"type": "string"
|
|
}
|
|
},
|
|
"properties": {
|
|
"run": {
|
|
"$ref": "#/definitions/HookRunSummary"
|
|
},
|
|
"threadId": {
|
|
"type": "string"
|
|
},
|
|
"turnId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"run",
|
|
"threadId"
|
|
],
|
|
"title": "HookCompletedNotification",
|
|
"type": "object"
|
|
} |