You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
install writes a machine-absolute binary path into repo-tracked .codex/hooks.json (breaks other machines; emit PATH-based command) #3129
.codex/hooks.json is a repo-tracked, shared file (unlike per-user config). Committing the installer's output therefore:
Breaks every other machine/collaborator — the absolute path (C:/Users/<user>/..., the uv tool shim location) does not exist elsewhere; on machines without graphify the hook errors on every Bash tool call in Codex sessions.
Churns the file per machine — each machine that runs graphify install rewrites the entry with its local path, producing endless diffs in a shared enforcement file.
There is no fail-open guard: the command is invoked directly, so a missing binary is a hard hook failure rather than a no-op.
Suggested fix
Emit a PATH-based command (graphify hook-check) — the uv shim directory is on PATH in the environments where install succeeds — or make the command template configurable.
Optionally wrap with an existence guard so machines without graphify fail open (skip) instead of erroring.
Environment
graphify 0.9.50 (graphifyy from PyPI, uv tool install --with mcp)
graphify install The only debate I think maintainers might have here with this is that the installation is not for a project. It is not really expected that other people will also be maintaining that same location. Whereas, if you use the --project, you will get this same problem but with the expectation that others will also be contributing to that project.
Thanks for the v0.9.52 fix — confirming it from the current v8, and narrowing what is left, since the remaining case is the default one.
_install_codex_hook() writes to project_dir / ".codex" / "hooks.json" unconditionally, and project_dir defaults to Path(".") — so the file is inside the repo on every install, not only on --project ones. What the flag changes is the command written into it:
So with --project the hook is now the portable bare graphify hook-check — fixed, as you said. Without it, the same repo-tracked .codex/hooks.json still receives the absolute shutil.which/sys.executable-derived path, which is the original failure: commit it, and it breaks for every other machine and CI, since that path does not exist there.
That leaves the bug fully reproducible on the default install path, which is the one most people will hit — graphify install . without --project. Agreed it should stay open.
Two options, whichever fits your intent better:
Emit the bare command whenever the destination is repo-tracked — i.e. make the .codex/hooks.json writer always use "graphify", since that file is committed by definition. The absolute path only ever helps a graphify that is not on PATH, and in that case a committed hook would be wrong on the author's machine too as soon as the venv moves.
Keep the absolute path but stop writing it to a tracked location for non-project installs.
Happy to send a patch for whichever you prefer — (1) is a one-line change at the call site. Not opening a PR unless you want it, so as not to collide with anything you already have in flight.
Sent the patch I offered above as #3268 — option (1), and easy to close if you'd rather have (2) or neither. You deferred this half deliberately, so I've tried to make it cheap to reject rather than argue you out of the deferral.
One thing I found while building it that changes the picture slightly, and it's the reason the PR is a little wider than "one line at the call site" as I estimated:
The same defect is in the claude, gemini and codebuddy hook writers, not just codex._install_claude_hook, _install_gemini_hook and _install_codex_hook all resolve their destination as project_dir / ".<tool>" with the caller passing project_dir or Path(".") — so every one of them writes into the working directory whether or not --project was given. _claude_pretooluse_hooks is shared by claude and codebuddy, and codebuddy has no --project variant at all, so every codebuddy install has been writing an absolute path into a repo-tracked file.
Since it's one root cause behind four platforms, fixing only the codex path the issue names would have left the siblings broken, so the PR fixes it in the three shared resolvers instead.
This does contradict a premise in #3149, and I'd rather say so up front than have you find it: that PR kept the absolute path for the non-project install on the grounds that it targets "a location others are not expected to share." For these particular hook files there is no such location — they always land in the cwd. So the test it added to pin that behaviour (test_user_profile_install_still_resolves_absolute_path) was pinning a premise that doesn't hold for them. I replaced rather than quietly edited it, with a docstring saying why.
The real cost is stated in the PR: _resolve_graphify_exe's docstring notes the absolute path is what makes the hook work where the venv Scripts/ dir isn't on PATH (VS Code Codex extension on Windows). This gives that up. I think #3149's own "a missing binary and a wrong absolute path both fail; the difference is diagnosis" argument covers it — that argument was scoped to "the committed case," and for these files every case turns out to be the committed case — but that's a judgment you may weigh differently, and it's the one I'd push back on if I were reviewing.
Still deliberately not touching #2164's question of where these files should go; the PR only changes what goes inside them at today's destination.
This looks fixed on the v8 branch by 35c63493 (fix(install): emit a bare hook command for project-scoped installs (#3129)). Could a maintainer confirm and close?
Activity
davidbhoward commentedon Aug 27, 2026
This is the same thing for Claude Code.
graphify installThe only debate I think maintainers might have here with this is that the installation is not for a project. It is not really expected that other people will also be maintaining that same location. Whereas, if you use the--project, you will get this same problem but with the expectation that others will also be contributing to that project.fix(install): emit a bare hook command for project-scoped installs (#…
chore: bump to 0.9.52
safishamsi commentedon Aug 29, 2026
Partially addressed in v0.9.52 (#3149): a
graphify install --project(committed/shared) install now emits a bare, run-time-resolved hook command instead of pinning an absolute interpreter path, so the committed hook no longer churns across machines. The plain (non---project) install-into-cwd case is entangled with #2164 and left for a follow-up, so leaving this open. Fixed in v0.9.52: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.52davidbhoward commentedon Aug 29, 2026
This sounds great. Thank you so much for all your work.
yotamleo commentedon Sep 1, 2026
Thanks for the v0.9.52 fix — confirming it from the current
v8, and narrowing what is left, since the remaining case is the default one._install_codex_hook()writes toproject_dir / ".codex" / "hooks.json"unconditionally, andproject_dirdefaults toPath(".")— so the file is inside the repo on every install, not only on--projectones. What the flag changes is the command written into it:So with
--projectthe hook is now the portable baregraphify hook-check— fixed, as you said. Without it, the same repo-tracked.codex/hooks.jsonstill receives the absoluteshutil.which/sys.executable-derived path, which is the original failure: commit it, and it breaks for every other machine and CI, since that path does not exist there.That leaves the bug fully reproducible on the default install path, which is the one most people will hit —
graphify install .without--project. Agreed it should stay open.Two options, whichever fits your intent better:
.codex/hooks.jsonwriter always use"graphify", since that file is committed by definition. The absolute path only ever helps agraphifythat is not onPATH, and in that case a committed hook would be wrong on the author's machine too as soon as the venv moves.Happy to send a patch for whichever you prefer — (1) is a one-line change at the call site. Not opening a PR unless you want it, so as not to collide with anything you already have in flight.
yotamleo commentedon Sep 1, 2026
Sent the patch I offered above as #3268 — option (1), and easy to close if you'd rather have (2) or neither. You deferred this half deliberately, so I've tried to make it cheap to reject rather than argue you out of the deferral.
One thing I found while building it that changes the picture slightly, and it's the reason the PR is a little wider than "one line at the call site" as I estimated:
The same defect is in the claude, gemini and codebuddy hook writers, not just codex.
_install_claude_hook,_install_gemini_hookand_install_codex_hookall resolve their destination asproject_dir / ".<tool>"with the caller passingproject_dir or Path(".")— so every one of them writes into the working directory whether or not--projectwas given._claude_pretooluse_hooksis shared by claude and codebuddy, and codebuddy has no--projectvariant at all, so every codebuddy install has been writing an absolute path into a repo-tracked file.Since it's one root cause behind four platforms, fixing only the codex path the issue names would have left the siblings broken, so the PR fixes it in the three shared resolvers instead.
This does contradict a premise in #3149, and I'd rather say so up front than have you find it: that PR kept the absolute path for the non-project install on the grounds that it targets "a location others are not expected to share." For these particular hook files there is no such location — they always land in the cwd. So the test it added to pin that behaviour (
test_user_profile_install_still_resolves_absolute_path) was pinning a premise that doesn't hold for them. I replaced rather than quietly edited it, with a docstring saying why.The real cost is stated in the PR:
_resolve_graphify_exe's docstring notes the absolute path is what makes the hook work where the venvScripts/dir isn't on PATH (VS Code Codex extension on Windows). This gives that up. I think #3149's own "a missing binary and a wrong absolute path both fail; the difference is diagnosis" argument covers it — that argument was scoped to "the committed case," and for these files every case turns out to be the committed case — but that's a judgment you may weigh differently, and it's the one I'd push back on if I were reviewing.Still deliberately not touching #2164's question of where these files should go; the PR only changes what goes inside them at today's destination.
omsenjalia commentedon Oct 18, 2026
This looks fixed on the
v8branch by 35c63493 (fix(install): emit a bare hook command for project-scoped installs (#3129)). Could a maintainer confirm and close?fix(codex): quote a spaced exe path in the PreToolUse hook command
fix(codex): quote a spaced exe path in the PreToolUse hook command
fix(codex): quote a spaced exe path in the PreToolUse hook command
fix(security): [HIMMEL-7187] sync to upstream 0.9.94 and floor the pa…
chore: [HIMMEL-7394] sync to upstream 0.9.95 and carry the himmel del…
feat(install): zcode SessionStart reminder hook — AGENTS.md alone pro…