PreToolUse hook rejects valid command rewrite unless `permissionDecision: "allow"` is also returned
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What issue are you seeing?
PreToolUse hook rejects valid command rewrite unless permissionDecision: "allow" is also returned
Environment
- OS: Windows 11 Pro
- Codex CLI:
0.155.1 - Codex executable:
C:\Users\getra\AppData\Local\Programs\OpenAI\Codex\bin\codex.exe - sctx:
0.10.0 - sctx executable:
C:\Users\getra\.local\bin\sctx.exe - Codex home:
C:\Users\getra\.codex
What steps can reproduce the bug?
Problem
The official sctx Codex PreToolUse integration attempts to rewrite shell commands through sctx.
For example:
git status
should be rewritten to:
sctx git status
sctx returns an updatedInput value containing the rewritten command.
However, Codex rejects the hook response because it does not also contain:
"permissionDecision": "allow"
Codex reports:
PreToolUse Failed
and then executes the original command without the sctx wrapper.
What is the expected behavior?
Expected behavior
A PreToolUse hook that only wants to rewrite the tool input should either:
- be allowed to return
updatedInputwithout an explicit permission decision, or - the hook contract/documentation/schema should clearly require
permissionDecision: "allow"whenupdatedInputis returned.
The rewritten command should then be executed.
Additional information
Actual behavior
The hook rewrite fails validation.
Codex then runs the original command instead:
git status
rather than:
sctx git status
Verification
Direct sctx usage works correctly.
Tests performed successfully:
sctx doctor- direct Git command through sctx
- direct ripgrep command through sctx
- non-zero exit code preservation
- raw-output recovery
The failure occurs specifically at the Codex PreToolUse integration boundary.
A fresh Codex session was used to rule out stale configuration.
Additional context
The same sctx installation successfully integrates with Claude Code.
This appears to be either:
- a Codex hook schema/validation compatibility issue, or
- a requirement that third-party hook authors must always return
permissionDecision: "allow"together withupdatedInput.
It would be helpful to clarify the intended PreToolUse contract.
Potentially related:
- #25555 — Hook output schemas allow values later rejected by parser
- #32544 — PreToolUse
updatedInputrewrite behavior - #18491 — PreToolUse /
updatedInputrewrite support
Reproduction outline
- Install Codex CLI
0.155.1. - Configure a trusted
PreToolUsehook. - Have the hook return a valid
updatedInputcommand rewrite but no explicitpermissionDecision. - Start a fresh Codex session.
- Run a harmless shell command such as
git status. - Observe
PreToolUse Failed. - Observe that Codex executes the original command instead of the rewritten command.
Desired outcome
Either:
- permit
updatedInput-only rewrites, or - document/enforce a clear schema requiring something equivalent to:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"updatedInput": {
"command": "sctx git status"
}
}
}
so integrations such as sctx can implement the Codex hook contract reliably.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the PreToolUse hook validation and parsing entry points, focusing on the interaction between updatedInput and permissionDecision. Compare the behavior with related issues #25555, #32544, and #18491. Done means rewrite-only responses are accepted or the required response shape is clearly enforced and documented, with coverage for a git status-style rewrite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100