Skip to content

Record a Managed Copy for claude and codex in install-agents and Report Any Other Copy as a Stray - #4456

Merged
ptr727 merged 3 commits into
developfrom
burndown/claude-codex-managed-copy
Nov 25, 2026
Merged

ptr727 merged 3 commits into
developfrom
burndown/claude-codex-managed-copy

Conversation

@ptr727

@ptr727 ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • install-agents.sh and install-agents.ps1 record a managed copy for claude and codex, from each tool's native installer, beside opencode's. On Linux that is ~/.local/bin/claude and codex in CODEX_INSTALL_DIR or else ~/.local/bin. On Windows it is a directory form, ~\.local\bin and CODEX_INSTALL_DIR or else %LOCALAPPDATA%\Programs\OpenAI\Codex\bin, compared with every link followed, since the codex bin is a junction.
  • A claude or codex from any other source (npm, bun, Homebrew, mise, scoop, a bare file) is a stray: reported with the command that removes it and then --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.
  • Tests move to the managed layout. The manager-upgrade tests that used claude or codex as their vehicle now use herdr where a manager still reaches it, and become stray tests otherwise. New tests cover the native copy alone, CODEX_INSTALL_DIR, the %LOCALAPPDATA% default, and a stray ahead of a native copy.
  • The two READMEs and docs/host-setup.md state the three managed copies.

The PowerShell installer is edited here from Linux and verified by its pwsh tests, 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 comments label.

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.ps1 Test-BunPackageOwnership, class pre-existing consolidation: its inline shim-directory compare also resolves the file's own link, so it was not moved onto Test-SameDirectory.
  • host-setup/windows/install-agents.ps1 Get-StrayPlan, class pre-existing: a winget-owned claude is now a stray and winget uninstall claude is a bare name search that may match another package. Unconfirmed, and outside the trust model.

ptr727 and others added 3 commits November 25, 2026 14:30
…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]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 25, 2026
Copilot AI lite review requested due to automatic review settings November 25, 2026 22:52
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 80fc3e7 and 2cfd71c.

Files selected for processing: 6

  • docs/host-setup.md
  • host-setup/linux/README.md
  • host-setup/linux/install-agents.sh
  • host-setup/windows/README.md
  • host-setup/windows/install-agents.ps1
  • tests/test_install_agents.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 2cfd71c23f9ab7f5a099c64fdb9922af63274478, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread host-setup/linux/install-agents.sh Resolved
Comment thread host-setup/windows/install-agents.ps1 Resolved
Comment thread host-setup/windows/install-agents.ps1 Resolved
@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.62%. Comparing base (b38e084) to head (2cfd71c).
⚠️ Report is 348 commits behind head on develop.

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     
Flag Coverage Δ
python-3.13 79.62% <ø> (-1.99%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 18920f4 into develop Nov 25, 2026
15 checks passed
@ptr727
ptr727 deleted the burndown/claude-codex-managed-copy branch November 25, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants