Codex hooks give you no exit status for a shell command. Here is how I record it anyway and block "done" on stale test results.
热度趋势
趋势数据积累中
百分比基于当前可用热度信号,而非评论数或独立用户人数。
GitHub 相关模型动态已经出现,适合跟踪能力变化、生态影响和后续可用性。
一位开发者在使用 Codex hooks 时发现了一个限制,即 shell 命令的 PostToolUse 有效负载仅提供原始输出。这意味着无法区分命令的退出状态,例如退出代码 3 和退出代码 0。为了解决这个问题,该开发者设计了一种方法来记录退出状态,并阻止在测试结果过时时显示“完成”状态。该解决方案已在 GitHub 上发布,链接为 pavangupta352/stalegreen。
While adding Codex support to a tool I wrote, I found that the PostToolUse payload for a shell command is just the raw output. A command that exits 3 looks exactly like one that exits 0.
The fix that works: the PreToolUse hook rewrites verification commands (pytest, pnpm test, tsc, eslint, cargo test, next build, about eighty runners) so they print their own exit status and keep the full output in a log. Codex accepts the rewrite only with an allow decision, so it is given for the verification command and nothing else.
From there the tool records every run as a receipt, tracks edits, and when the agent ends a turn with "all tests pass" on a run that predates its own edits, or that failed, or whose result was hidden, it turns the stop into a continuation prompt asking for a rerun, once per turn.
On my own Claude Code history the stale rate was 26 percent of green claims, and 98 percent of verification runs hid the exit status. I have not measured enough Codex sessions of my own to quote a number there, and the tool has a stats command that replays your rollouts so you can see yours.
npx stalegreen install --codex writes the hooks to ~/.codex/hooks.json; Codex asks you to trust them once through /hooks. It also works as a Claude Code plugin and as a DeepSeek Harness plugin.
https://github.com/pavangupta352/stalegreen