Codex hooks hide exit codes — stalegreen rewrites verification commands and blocks 26% of stale green claims

SmiLePLSSS · reddit · 2026-09-03

While adding Codex support to a tool, the author found Codex's PostToolUse hook returns only raw output for shell commands — an exit code of 3 looks identical to 0, so the agent can't tell whether verification actually passed.

The fix: a PreToolUse hook rewrites verification commands (pytest, pnpm test, tsc, eslint, cargo test, next build, 80 runners) to print their own exit status and log full output, with an allow decision granted only for verification commands. The tool records each run as a receipt; if the agent ends a turn claiming "all tests pass" on a run that predates its edits, failed, or was hidden, it converts the stop into a continuation prompt requesting a rerun, once per turn.

On the author's Claude Code history, 26% of green claims were stale and 98% of verification runs hid exit status. Install via npx stalegreen install --codex (writes /.codex/hooks.); also works as a Claude Code plugin and DeepSeek Harness plugin. Open source: github.com/pavangupta352/stalegreen.

Original post →

More from coding & agent

coding & agent channel →