Repository navigation
fix(hooks): send Codex a decision it enforces, not Cursor's - #246
Merged
Merged
Conversation
The 0.9.0 fix that gave each agent its own decision format missed Codex.
It kept receiving Cursor's {"permission": "deny"}. Codex parses hook
output with serde deny_unknown_fields, so it rejected that as invalid,
marked the hook run failed, and ran the tool. The hook had already
written the call to the trail as outcome: denied. Every DLP and
tool-policy block on Codex failed open, and the record said it worked.
Codex now gets its own schema. Three more of its rejections, each also
a silent allow, are handled: a deny always carries a non-empty reason,
an ask is sent as deny (parsed, not supported), and an allow is {}
rather than an allow without updatedInput.
The tests validate every Codex decision against the output schemas
Codex publishes (openai/codex 806d2d1, Apache-2.0, copied into
tests/fixtures/codex_hooks/), because a shape check is what certified
the wrong format last time. All 11 new tests fail on the old code.
Checked against Codex's parser source; Codex itself was not run.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1642 passed and 8 skipped (1650 collected), coverage 82%, from the orchestrator (ubuntu-latest) job on f6fef75. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The 0.9.0 fix that gave each agent its own hook decision format missed Codex.
codexis not in_CLAUDE_PROTOCOL, so_decision_outputfell through to Cursor's{"permission": "deny"}with exit code 0.Codex parses hook output with serde
deny_unknown_fields(codex-rs/hooks/src/schema.rs). Output it cannot parse is markedFailedand the tool runs (events/pre_tool_use.rs, thelooks_like_jsonbranch). So every DLP and tool-policy block on Codex failed open, while the trail recorded the call asoutcome: denied.Found while building an agent coverage matrix. No test covered Codex's deny output.
The fix
_codex_decision_outputinhooks/ingest.py, following Codex's parser atopenai/codex806d2d1(2026-10-08):hookSpecificOutput.permissionDecision: "deny", plus a reason that is never empty (Codex rejects an empty one)decision.behavior: "deny", plusmessageaskand rejects it){}(Codex rejectsallowwithoutupdatedInput)behavior: "allow"Every other agent's format is unchanged.
Tests
tests/fixtures/codex_hooks/(Apache-2.0, source commit recorded in the README there). They also apply the rejections the schemas can't express.hook_mainwith Codex'sBashinput.agentmetry benchmarkshows 0 missed and 0 false positives, and the fingerprint is still15846a0915769d4a. No frozen file is touched.Not verified
deniedevents for calls that ran. The CHANGELOG entry says so.Worth a 0.9.5 release once merged.
🤖 Generated with Claude Code