In the process tree that the Store app's execution alias starts, a
program whose own executable is outside WindowsApps cannot start one
inside it. cmd.exe gets "Access is denied" from the packaged node.exe,
and npm starts every package bin through cmd.exe. So every npx MCP
server died, and so did each `npm exec` in the terminal on a machine
without its own Node. A venv's Scripts\python.exe redirector exits 101
when it starts the packaged interpreter, which broke `python -m venv`.
A copy of the same files in the writable store starts without error.
PM already makes one for Python builds (#135236). That code moves from
pm._uv._toolchain to pm.user_facing.writable_copy. pm.user_facing.copies
swaps each packaged npm, node and python dir for that copy, made on
first use from the verified entry: a copy plus a digest check, no
download. Two places use it:
- the terminal's fallback dirs (user_facing_path), behind the user's
own tools;
- Hermes's npx/npm/node for a bare `command: npx` MCP server, which
stays Hermes's own as on main.
When lazy installs are off, PM makes no copy and the packaged dir stays.
Live check on Windows 11 arm64 (Store build 2026.6819.1065.0), in the
alias-started process tree: cmd.exe -> npx.cmd -> node.exe fails with
"Access is denied" from the package, and passes from a copy of the same
node and npm dirs in the user profile.
pm.install.activate puts the store's tool dirs first on the backend's
PATH, so Hermes's own code finds the pinned binaries. The terminal built
its PATH from the same environment, so every command the user or the
agent ran got Hermes's node, npm, python and rg ahead of the ones the
user installed. On the Windows Store build that was worse than a version
surprise. cmd.exe cannot start the packaged node.exe, so `npx` failed
with "Access is denied" even with Node.js installed.
pm/user_facing.py moves the store's tool dirs behind the user's own
entries for terminal commands, foreground and background. Hermes's
tools stay as the fallback for a machine without them. Two exceptions:
- Hermes's Python stops just before the Windows app-alias dir when that
dir holds only the Microsoft Store stub (no python3.N.exe), so a
machine without Python still runs a real one.
- On Windows, Git Bash's dirs stay first. They are store dirs too, and
a non-login `bash -c` needs its coreutils ahead of System32's.
Hermes's own operations keep the pinned tools: pm.install.activate is
unchanged, and file search resolves PM's ripgrep (previous commit).
Linux, through LocalEnvironment: `type -ap node python3 rg` lists the
user's Nix copies first and ~/.hermes/tools second. Before this commit
it listed ~/.hermes/tools first.