Skip to content

Interpreter probe fails on pipx installs: shebang with an argument is parsed as a file path #2629

Description

@hpstr5000

Both the generated post-commit hook and the skill's own interpreter probes read the shebang of the graphify launcher and use it as a path. pipx writes #!/path/to/venv/bin/python -Ewith an argument — so the string is not a path, and every probe falls through to a python3 that does not have graphify installed.

Result on my machine: every commit printed

[graphify hook] could not locate a Python with graphify installed.

for weeks, so the graph silently stopped updating. Since it is one line of noise after each commit, it went unnoticed for a long time.

Reproduce

$ which graphify
/Users/me/.local/bin/graphify
$ head -1 "$(which graphify)" | tr -d #!
/Users/me/.local/pipx/venvs/graphifyy/bin/python -E     # <- note the argument

Now the probe from SKILL.md step 1:

_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d "#!")
case "$_SHEBANG" in
    *[!a-zA-Z0-9/_.@-]*) ;;                     # <- space matches, probe is skipped entirely
    *) "$_SHEBANG" -c "import graphify" && PYTHON="$_SHEBANG" ;;
esac

The character guard rejects the string because of the space, so the verification never runs and the probe never fires.

The ## Interpreter guard for subcommands block has the same parse without the import graphify verification, so it writes the unverified python3 fallback into graphify-out/.graphify_python. Every later step reads that pinned path and fails as if the install were broken.

Suggested fix

Strip the interpreter argument before using the shebang as a path, and verify the candidate before pinning it:

_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d "#!" | cut -d" " -f1)
"$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG"

With cut -d" " -f1 the path resolves and the import check passes on a stock pipx install. The same two changes apply to the generated post-commit hook, which carries the identical probe.

I patched this locally in SKILL.md and confirmed the hook now reports launching background rebuild. Happy to open a PR if useful.

Environment: macOS 15 (Darwin 25.5.0), graphify 0.9.12, installed via pipx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions