Repository navigation
Description
Problem
#1595 ships the harness lifecycle reporter for Claude only. The owner ruled on 2026-10-12 (recorded in the #1595 spec, head 7f12b19) that a Codex reporter is a follow-up, not part of that build. This issue carries it.
Without it, Codex-driven agents keep the PTY-silence inference for their attention state while Claude agents report real lifecycle events, so the two harnesses render differently in Tower and the VS Code sidebar.
What is already established (from the #1595 spec, verified live on codex-cli 0.162.1)
- Codex has a lifecycle-hook system that mirrors Claude's:
SessionStart,SessionEnd,UserPromptSubmit,PreToolUse,PermissionRequest,PostToolUse,PreCompact,PostCompact,SubagentStart,SubagentStop,Stop, plus anInterrupthook Claude does not have. NoNotification/ idle event. Command handlers supportasync: true. - Hooks supplied per launch with
-c hooks.<Event>=[...]config overrides fire (the analogue of Claude's--settingsinjection), and an environment variable set at launch reaches the hook process. - Non-managed hooks must be trusted before they run, recorded against the hook's content hash. An untrusted hook is skipped silently.
--dangerously-bypass-hook-trustruns them for one invocation but bypasses trust for every enabled hook, including the user's own, so codev must not use it without an owner decision. - In
execmode Codex printed ahook: Stop Completedstatus line.
Scope
- Add a Codex reporter behind the same provider capability (
buildLifecycleReporterInjection) and the same wire contract (AgentLifecycleEvent, five neutral event names) that Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 introduces. No new types, no new Tower route. - Inject via
codex -c hooks.<Event>overrides on every launch path the capability covers (spawn,afx spawn --resume,afx workspace recover), with the agent identity injected through the launch environment so the hook command stays byte-identical across agents (required for hash-based trust). - Event mapping:
SessionStart->session-started;UserPromptSubmit->turn-started;PreToolUse/PostToolUse->tool-activity;PermissionRequest->needs-input;StopandInterrupt->turn-ended. Verify each against the payload before locking it in.
First tasks (design, before any code)
- Trust. Decide how codev's stable reporter hook becomes trusted without the bypass flag. Candidates: a one-time trust of the stable reporter command (for example through Codex's
/hooksflow), or a managed-hook path if one exists. State what happens on first launch before trust is granted (the reporter is silently skipped, so the agent falls back to the Agent attention states (working / needs-input / idle / dead) from harness lifecycle hooks instead of PTY-silence inference #1595 staleness rule; that must stay acceptable). - TUI noise. Confirm whether the
hook: ... Completedstatus line appears in the interactive TUI, not justexec, and whether it is suppressible. A visible line per tool call is not shippable.
Verification
Exercise the real path: spawn a Codex builder, confirm the served agentState row moves through working / needs-input / idle on real turns, and confirm an interrupted turn lands as turn-ended.
Protocol and routing
PIR (the trust question needs an approach review before coding). Touches the Codex harness provider in core only; contract surface is unchanged. Owner: main (harness providers are main's sphere); filed by the vscode seat on the #1595 builder's request.
Refs #1595.
Activity
[Spec 1595] Reference Codex follow-up #1796
[Spec 1595] Reference Codex follow-up #1796