fix(codex): recover session lifecycle from hooks
This commit is contained in:
@@ -201,6 +201,8 @@ The `hooks/codex/` directory contains a TypeScript handler for Codex CLI telemet
|
||||
- prompt-submit hooks map user prompts into the next `run.start`
|
||||
- usage payloads emit both `run.end.payload.usage` and a `metric.snapshot` event
|
||||
|
||||
The Codex handler persists lightweight session state across hook subprocesses. If Codex only delivers later-stage hooks for a session, the handler can recover by emitting synthetic `session.start`/`run.start` events before the first `run.end` or usage snapshot. Full-fidelity lifecycle tracking still depends on configuring Codex session lifecycle hooks, not just `notify`.
|
||||
|
||||
Sample Codex hook configuration lives in [hooks/codex/hooks.json](/home/will/lab/agentmon/hooks/codex/hooks.json). On the local Codex CLI version we checked (`0.116.0`), `notify` is confirmed. Online reports suggest prompt-submit hooks may appear as `userpromptsubmit` or `userPromptSubmit`, so the sample config includes those aliases.
|
||||
|
||||
The current Codex integration does not assume tool or subagent span hooks exist. If a newer Codex CLI exposes official tool/span hooks, they can be added separately without changing the run/session flow above.
|
||||
|
||||
Reference in New Issue
Block a user