Skip to content

Fix agent gate local opcore resolution#277

Merged
mkceichelbeck merged 1 commit into
devfrom
codex/fix-agent-gate-local-bin
Jul 17, 2026
Merged

Fix agent gate local opcore resolution#277
mkceichelbeck merged 1 commit into
devfrom
codex/fix-agent-gate-local-bin

Conversation

@mkceichelbeck

Copy link
Copy Markdown
Contributor

Summary

Fix the Opcore agent write gate so pre-write validation resolves a repository-local opcore binary when the hook process has a plain session PATH.

Root Cause

The gate spawned opcore validate pre-write by command name only. In installed hook environments, opcore may exist at node_modules/.bin/opcore without that directory being present in PATH. When spawn failed with ENOENT, Node returned nullish stdout and the gate crashed while trimming it.

Changes

  • Prepend <repoRoot>/node_modules/.bin to the validation child process PATH while preserving the existing environment and platform delimiter.
  • Require the gate-created pre-write request to have a repoRoot before spawning validation.
  • Treat nullish validation stdout as empty output so missing command failures report cleanly instead of throwing a TypeError.
  • Add regression coverage for repo-local bin resolution and missing-bin no-crash behavior.

Independent Review

Independent reviewer approved the diff with no blocking findings. They specifically checked placement, generated-hook behavior, PATH/Path casing, platform delimiter usage, failure semantics, and test adequacy.

Validation

  • git diff --check
  • node --test tests/opcore-agent-gate.test.mjs
  • npx tsc -b --pretty false
  • npm run lint
  • PATH="$PWD/node_modules/.bin:$PATH" opcore check changed --base origin/dev --json

Note: full npm run build is blocked in this environment because x86_64-linux-musl-gcc is not installed for the native artifact step.

@mkceichelbeck
mkceichelbeck merged commit 40020b0 into dev Jul 17, 2026
10 checks passed
@mkceichelbeck
mkceichelbeck deleted the codex/fix-agent-gate-local-bin branch July 17, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant