Skip to content

fix(inject): use the binary's absolute path when the bare name isn't on a minimal PATH - #572

Open
Shawn-Dong wants to merge 1 commit into
NevaMind-AI:mainfrom
Shawn-Dong:fix/inject-absolute-path
Open

fix(inject): use the binary's absolute path when the bare name isn't on a minimal PATH#572
Shawn-Dong wants to merge 1 commit into
NevaMind-AI:mainfrom
Shawn-Dong:fix/inject-absolute-path

Conversation

@Shawn-Dong

Copy link
Copy Markdown
Contributor

Fixes #569.

Problem

The inject runs <binary> retrieve by bare name, which only resolves if the binary is on the agent's runtime PATH. GUI/desktop clients get a minimal PATH that drops pipx's ~/.local/bin, so the command hits command not found, the agent concludes the tool isn't installed, and the inject silently no-ops. Real case (Hermes desktop): the agent ran memu-hermes retrieve …, replied "memu-hermes isn't installed on this machine", and answered with no memory — while the exact command worked from a terminal.

Fix

At instruction-build time, resolve the binary from a minimal, GUI-like PATH (/usr/local/bin:/opt/homebrew/bin + os.defpath). If it only lives in a non-standard dir (~/.local/bin, a venv), embed its absolute path in the inject instead of the bare name; otherwise keep the bare name. No user action, and terminal installs are unchanged.

This follows #568's precedent of verifying/invoking by full path when PATH is unreliable.

Changes

  • src/memu/hosts/instruction.py_invocation(binary) helper; used by the inline instruction() and by skill_document(). The begin() marker keeps the bare name (it's a label, not a command).
  • tests/test_host_instruction.py — two tests: absolute path when the name is off a minimal PATH, bare name when it's on one.

Existing assertions are substrings ("memu-codex retrieve" in …), which an absolute path still satisfies, so they're unaffected.

Not a full guarantee

The path is resolved at install time. If memU is later moved/reinstalled elsewhere, re-run install-instruction to refresh it — the same assumption as any install; day-to-day pipx upgrades keep the path stable.

Test

uv run pytest → 179 passed.

🤖 Generated with Claude Code

…on a minimal PATH

The inject runs `<binary> retrieve` by bare name, which only resolves if the
binary is on the *agent's* runtime PATH. GUI/desktop clients get a minimal PATH
that drops pipx's ~/.local/bin, so the command hits "command not found", the
agent concludes the tool isn't installed, and the inject silently no-ops (real:
Hermes desktop said "memu-hermes isn't installed" and answered with no memory).

At instruction-build time, resolve the binary from a minimal, GUI-like PATH; if
it only lives in a non-standard dir (~/.local/bin, a venv), embed its absolute
path in the inject instead of the bare name. The bare name is kept whenever it
is reachable, so terminal installs are unchanged. No user action required.

Follows NevaMind-AI#568's "verify/invoke by full path when PATH is unreliable" precedent.

Fixes NevaMind-AI#569

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Shawn-Dong
Shawn-Dong force-pushed the fix/inject-absolute-path branch from 47e71a4 to 0673826 Compare July 25, 2026 09:27
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.

Inject silently no-ops when the agent's runtime PATH lacks the binary (pipx ~/.local/bin + GUI clients); verify gate misses it

1 participant