Repository navigation
Record a Managed Copy for claude and codex in install-agents and Report Any Other Copy as a Stray - #4456
Conversation
…rt Any Other Copy as a Stray claude and codex each keep the copy their own installer writes. A copy from any other source that PATH reaches first, an npm, bun, Homebrew, or mise one, is reported with the command that removes it and then the install, and is never removed or upgraded, even where no managed copy exists. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An npm prefix of ~/.local put an npm claude or codex in the managed directory, where it read as the managed copy and was upgraded through npm. Require the manager to read self, drop the link-following candidate the Windows installers never create, and build the directory comparison on Test-PathUnder. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟡 Changes recommended
Active moderate issues remain in the Linux custom Codex-path detection and Windows executable classification, with native Windows coverage also missing for the new link-following logic.
3 open issues
What changed in this PR
This pull request records native installer locations for Claude Code and Codex as managed copies and treats other installations as report-only strays across Linux and Windows.
Changes:
- Adds managed-copy detection for Claude Code and Codex.
- Reports non-native copies with manual removal and reinstall guidance.
- Updates tests and host-setup documentation for native paths, custom Codex directories, and stray copies.
| File | Description |
|---|---|
| tests/test_install_agents.py | Updates coverage for native Claude Code and Codex copies, custom Codex locations, and stray installations. |
| host-setup/windows/README.md | Documents Windows managed locations and manual remediation for stray copies. |
| host-setup/windows/install-agents.ps1 | Adds Windows managed-directory detection, native installer paths, and stray-copy reporting for Claude Code and Codex. |
| host-setup/linux/README.md | Documents Linux managed native copies and stray-copy handling. |
| host-setup/linux/install-agents.sh | Adds Linux managed paths and stray-copy handling for Claude Code and Codex. |
| docs/host-setup.md | Updates the cross-platform managed-copy contract and stray remediation behavior. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4456 +/- ##
===========================================
- Coverage 81.60% 79.62% -1.99%
===========================================
Files 26 47 +21
Lines 9070 16398 +7328
===========================================
+ Hits 7402 13057 +5655
- Misses 1668 3341 +1673
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|


Summary
install-agents.shandinstall-agents.ps1record a managed copy for claude and codex, from each tool's native installer, beside opencode's. On Linux that is~/.local/bin/claudeandcodexinCODEX_INSTALL_DIRor else~/.local/bin. On Windows it is a directory form,~\.local\binandCODEX_INSTALL_DIRor else%LOCALAPPDATA%\Programs\OpenAI\Codex\bin, compared with every link followed, since the codexbinis a junction.--install, and never upgraded or removed here, even where no native copy exists. This is the maintainer's answer on Decide Whether a claude or codex With No Native Copy Is a Stray Once install-agents Records the Native Copy #4402 (option 1) and the report-only answer on Consolidate claude and codex Into One Managed Copy in install-agents #4158, applying the State That a One-Off Is Detected and Reported, Never Corrected by Code #4210 rule that a one-off is detected and reported.CODEX_INSTALL_DIR, the%LOCALAPPDATA%default, and a stray ahead of a native copy.docs/host-setup.mdstate the three managed copies.The PowerShell installer is edited here from Linux and verified by its
pwshtests, not on a native Windows host.Closes on promotion: #4158, #4210
Removal candidates (#4210's "done when"): the npm and bun upgrade paths that no tool now reaches are filed as #4450 and left in place, so each diff is reviewed alone (the #4402 answer). No other one-off correction code was found in the two installers.
Comments: this change adds comment lines, so it carries the
commentslabel.Local review (three passes, the last with no findings): fixed an npm copy linked into the managed directory reading as managed, a duplicate directory comparison, and an unneeded link-following candidate.
Pre-existing findings, not filed:
host-setup/windows/install-agents.ps1Test-BunPackageOwnership, class pre-existing consolidation: its inline shim-directory compare also resolves the file's own link, so it was not moved ontoTest-SameDirectory.host-setup/windows/install-agents.ps1Get-StrayPlan, class pre-existing: a winget-owned claude is now a stray andwinget uninstall claudeis a bare name search that may match another package. Unconfirmed, and outside the trust model.