Fix agent gate local opcore resolution#277
Merged
Merged
Conversation
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
Fix the Opcore agent write gate so pre-write validation resolves a repository-local
opcorebinary when the hook process has a plain sessionPATH.Root Cause
The gate spawned
opcore validate pre-writeby command name only. In installed hook environments,opcoremay exist atnode_modules/.bin/opcorewithout that directory being present inPATH. When spawn failed withENOENT, Node returned nullish stdout and the gate crashed while trimming it.Changes
<repoRoot>/node_modules/.binto the validation child processPATHwhile preserving the existing environment and platform delimiter.repoRootbefore spawning validation.Independent Review
Independent reviewer approved the diff with no blocking findings. They specifically checked placement, generated-hook behavior,
PATH/Pathcasing, platform delimiter usage, failure semantics, and test adequacy.Validation
git diff --checknode --test tests/opcore-agent-gate.test.mjsnpx tsc -b --pretty falsenpm run lintPATH="$PWD/node_modules/.bin:$PATH" opcore check changed --base origin/dev --jsonNote: full
npm run buildis blocked in this environment becausex86_64-linux-musl-gccis not installed for the native artifact step.