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.
More from coding & agent
- AI agent buys a JJ Watt jersey end-to-end in 13 minutes, with papercuts — jeff_weinstein · 2026-09-03
- rakyll questions whether binary identity and attestation matter in real agentic flows — rakyll · 2026-09-03
- Where Do Multi-Agent Workflows Break in Production: State, Approvals, Eval or Rollback? — Medium-Lie8127 · 2026-09-03
- Tigerless Labs' auto-gtm drafts X/Reddit posts from your PRs, never auto-posts — Aiden_Tech_Ai · 2026-09-03
- How to measure agent quality beyond task success: dev seeks real-world eval metrics — serpratik · 2026-09-03
- Giving your Grok bot an email and a credit card: webhook routines that buy things on Amazon — jeff_weinstein · 2026-09-03