Skip to content

Ask npm Before bun and Read Nix Before node_modules on Linux - #4102

Merged
ptr727 merged 1 commit into
developfrom
feature/linux-manager-order
Nov 12, 2026
Merged

ptr727 merged 1 commit into
developfrom
feature/linux-manager-order

Conversation

@ptr727

@ptr727 ptr727 commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Summary

Answers Copilot's review of promotion PR #4096. That PR's head is develop, so it takes no fixes directly.

  • tool_manager in host-setup/linux/install-agents.sh returned bun for any .bun path before asking npm. So an npm global under an npm root inside a bun directory was misread, unlike Windows. npm is now asked first, as on Windows.
  • A Nix-packaged agent under /nix/store/.../node_modules hit the generic node_modules npm arm first. It was then reported with an npm reason instead of the Nix one. tool_manager_by_path now reads mise, Homebrew Cellar/Caskroom, .bun, and /nix/store before the node_modules fallback.

No existing classification changes: mise npm-backend, npm globals under a Cellar node, linuxbrew, and apt read as before.

Verification

  • New classify helper sources the real tool_manager with npm_root fixed. Three new tests cover:
    • an npm root under a bun directory, read as npm
    • a bun global npm does not own, read as bun
    • a Nix store node_modules, read as nix
  • The first and third fail on the old order.
  • tests/test_install_agents.py passes, 64 tests. shellcheck, shfmt, and the prose gate are clean.
  • A recorded local pass found nothing open.

🤖 Generated with Claude Code

tool_manager read a .bun path as bun's before asking npm, so a global under an npm root inside
a bun directory was misread, unlike Windows. A Nix agent under /nix/store/.../node_modules hit
the generic npm shape first and was reported with an npm reason. npm is now asked first, and
bun and Nix are read before the node_modules fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 12, 2026
Copilot AI lite review requested due to automatic review settings November 12, 2026 17:39
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 12, 2026
@ptr727

ptr727 commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

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

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

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.

🟢 Approval recommended

No active review issues remain, and targeted regression coverage addresses the corrected npm, Bun, and Nix classification paths.

No open issues 🎉

What changed in this PR

This PR corrects Linux package-manager ownership detection so npm globals nested under Bun paths remain classified as npm, while Bun and Nix installations are classified before the generic node_modules fallback.

Changes:

  • Query npm's global root before path-based manager detection.
  • Check Bun and Nix paths before the generic node_modules fallback.
  • Add regression tests for npm-under-Bun, Bun-owned, and Nix-owned layouts.
File Description
tests/​test_install_agents.py Adds regression tests covering npm roots under Bun directories, Bun globals, and Nix store paths.
host-setup/​linux/​install-agents.sh Updates Linux package-manager classification precedence for npm, Bun, and Nix installations.

Review effort: Lite

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.58%. Comparing base (1967d38) to head (a186719).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4102   +/-   ##
========================================
  Coverage    76.58%   76.58%           
========================================
  Files           40       40           
  Lines        14136    14136           
========================================
  Hits         10826    10826           
  Misses        3310     3310           
Flag Coverage Δ
python-3.13 76.58% <ø> (ø)

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 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Action not completed

Pull request is closed.

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 d0cbd27 into develop Nov 12, 2026
13 of 14 checks passed
@ptr727
ptr727 deleted the feature/linux-manager-order branch November 12, 2026 17:53
ptr727 added a commit that referenced this pull request Nov 12, 2026
… Upgrades (#4096)

## Summary

Promotes the agent-setup follow-ups and their review fixes, plus one
change from another hub session, from `develop` to `main`. Both follow a
native Windows 11 test of the one-step agent setup released as 2.0.1414.

- #4094:
- The Claude safety kit puts `"$defaults"` first in each `autoMode` list
that exists (`environment`, `allow`, `soft_deny`, `hard_deny`). Claude
Code's "learn rules" offer had written a list without it, which silently
replaced Claude Code's built-in rules. `--report` flags such a list as
not current.
  - The kit report's archive note names the commit.
- The Codex and opencode rules lines say when only an agent's config
directory makes it count as installed.
- `merge-and-release` step 7 also refreshes the Codex and opencode
rules, only where the kit reads current.
- #4095: an agent tool installed through npm, bun, scoop, Homebrew or
mise is upgraded through that manager, one package only. The manager is
asked whether it owns the tool, with every link resolved, before any
path shape is read, and the recorded package must own the file. A Node
runtime is never upgraded on an agent's behalf. Nothing elevates: choco,
a global scoop app, an unwritable npm prefix and Nix are reported with
their command. winget and apt stay with `upgrade-host`.

- #4102: answers this promotion's Copilot review. On Linux, npm is asked
before a `.bun` path, as on Windows, and a Nix agent under
`/nix/store/.../node_modules` is read as Nix before the generic npm
shape.

- #4105: answers this promotion's second Copilot round. On Windows,
`Test-ProtectedPath` and `Hide-Home` match only at a path component, so
`C:\Program FilesPortable` is no longer read as protected and a sibling
profile is no longer shortened. The pure path-helper tests now also run
on the native Windows CI runner.

- #4111: answers CodeRabbit's review of this promotion. bun's
`BUN_INSTALL` and `BUN_INSTALL_GLOBAL_DIR` are honored, including bun's
copied Windows shim. A mise shim is followed through `mise which`, and
mise's own listing is asked before any path shape. One herdr post step
runs after every successful upgrade. Scoop's configured roots are read
from its `config.json`.

- #4112: answers this promotion's attested local review. herdr's report
notes now match its post step for a manager-owned herdr.
`install-tools.ps1`'s `Hide-Home` gets #4105's component boundary. One
`Test-PathUnder` helper replaces seven hand-written containment checks.
A dead depth bound is removed.

- #4109, from another hub session: `dotnet-codestyle` now requires a
`global.json` pinning SDK `10.0.100` with `latestFeature` and
`allowPrerelease: false`. It leaves `LangVersion` unset (netstandard
generator projects excepted) and forbids `EnablePreviewFeatures`. The
audit gains the `csharp.sdk.globaljson` check, with a
`catalog/snippets/configs/global.json` snippet and its `spec/files.json`
C# baseline entry. `CODESTYLE.md`'s .NET summary line is updated.
Follow-ups #4106 and #4107 are filed and not in this promotion.

## Pre-existing Findings, Filed

- `host-setup/windows/install-tools.ps1:616` (`pre-existing`,
correctness): `Write-InstallFailure`'s profile replacement in log lines
does not stop at a path component. Filed as #4113.

## Not Verified

- Real package managers. #4095's tests use stub managers on PATH. The
Windows npm, scoop and bun layouts are modeled from their documented
formats and have not been run against real installs. The maintainer's
Windows 11 retest after this release covers the npm-installed opencode
case.

Closes #4103

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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