fix(install): only manage strix in the installer's own directory - #1296
fix(install): only manage strix in the installer's own directory#1296itzzdev09 wants to merge 2 commits into
Conversation
`check_existing_installation` walked `which -a strix` and deleted every match outside `$INSTALL_DIR`, and `verify_installation` deleted whatever executable won PATH resolution. Path discovery shows that another `strix` exists; it does not show that the installer owns it. A pipx install or a development checkout on `PATH` was removed without being asked about, including a `pipx uninstall strix-agent` triggered purely by the path containing `.local/bin`. The installer now touches only `$INSTALL_DIR`. Other executables are reported, and when one wins PATH resolution the user is told how to reorder `PATH` or remove it themselves. Fixes usestrix#1262 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
| if [[ "$path" == *".local/bin"* ]] && command -v pipx >/dev/null 2>&1; then | ||
| echo -e "${MUTED} It looks like a pipx installation. To remove it: ${NC}pipx uninstall strix-agent" |
There was a problem hiding this comment.
Pipx ownership is misidentified
If a manually installed or uv-managed strix is in a path containing .local/bin while pipx is available, this code labels it as a pipx installation without confirming ownership. Following the suggested command can leave the actual PATH conflict unresolved or uninstall a separate pipx-managed strix-agent. Please determine ownership through pipx itself or provide neutral removal guidance.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/install.sh
Line: 105-106
Comment:
**Pipx ownership is misidentified**
If a manually installed or uv-managed `strix` is in a path containing `.local/bin` while `pipx` is available, this code labels it as a pipx installation without confirming ownership. Following the suggested command can leave the actual PATH conflict unresolved or uninstall a separate pipx-managed `strix-agent`. Please determine ownership through pipx itself or provide neutral removal guidance.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if [[ "$path" == *".local/bin"* ]] && command -v pipx >/dev/null 2>&1; then | ||
| echo -e "${MUTED} It looks like a pipx installation. To remove it: ${NC}pipx uninstall strix-agent" | ||
| else | ||
| echo -e "${MUTED} To remove it: ${NC}rm $path" |
There was a problem hiding this comment.
If the resolved executable path contains spaces or glob characters, copying this displayed rm command causes the shell to split or expand the path. The command can then fail to remove the conflicting executable or target unintended matching files. Please print a shell-escaped path.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/install.sh
Line: 108
Comment:
**Removal path is unescaped**
If the resolved executable path contains spaces or glob characters, copying this displayed `rm` command causes the shell to split or expand the path. The command can then fail to remove the conflicting executable or target unintended matching files. Please print a shell-escaped path.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Review feedback on the conflict guidance, both valid. The pipx hint keyed off `.local/bin` appearing in the path, which is where a uv-managed or hand-placed strix lands too. Telling that user to `pipx uninstall strix-agent` either does nothing or removes a different package, and leaves the real PATH conflict in place. Ask pipx instead: compare the executable's directory against `PIPX_BIN_DIR` and confirm `strix-agent` is in `pipx list`. The `rm` suggestion printed the path bare, so copying it would split on spaces or expand a glob. Print it through `printf '%q'`. The decoy tests asserted that pipx was never invoked at all, which the ownership check now legitimately does. They assert no `uninstall` instead, which is the contract that matters. `describe_removal` only runs when another executable wins PATH resolution, which a successful install prevents, so the advice itself is now tested by lifting the functions out of the script and calling them directly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Both findings were valid — fixed in Pipx ownership — you're right that Unescaped path — now printed through Verified each branch against the real script under bash: Case 4 round-trips the printed argument back through the shell and asserts it equals the original path exactly, so the test fails if the quoting is ever dropped. One thing your comment prompted that you didn't flagAdding the ownership check meant the installer now queries pipx, and my existing tests asserted Checking that also exposed a weakness in what I'd written: Full-install coverage is unchanged and still passes: an unrelated |
Fixes #1262
Problem
The installer deletes
strixexecutables it does not own.check_existing_installationenumerateswhich -a strixandrm -fs every match outside$INSTALL_DIR. If the path merely contains.local/binit also runspipx uninstall strix-agent.verify_installationdeletes whatever executable wins PATH resolution when that is not the managed one.Path discovery shows another
strixexists; it does not establish that the installer owns it. A pipx install, auv toolshim, or a development checkout onPATHgets removed with no prompt.I confirmed this on the current script with the test harness in
tests/test_install_script.py: with an unrelatedstrixahead of the installer onPATH, the file is gone after the run, and in the.local/bincasepipx uninstall strix-agentis invoked too.Change
The installer now writes only inside
$INSTALL_DIR.check_existing_installationreports other executables instead of removing them, and says plainly that only$INSTALL_DIRis managed.verify_installationexplains that the newly installed binary will not run until the conflict is resolved, and offers the two ways to fix it — reorderPATH, or remove the other file. A newdescribe_removalhelper prints the right command (pipx uninstall strix-agentfor a pipx-shaped path, otherwiserm <path>). Nothing is deleted andpipxis never invoked.Tests
Two regression tests, built on the existing sandboxed installer harness:
test_installer_leaves_unrelated_strix_executables_alone— a decoystrixahead onPATHsurvives byte-for-byte and the managed binary still installs.test_installer_does_not_uninstall_a_pipx_managed_strix— a decoy under a.local/bin-shaped directory survives and a mockpipxrecords no invocation.Both fail on
mainand pass with this change.bash -nclean;ruff,ruff format, andmypyclean on the touched test module.🤖 Generated with Claude Code