You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 9, 2026. It is now read-only.
Reject blocked PostToolUse results in code mode #391
Make blocking PostToolUse outcomes fail closed for code-mode JavaScript while preserving established direct-mode and pre-tool hook behavior.
Finish Line
After a tool side effect completes, an explicit blocking result or hook exit code 2 suppresses the successful result and rejects the code-mode tool promise; feedback-only continue:false, direct-mode replacement behavior, and existing PreToolUse semantics do not regress.
Current Status
Update 2026-07-22 UTC — implemented in PR #402 from code/post-tool-use-code-mode-391 at 2d94aa08b9.
The missing local behavior was isolated to codex-core tool-result handling. The codex-hooks parser and exit-code normalization from upstream commit d7f298fe20a560fc5bfab78ef19e0c76b4d201bb were already present, so the production change now rejects blocked completed results before they can reach code-mode JavaScript while preserving the completed side effect.
Coverage now proves:
explicit PostToolUse block and exit code 2 reject the nested promise after execution
the original successful result is hidden from JavaScript
continue:false remains feedback-only and resolves with the original typed result
PreToolUse block still prevents execution and input rewrite still returns the rewritten result
caught nested errors leave the outer code cell successful
direct-mode replacement tests continue to pass
Validation completed:
regression failed before the production fix and passed after it
focused final code-mode hook set passed 5/5
codex-hooks passed 128/128
broad codex-core completed 2,988 tests with 2,920 passing, 68 unrelated baseline/environment failures, and 16 skipped; all new tests passed
scoped no-deps Clippy passed after allowing only documented pre-existing deny-level lints
just fmt, git diff --check, and final specialist reviews passed
JetBrains reported zero problems but could not prove semantic Rust coverage for the two changed files
Next action: watch PR #402 through CI and review, merge when green, then close #391 and update parent #307.
Existing PreToolUse block and input-rewrite behavior does not regress.
Focused integration coverage under codex-rs/core/tests/suite uses test_codex and covers explicit blocking, exit code 2, feedback-only behavior, direct mode, and pre-tool regression boundaries.
just test -p codex-core and just test -p codex-hooks pass; because codex-core changes, the complete just test gate is run per repository workflow before final handoff.
The implementation stays below 500 changed lines of complex logic and 800 total changed lines.
Objective
Make blocking
PostToolUseoutcomes fail closed for code-mode JavaScript while preserving established direct-mode and pre-tool hook behavior.Finish Line
After a tool side effect completes, an explicit blocking result or hook exit code
2suppresses the successful result and rejects the code-mode tool promise; feedback-onlycontinue:false, direct-mode replacement behavior, and existingPreToolUsesemantics do not regress.Current Status
Update 2026-07-22 UTC — implemented in PR #402 from
code/post-tool-use-code-mode-391at2d94aa08b9.The missing local behavior was isolated to
codex-coretool-result handling. Thecodex-hooksparser and exit-code normalization from upstream commitd7f298fe20a560fc5bfab78ef19e0c76b4d201bbwere already present, so the production change now rejects blocked completed results before they can reach code-mode JavaScript while preserving the completed side effect.Coverage now proves:
PostToolUseblock and exit code 2 reject the nested promise after executioncontinue:falseremains feedback-only and resolves with the original typed resultPreToolUseblock still prevents execution and input rewrite still returns the rewritten resultValidation completed:
codex-hookspassed 128/128codex-corecompleted 2,988 tests with 2,920 passing, 68 unrelated baseline/environment failures, and 16 skipped; all new tests passedjust fmt,git diff --check, and final specialist reviews passedNext action: watch PR #402 through CI and review, merge when green, then close #391 and update parent #307.
Blocked by: none.
Waiting for: PR #402 CI and review.
Scope
codex-coretool registry/code-mode result conversion,codex-hookspost-tool outcomes, and focused core/hooks integration coverage.Acceptance Criteria
2run after the tool side effect and reject the code-mode JavaScript promise.PostToolUse continue:falseremains feedback-only rather than blocking.PreToolUseblock and input-rewrite behavior does not regress.codex-rs/core/tests/suiteusestest_codexand covers explicit blocking, exit code2, feedback-only behavior, direct mode, and pre-tool regression boundaries.just test -p codex-coreandjust test -p codex-hookspass; becausecodex-corechanges, the completejust testgate is run per repository workflow before final handoff.Relationships
Decisions