Repository navigation
fix: run a .cmd or .bat gortex shim through cmd.exe for the hook - #40
Merged
Merged
Conversation
Node refuses to spawn batch files directly, so with gortex installed as an npm shim the hook bridge failed silently: no briefing, no read discipline, no version check, while Pi's MCP connected the tools through cross-spawn. The process seam now runs such a command through cmd.exe with cross-spawn's escaping. Resolution on Windows also follows cross-spawn: PATHEXT extensions, and the bare name only when it already carries one, so the sh script npm puts beside its .cmd shim no longer passes the binary check. Closes #37
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
With gortex installed as a
.cmdor.batshim on Windows (npm's global install), the hook bridge never ran. Node refuses to spawn batch files directly (EINVAL), andcallHookswallowed the error. Pi's MCP spawns through cross-spawn, so the graph tools connected and the session looked healthy, but there was no briefing, no read discipline and no version check, and nothing reported it.src/runtime.ts: when a command resolves to a.cmdor.baton Windows, the process seam runs it throughcmd.exewith cross-spawn's escaping. The command is passed as written, socmd.exesearches PATH the same way it does for Pi's MCP.gortex.cmdmatched first, and Windows cannot spawn it.binaryResolvesnow uses this shared resolver.Reproduction
Reproduced end to end under Windows Node 24 running in Wine in a Podman container. The extension ran under Pi's runner with its real process seam, and gortex was installed with npm's
.cmdshim template and the sh script beside it, in a directory with spaces and parentheses.binaryResolves("gortex")readblocked by the hooksession_start,tool_call ReadCloses #37
Testing
npm run checkpassesExtensionRunner(seedocs/tests.md):test/runtime.test.tstests the process seam directly, since the hook double replaces exactly this seam in the runner suites. The Wine repro above covered the runner path.pi -e /path/to/checkout), if user-visible: not on a real Windows machine.test/runtime.test.tstests resolution and escaping as pure functions on every OS, and spawns real batch files on Windows only. Under Wine, the test that runs a.batby a path with spaces fails. cross-spawn fails on the same path under Wine too, and the test passes on thewindows-latestCI job, so the failure was Wine'scmd.exe.Checklist
docs/architecture.mdupdated briefly, only if a design decision changed (no design decision changed)windows-latest