fix(doctor): the shell check walked past the shim and told Windows to switch it off - #98
Open
xizhuomengcontin wants to merge 1 commit into
Open
xizhuomengcontin wants to merge 1 commit into
xizhuomengcontin wants to merge 1 commit into
Conversation
… switch it off
On Windows the shim is `sh.cmd`, because PATH cannot execute an extensionless
script there. The check ran `execFile('sh', …)`, which goes to CreateProcess,
which looks for `sh` and `sh.exe` and never `sh.cmd`. So it resolved to
whichever `sh.exe` was further down PATH, ran the probe command through *that*,
found no frames and reported:
shell shim warn commands pass through but nothing is captured
fix: record with --no-shell rather than trusting a layer that records nothing
Every Windows user, every time — advising them to turn off a layer that works.
`orca doctor` exists to move a quiet failure forward in time; this was a loud
one it invented.
Naming `sh.cmd` directly is not the fix: node has refused to spawn a `.cmd`
without a shell since CVE-2024-27980 (`spawn EINVAL`). The command processor is
what resolves PATHEXT, so it is what has to do the resolving.
The layer itself was never broken. Through `cmd.exe`, a real `orca record` on
Windows captures argv with its quoting intact and the exit code the test's own
name says a broken shim loses:
{"type":"shell.exec","attrs":{"argv":["sh","-c","echo hello from the shell; exit 3"],…}}
{"type":"shell.result","causes":[5],"attrs":{"exit_code":3,"duration_ms":27,…}}
And `orca doctor` now says so:
shell shim ok sh, bash, zsh — captured a test command
Windows: 10 failures before, 9 after. POSIX is untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🐳 OrcaCode Review
✅ No findings — nothing to flag in this PR. Great work!
OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 519 calls · 52.4M tokens · 99% cached
❤️ Share · Install OrcaCode Review
Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.
Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter
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.
Orca-Code-Review — push 1
✅ no blocking findings
That is what
orca doctorsaid on every Windows machine — advising the user to turn off acapture layer that works fine.
Why
On Windows the shim is
sh.cmd, because PATH cannot execute an extensionless script there.installShellShimknows this and says so in its own doc comment. The check did not:execFilewithout a shell goes toCreateProcess, which looks forshandsh.exeand neversh.cmd. So the probe walked straight past the shim directory it had just prepended, foundwhichever
sh.exewas further down PATH — Git for Windows', here — ran the command through that,and correctly observed that no frames had been written.
Measured, with the shim directory on PATH:
sh -c "printf ok"was invokedexecFile('sh', …)— what the check did"ok"execFile('sh.cmd', …)spawn EINVALcmd.exe /d /s /c sh -c "printf ok""ok"The middle row is why naming the
.cmddirectly is not the fix: node has refused to spawn a.cmdor.batwithout a shell since CVE-2024-27980. The command processor is what resolvesPATHEXT, so it is what has to do the resolving.
The layer was never broken
A real
orca recordon Windows, with an agent that invokes a shell the way a Windows caller does:{"type":"shell.exec","attrs":{"argv":["sh","-c","echo hello from the shell; exit 3"],"cwd":"…"}} {"type":"shell.result","causes":[5],"attrs":{"exit_code":3,"signal":null,"duration_ms":27,…}}argv with its quoting intact, and
exit_code: 3— the exit code the failing test's own name saysa broken shim "loses silently". It was being recorded the whole time.
And now:
Scope
One branch in one check. POSIX takes the identical path it took before. The shim, the runner and
the frame format are untouched — the only thing that was wrong was how the check reached them.
Worth stating plainly, since it bounds the claim: a caller that bypasses PATHEXT — node's own
execFilewithoutshell, as this check did — will not hit the shim on Windows. That is inherentto a
.cmdshim and not something this PR changes. What it changes is thatdoctorno longerreports its own choice of spawn API as a failure of the thing it was measuring.
Windows: 10 failures before, 9 after.
prettier --check,tsc --build --force,scripts/conformance.mjs(63 events, 0 failures) andscripts/fidelity.mjs --check(0 regressions) are clean.
🤖 Generated with Claude Code