Repository navigation
fix(codex): preserve Windows hook exit codes - #1096
Open
daniel-bavrin wants to merge 1 commit into
Open
daniel-bavrin wants to merge 1 commit into
daniel-bavrin wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
daniel-bavrin
force-pushed
the
fix/codex-windows-hook-exit
branch
from
November 19, 2026 08:36
d48e08d to
81a7ba2
Compare
Run Windows hook interpreters with subprocess so the inline launcher code and child status survive. Forward decision and dependency gate statuses through PowerShell and cover both handoffs with regressions.
daniel-bavrin
force-pushed
the
fix/codex-windows-hook-exit
branch
from
November 20, 2026 19:54
81a7ba2 to
a1c191d
Compare
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The Windows Codex hook launcher passed a multiword Python
-cprogram throughos.execv. On native CPython 3.12 the child received onlyfromand printed aSyntaxError, while the launcher returned 0. That status could also lead the SessionEnd worker to mark the event as complete.The Windows hook path now waits for the isolated interpreter and returns its status with standard streams inherited. The two blocking
PreToolUsehooks usecommandWindowsto pass the exit status through PowerShell. This allows Codex to recognize exit 2 and stop the tool call. See OpenAI Codex #54072 for the host shell behavior.Related to #730 (native host lifecycle verification).
Type of change
Test plan
Verified on a clean checkout of
d48e08d7on Windows with Python 3.12.13 and the locked development dependencies.python -m pytest --tb=short -q -rs -p no:randomlyfor the Codex runtime, plugin contracts, SessionEnd queue, and Windows job tests — 63 passed, 0 failed, 1 skipped (POSIX signal/FIFO probe).npm ci --prefix .github/mcpb --ignore-scriptsfollowed bynode --test .github/mcpb/test-forge-security.cjs— 2 passed, 0 failed, 0 skipped.CORTEX_MEMORY_STORE_BACKEND=sqlite CORTEX_RERANKER_OFFLINE=1 python -m pytest --tb=short -q -rs -p no:randomly tests_py/integration— 30 passed, 0 failed, 4 skipped (require the PostgreSQL extra).scripts/ci_unit.shattempted on the same commit. Its PostgreSQL setup stopped before collection because Windows CPython has nofcntl.SyntaxError, and the manifest test failed because the Windows overrides were absent.apply_patchcalls produced a nativeblockedhook event, returned the matching gate diagnostic, and left the target files absent. A separate SessionEnd check produced both the saved session row and the completion receipt.Risk and rollback
The two Windows overrides use PowerShell syntax. The launcher waits for the hook interpreter, so the host and the SessionEnd worker can observe its real exit code. Revert this commit with
git revert d48e08d7.Audit notes
Checked the process handoff, inherited stdin, exit codes 0 and 2, gate registration scope, and durable SessionEnd completion. The automated tests exercise the real wheel entry point and separately pin both host command overrides. The native App Server test covers the shell-to-Codex handoff.
Coding-standards compliance
Breaking changes
Codex may request renewed trust for the updated plugin hooks. After review, rejected Windows tool calls and lifecycle failures are reported with the original hook exit status.
Screenshots / logs
The native trace reported
preToolUse: blockedseparately fordecision_gateandno_deps_gate. Both returnedCommand blocked by PreToolUse hook.Reviewer checklist