Repository navigation
fix(agent-hooks): make Windows cmd hook launcher directly spawnable (#8430 regression) - #8737
Merged
Merged
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughUpdated Windows hook command wrapping so safe 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…8430 regression) Codex, Antigravity, and Devin launch their agent-hook `command` as a program (argv[0]), not through cmd.exe. PR #8430 changed wrapWindowsCmdHookCommand to emit an `if exist "path\." (drain) else if exist "path" (call "path") else (drain)` compound whose argv[0] is the cmd builtin `if` — unspawnable — so every Codex/Antigravity/Devin hook (SessionStart, UserPromptSubmit, Stop, ...) failed with "hook exited with code 1" on Windows starting in v1.4.138. Revert the cmd-safe fast path to the bare, directly-spawnable .cmd path (the proven pre-#8430 form). A cmd-builtin drain and direct-spawnability are mutually exclusive, and nesting cmd.exe /d /c breaks large-payload draining; the missing-script stdin drain stays on the encoded-PowerShell fallback (used for spaced/non-ASCII paths). Upgrades self-heal on first launch: startup install() unconditionally rewrites the command and Codex trust entry, sweeping the old compound form. Add a platform-independent regression guard (launcher must resolve to a real file, never a cmd-builtin fragment), update the lifecycle test + docs, and fix a stale Devin comment.
OrcaWin
force-pushed
the
OrcaWin/windows-codex-hook-issue
branch
from
July 14, 2026 12:26
d0ad118 to
954b430
Compare
1 of 5 tasks
6 tasks
This was referenced Jul 30, 2026
Closed
1 of 5 tasks
7 of 9 tasks
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…tablyai#8430 regression) (stablyai#8737) Codex, Antigravity, and Devin launch their agent-hook `command` as a program (argv[0]), not through cmd.exe. PR stablyai#8430 changed wrapWindowsCmdHookCommand to emit an `if exist "path\." (drain) else if exist "path" (call "path") else (drain)` compound whose argv[0] is the cmd builtin `if` — unspawnable — so every Codex/Antigravity/Devin hook (SessionStart, UserPromptSubmit, Stop, ...) failed with "hook exited with code 1" on Windows starting in v1.4.138. Revert the cmd-safe fast path to the bare, directly-spawnable .cmd path (the proven pre-stablyai#8430 form). A cmd-builtin drain and direct-spawnability are mutually exclusive, and nesting cmd.exe /d /c breaks large-payload draining; the missing-script stdin drain stays on the encoded-PowerShell fallback (used for spaced/non-ASCII paths). Upgrades self-heal on first launch: startup install() unconditionally rewrites the command and Codex trust entry, sweeping the old compound form. Add a platform-independent regression guard (launcher must resolve to a real file, never a cmd-builtin fragment), update the lifecycle test + docs, and fix a stale Devin comment.
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.
Problem
On Windows, every Codex agent hook failed with
hook exited with code 1starting in v1.4.138:Root cause
PR #8430 rewrote
wrapWindowsCmdHookCommandso the hookcommandbecame a cmd compound:Codex/Antigravity/Devin launch the hook
commandas a program (argv[0]), not throughcmd.exe. The compound's argv[0] is the cmd builtinif, which is not an executable, so the launch fails every time. Verified empirically on Windows: a bare.cmdis directly spawnable (exit 0) via the CreateProcess family these agents use, while theif-led form throws ENOENT.cmd /cinterprets the compound fine — which is exactly why it slipped through (tests exercised it viacmd /c, not direct spawn).Affected all three direct-spawn agents (Codex, Antigravity, Devin); Codex is just the one that got reported.
Fix
Revert the cmd-safe fast path to the bare, directly-spawnable
.cmdpath — the proven pre-#8430 form. A cmd-builtin drain and direct-spawnability are mutually exclusive, and nestingcmd.exe /d /cbreaks large-payload draining. The missing-script stdin drain stays on the encoded-PowerShell fallback (used for spaced/non-ASCII paths).Zero-regression review
install()unconditionally rewrites the command + Codex trust entry and sweeps the old compound (matcher is wrapper-agnostic); no user left with a broken hook.Tests
installer-utils.test.ts: bare-path contract + a platform-independent regression guard (launcher must resolve to a real file, never a cmd-builtin fragment).agent-hook-stdin-lifecycle.mddoc, fixed a stale Devin comment.tsc+oxlintclean.