A creature per agent session in the terminal — and a Codex hooks question I can't answer myself #40034
Replies: 2 comments
|
I can confirm that Codex hooks can appear to be completely silent when the hook itself fails during session startup. On one affected macOS installation, the
with:
The CLI then exited with status 0 but produced no assistant message. That made the symptom look like a model or Desktop prompt hang even though the actual failure happened before the agent turn began. The most useful generic smoke test is to invoke the hook directly with a representative startup event and inspect the JSON response. A successful hook should return an The fix was to make the hook read the canonical instruction file directly, remove the obsolete required-section check, and make optional instruction files or sections non-fatal. After that change, both the standalone and ChatGPT-bundled Codex binaries passed 10/10 ephemeral trivial prompts. I would also recommend that the hook documentation clearly distinguish:
Those states currently look too similar from the user’s perspective. |
|
Thanks - your answer was the push I needed, and I have now gone and tested it rather than Untrusted hooks do not run, and that is indistinguishable from brokenThis was my whole problem. My hooks had been sitting in Same config, same binary, one flag apart. Non-JSON on stdout from SessionStart is toleratedThe question I asked you. Answer: no, it does not fail the turn. My Related, from reading the binary's strings: the only invalid-JSON error is scoped to And The payloads, since they are not documented anywhere I could find
Both carry What I am changing at my endThe bug was mine and it was not the one I thought. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I maintain a small Go tool that gives each agent session its own ASCII creature, so that
several sessions running across several git worktrees stop looking identical. It supports
Codex, and I have a question about that support I genuinely cannot answer myself.
https://github.com/TevvvB/termagitchi
pets installwrites hooks for both Claude Code and Codex -SessionStart,PostToolUseand
Stop. The Claude Code path I use every day. The Codex path has never once runagainst a real Codex, and the readme says so rather than implying otherwise.
Two things changed this week that make the question worth asking now. Registration used to
happen only from the status line, and Codex has no status-line support, so a Codex session
would have been invisible in
pets denandpets partyeven if its hooks fired perfectly.That was the actual bug, and it is fixed - every hook now registers, and session start also
refreshes state so the listing is populated from the first turn rather than the second.
So the remaining unknown is narrow: do the hooks fire at all?
What I think I know from reading
codex-rs/hooks/: there is aPostToolUseevent and ahooks.jsonthat gets read. But the config carriesenabledandtrusted_hashper hook,which reads like a hook has to be trusted before it will run. If that is right then writing
the file is necessary but not sufficient, and the readme should say what the extra step is
instead of leaving people to find out.
If anyone here runs Codex and is willing to try
pets install --harness=codex, the usefulanswers are:
something it can tell you to do?
session, so if Codex names sessions differently that is the interesting part.
An "it silently did nothing" report is a complete answer and more useful to me than a patch.
No Go required.
Renamed since posting: this is now termagitchi (https://github.com/TevvvB/termagitchi). The old URL redirects, and the binary is still
pets.All reactions