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
Open
fix(inject): use the binary's absolute path when the bare name isn't on a minimal PATH#572Shawn-Dong wants to merge 1 commit into
Shawn-Dong wants to merge 1 commit into
Conversation
…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
force-pushed
the
fix/inject-absolute-path
branch
from
July 25, 2026 09:27
47e71a4 to
0673826
Compare
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.
Fixes #569.
Problem
The inject runs
<binary> retrieveby 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 ranmemu-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 inlineinstruction()and byskill_document(). Thebegin()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-instructionto 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