Commit Graph

504 Commits

Author SHA1 Message Date
Maciej Lisiewski
2483ca10ff Merge pull request #155534 from NousResearch/sec3/148835-git-for-windows-bump
fix(pm): bump the pinned Git for Windows 2.53.0.3 -> 2.56.1
2026-11-15 01:31:13 +01:00
Teknium
fa1aab3187 fix(pm): an empty extra alias counts as held, so a healthy generation is not rebuilt for it
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
vision = [] is anchored on Pillow, which is core: every generation holds
it, and carrying it from the committed environment changed only the
stamp, rebuilding a healthy environment on its next sync (Greptile
review on #155730).
2026-11-14 08:13:42 -08:00
Teknium
215fcce932 fix(pm): a rebuilt generation keeps the extras the generation it replaces held
Past the pre-PM migration, every sync's baseline was the recorded selection alone. A ledger
narrower than its committed environment (an SDK restored by hand after an update dropped it,
or a ledger an interrupted migration wrote short) lost python-telegram-bot and the rest on the
next rebuild while the update reported success (#96180). The sync now carries, like the
pre-PM carry, every non-umbrella extra the committed generation's site-packages holds and the
ledger lacks; declined, gated-off and already-covered extras are not carried.
2026-11-14 08:13:42 -08:00
Maciej Lisiewski
a95f462421 fix(pm): bump the pinned Git for Windows 2.53.0.3 -> 2.56.1
2.53.0.3 predates three Git for Windows security releases: 2.56.0.3
(eMudhra CA compromise, Git LFS CVE-2026-105803), 2.56.0.4 (bundled
brotli 1.2.1, CVE-2026-111497, reachable via libcurl's br encoding) and
2.56.1 (git CVE-2026-111760 recursive-clone RCE and five others).
2.56.1 was published 2026-11-10, past the release-age window; its first
build ships as PortableGit-2.56.1-*, which the salvaged fetch_url fix
resolves.

2.56 moved the x64 MSYS2 prefix from mingw64/ to ucrt64/, so the
trampoline self-heal git-core candidates, the non-login bash coreutils
PATH dirs and the desktop bundle-arch PortableGit exemption now also
cover ucrt64 (mingw64 kept for existing installs).

Fixes #148835
2026-11-14 17:07:28 +01:00
liuhao1024
094f187c9d fix(pm): drop the revision from first-build PortableGit asset names
Git for Windows publishes the first build of a tag without the revision
in the artifact name (PortableGit-2.56.0-64-bit.7z.exe, not
PortableGit-2.56.0.1-64-bit.7z.exe), while the release directory keeps
it (v2.56.0.windows.1/). fetch_url always spliced in .{build}, so every
pin of a .windows.1 release 404'd.

Fixes #127044
2026-11-14 17:07:28 +01:00
Teknium
6e3683a969 fix(pm): carry skills and plugin/MCP catalogs into the snapshot too
The same sweep dropped every other root data dir read beside the
project root: skills/ and optional-skills/ (tools/skills_sync.py),
plugin-catalog/ (hermes_cli/plugin_catalog.py) and optional-mcps/
(hermes_cli/mcp_catalog.py). A live PM environment on this host has
none of the five. Name them all in one set swept once.

Covers the intent of #128820 by @Wenfengcheng.
2026-11-14 02:36:10 -08:00
Yuan Li
e0135da54a fix(pm): copy locale catalogs once via the snapshot directory sweep
agent.i18n resolves locales/ beside the running code, and a PM-built
environment runs from the workspace snapshot, which only copied
setuptools package roots. locales/ never travelled, so every t() call
returned its raw key (Telegram /model picker, gateway.busy.ack).

Name locales in the existing one-pass directory sweep so it is copied
exactly once whatever packages.find.include says.

Fixes #152630
Fixes #128799
2026-11-14 02:36:10 -08:00
Teknium
cd482c63bf fix(pm): claiming a found pin leaves the caller's view on its own pin
_refresh_found_env reloaded the facts object it was handed. Callers pass the
per-checkout view _installed_location returns, so the reload replaced that view's
packages with the shared file, and writable_copy returned whatever another
checkout selected last: a sealed install pinned to node 1.0 ran node 2.0 on the
first call after the store's selection moved (review repro wc_probe.py).

Read a fresh Facts(path) for the claim instead and leave the caller's view alone.
2026-11-13 16:09:55 -08:00
Teknium
dad713f77a fix(pm): reusing another checkout's writable copy claims it
Same class as Greptile "Concurrent installs miss an owner": on a sealed
Windows payload, writable_copy returned an existing copy another checkout
made without recording this checkout as an owner, so that checkout's
upgrade let gc delete the copy this one runs on. A realizing lookup now
goes through _refresh_found_env, which claims the row (#149497).
2026-11-13 16:09:55 -08:00
Teknium
c401e1441d fix(pm): an outdated read falls back only to the store's selected row
Greptile "Fallback chooses another checkout's tool": with
allow_outdated=True a broken selected entry let the loop return the next
usable history row, another checkout's older pin. The exact-pin search
still covers every row; only the selected row may be the outdated
fallback.
2026-11-13 16:09:55 -08:00
Teknium
a39e5ff81c fix(pm): a cache hit on another checkout's install of this pin claims it
Greptile "Concurrent installs miss an owner": B waits on the install lock
while A installs the pin both lock; B's _install then hits A's entry with
the selection and env unchanged, so nothing was recorded and B never
joined the row's owners. A's later upgrade dropped the row and gc deleted
B's still-pinned tool. _refresh_recorded_env now re-records whenever this
checkout is missing from the row's owners, the one rule both the install
cache hit and ensure's found-entry refresh go through (#149497).
2026-11-13 16:09:55 -08:00
Teknium
f01077386c fix(pm): a cache hit on this checkout's pin re-selects it in the store
Review of #154832: after A, B, then A prepared one build store, A's third
prepare hit its pin in the history row and returned without re-recording,
so the selected row stayed B's. Build admission (verified_tools) refused
A's lock ("tool source failed verification") and prune_staged_store kept
only B's entry, deleting A's.

_install's cache-hit path now re-records the hit row when it is not the
selection, at the one seam every caller shares.
2026-11-13 16:09:55 -08:00
Teknium
bbabe4fbed fix(pm): gc keeps the tool pins of a checkout that only ran ensure
Review of #154832: gc judged a pin owner alive only by its installs/<key>
dir, but a checkout that only ever ran ensure (a sealed or resident
runtime commits no dependency state) recorded ownership without one, so
another checkout's `pm gc` deleted a tool it was still running on.

Every pin record now leaves the owner's state record
(installs/<key>/inputs/.project-root), the same durable marker the orphan
sweep already uses to prove a checkout deleted, so a claimed pin is only
released once that sweep removes the dir.
2026-11-13 16:09:55 -08:00
Teknium
9bebb856fa fix(pm): gc keeps this checkout's artifact-less pin
A lock that pins no artifacts for a target (source fixtures, a custom
python) is matched by version, as Facts.installed already does; the
live-pin check demanded an artifact identity and reclaimed the selected
python (test_source_python_pin_update_survives_real_gc on macOS CI).
2026-11-13 16:09:55 -08:00
Teknium
fea3dd340f fix(pm): gc reclaims a deleted checkout's sole tool pins too
Review (kvnloo): drop_dead_history only looked at facts with a `previous`
list, so a tool only a deleted checkout pinned (no history) kept its entry
forever. gc now judges every tool row: one with no owners (pre-history)
or matching this checkout's own lock stays, otherwise a row lives while
any owning checkout's install state dir exists. A tool left with no live
row loses its fact.

A checkout that finds an entry another checkout recorded now claims it, so
that checkout's deletion cannot reclaim an entry still in use.
2026-11-13 16:09:55 -08:00
Teknium
02667fe42d fix(pm): a deleted checkout's selected tool pin also gives way in gc
gc only released dead history rows, so the checkout that recorded a tool
last kept its entry selected (and on disk) after it was deleted. A dead
selection now yields to the first live pin in its history; a selection
with no owners (written before per-install history) stays.
2026-11-13 16:09:55 -08:00
Teknium
18a0896ad9 style(pm): drop the quoted Facts annotation (UP037) 2026-11-13 16:09:55 -08:00
Teknium
90b9d221b0 docs(pm): say why a missing checkout path alone keeps its tool pins
Also correct tool_store_pins.py: facts.json now keeps other checkouts' pins
as history, so the remaining reason not to share the account store is that
provisioning other pins writes into it under a concurrent run.
2026-11-13 16:09:55 -08:00
Teknium
9dd6a2ecbc fix(pm): let gc reclaim superseded tool pins in the shared facts history
The shared-pin history kept every entry a tool was ever recorded at: each
upgrade moved the old row into `previous` and nothing removed it, so
`hermes pm gc` could never reclaim an old uv/python/chromium entry again.

Each history row now names the checkouts that pin it (their install key).
Re-recording moves this checkout's claim, so its own upgrade leaves no
history behind; a row nobody claims (a legacy one included) is dropped as
before. gc releases the claims of checkouts whose install state dir is
gone, after the orphan-state sweep runs in the same pass.

An explicit outdated read again returns the store's selected row first,
never an older pin another install keeps.
2026-11-13 16:09:55 -08:00
Kevin Rajan
a2b6578b8a fix(pm): preserve first search-root fallback for outdated tool facts
Regression for 100yenadmin's shared-store report (#149497): if
multiple stores contain outdated facts, keep the first store's
published fallback while allowing an exact current pin in any store.
2026-11-13 16:09:55 -08:00
Kevin Rajan
918cdf082d test(pm): keep selected outdated fallback with shared tool history
Cover the selected-entry fallback and remove an unused test import.
Reported by 100yenadmin (NousResearch/hermes-agent#149497).
2026-11-13 16:09:55 -08:00
Kevin Rajan
4c178b0f5b fix(pm): preserve shared tool pins across installs (#149497)
Keep prior verified tool facts addressable by pinned identity while retaining
legacy selected-fact consumers and GC roots. Add a regression for alternating
installs on one HERMES_HOME.

Reported by 100yenadmin (NousResearch/hermes-agent#149497).
2026-11-13 16:09:55 -08:00
Maciej Lisiewski
e9086bf1d8 fix(build): keep a user's lowercase userconfig when its uppercase twin names the Hermes npmrc
With NPM_CONFIG_USERCONFIG=$HERMES_HOME/npmrc and npm_config_userconfig=<other>,
user_npmrc took the first twin in dict order, so the twin filter dropped the
user's non-empty lowercase choice. Probed with npm 12.2.2 and pnpm 12.15.0:
pnpm reads only the lowercase name (empty as unset), npm the last non-empty
twin in environ order, so the installers already split. user_npmrc now prefers
a non-empty lowercase value (as pnpm and the desktop's configuredUpdateHosts
do), and source_build_env collapses any twins into one NPM_CONFIG_USERCONFIG
naming that file, so the bridge, PM's downloads and both installers agree.
2026-11-13 18:16:09 +01:00
Maciej Lisiewski
b51a30c461 Merge pull request #154165 from NousResearch/sec/91424-update-lock-convergence
fix(pm): move plugin generations onto core's newer lock pins
2026-11-13 17:50:35 +01:00
BearHuddleston
96e4107167 perf(bundles): ship the payload uv cache's venv-identical files once, as links
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
v0.22.0 on macOS cannot update in-app to any bundle whose update ZIP is
1 GiB or more. It ships Electron 40, whose Squirrel.Mac reads the whole
ZIP into one NSData; past 1 GiB CFData asks Electron's allocator for
2 GiB, which refuses, and the app dies with SIGTRAP (electron/electron
#55089, fixed in Electron 44.7). Measured with the real signed v0.22.0
app: a 1,070,000,000-byte ZIP downloads, a 1,080,000,000-byte one kills
it. The rc.2-v0.23.2 ZIP is 1,447,529,425 bytes.

Most of that is the payload uv cache shipping a second copy of the
venv: 31,771 of its archive-v0 files (297 MB compressed) are byte for
byte the venv's installed files.

Off Windows, staging now replaces each archive-v0 file the payload venv
holds byte for byte with a relative link to the venv copy. Files the
installer rewrote (RECORD) or placed elsewhere (.data) stay. The uv
seed recreates links that stay inside the cache, as before, and copies
the bytes of a link that leaves it, so the machine cache keeps no link
into a payload an update will replace. MSIX packages hold no links, so
Windows is unchanged.
2026-11-13 10:16:38 -06:00
Maciej Lisiewski
a1245eee47 fix(pm): move only the pins core moved, and only on the host's fork
core_lock_upgrades compared core's lock with the seed alone, so a plugin
holding a core transitive below core's pin (allowed within core's ranges)
was -P'd onto core's pin on every later rebuild, evicted, re-admitted by
the bisect retry and evicted again; `hermes pm install` raised
ResolutionConflict. Each fresh generation now records the core uv.lock it
was built from (core-uv.lock beside the resolved lock); a pin moves only
when core's lock moved past that record too. Generations built before this
keep the seed-only comparison.

`uv lock -P` unpins a name in every fork, so a core bump to a fork the
installing interpreter never selects floated the host's fork to the newest
index release. Forks whose resolution-markers do not hold for the
installing python are skipped.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:59:25 +01:00
Kevin Rajan
a96107607b fix(pm): match grouped OR markers to host-narrowed seed forks
Keep opaque OR clauses stable when uv groups them in host-narrowed
resolution markers. Preserve the affected core pin without incorrectly
comparing against an unrelated higher-version Python fork.

Regression for c2h5oh's PR #154165, issues #91424 and #91931.
2026-11-13 16:54:42 +01:00
Maciej Lisiewski
0426762199 fix(pm): match a host-narrowed seed fork to core's fork on update
A generation solves only its host, so each seed fork's resolution marker is
core's marker with the host terms ANDed on. The raw-tuple lookup missed it,
fell back to every seeded version of the name, and a bump to the lower
Python fork stayed on the old pin. Match a seed fork that holds every
top-level conjunct of core's marker.
2026-11-13 16:54:42 +01:00
Maciej Lisiewski
64849c35aa fix(pm): compare each platform fork against the seed's same fork
A core lock bump to only the lower of two platform forks was skipped because
the version had to beat every seeded pin for the name.
2026-11-13 16:54:41 +01:00
Maciej Lisiewski
950c35d0ef fix(pm): move plugin generations onto core's newer lock pins
A generation with plugin members is seeded from the previous generation's
lock, and uv keeps every seeded pin that still resolves, so a transitive
core's uv.lock bumped (a security release) never reached a plugin-enabled
install. The lock step now passes `-P name==<core version>` for each index
package core's lock holds above every seeded pin; plugin-only pins and
plugin-vs-plugin choices keep the incumbent. A plugin that cannot take the
new pin fails the resolve and the update's existing eviction disables it.
Member-less, repair and replay builds stay frozen and unchanged.

Fixes #91424
Fixes #91931
2026-11-13 16:54:41 +01:00
Kevin Rajan
7544bbda1d fix(pm): refuse sha256-less store archive pins at the lock
A sha256-less pin for an installable package is currently accepted by
Lockfile.artifacts(), then crashes _install() at artifact["sha256"].
Only termux-docker's docker:// digest is a legitimate no-archive pin.
Add focused malformed-pin regressions while retaining that exception.

Follow-up to NousResearch/hermes-agent#154529 by c2h5oh.
2026-11-13 13:57:55 +01:00
Maciej Lisiewski
6e4d7770bc fix(pm): keep every lock-derived store path one component under the root
Follow-up to the sha256 check: the lock's version and target also build
store entry names (`<name>-<version>-<target>`) that _remove_entry rmtrees
and publish renames, and the url basename names the scratch download, so
each is now refused unless it is a single path component. The lock-level
check no longer rejects sha256-less registry-digest rows (termux-docker's
docker:// pin), which never touch the store.

The downloader's plain-http loopback allowance was a string prefix test
that `http://127.0.0.1:@evil.com/` passed; it now parses the URL and
requires an http loopback hostname with no userinfo.

Fixes #138359
2026-11-13 13:57:55 +01:00
liuhao1024
8c8ddc90c2 fix(pm): fail closed on off-shape lock sha256 before it becomes a store path
A lock.json artifact sha256 flows unchecked into `fetch-<sha>` entry
names; Store.fetch_many and _remove_downloads then rmtree whatever that
name resolves to, so a hand-edited or hostile lock row can point the
cleanup outside the store root (#138359, item 1).

- Lockfile.artifacts() now validates every pin row (dict, non-empty url,
  64-hex lowercase sha256) and raises ValueError off-shape — fail-closed
  at the source every install path reads.
- pm/store.py gains fetch_entry_name() which enforces the same shape and
  is used for every fetch-entry construction/publish/return, so no future
  caller can bypass the lock-level check.
- pm/install.py _remove_downloads builds entry names through the same
  helper.

Scope note: items 2 (facts.json env injection) and 3 (downloader
loopback prefix test) from the issue are separate root causes and are
intentionally left out to keep this PR focused.
2026-11-13 13:57:54 +01:00
BearHuddleston
effbebd184 fix(pm): fetch pnpm on demand on Termux instead of requiring it
#150419 pinned pnpm's android-arm64 executable so `hermes dashboard` can
fetch it on Termux, and dropped pnpm's linux-arm64-bionic gap to do so.
That also made pnpm a required tool there: drift() requires every
non-optional package the target can install, and the .deb records only
python, node, uv, npm, ffmpeg and ripgrep. Every installed .deb printed
"install out of sync (pnpm: not installed or outdated)", and the .deb's
install validation (`pm.check()` in validate_installed.py) has failed the
termux-deb job of every nightly since Nov 8, which blocks publish-canary.

The Termux docs already say the first `hermes dashboard` downloads pnpm:
the .deb ships a prebuilt TUI, and the dashboard's web build needs the
network for its dependencies anyway. A package can now name targets where
it is installed on demand (`on_demand`, like `gaps`), and pnpm names
linux-arm64-bionic. drift(), `hermes pm doctor` and a bare install's roots
read Package.is_optional(target), so all three agree on what bionic needs.

Tests: an assembled .deb payload passes pm.check() on bionic; pm doctor
reports pnpm as optional there; a bare install selects pnpm on linux-x64
but not on bionic. Each fails on the base.
2026-11-12 18:57:08 -06:00
Maciej Lisiewski
415fa335b4 Merge pull request #154540 from NousResearch/sec/143061-node-npm-bump
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
fix(pm): bump pinned npm 12.0.2 -> 12.2.2 for bundled-module CVEs
2026-11-13 01:02:47 +01:00
Maciej Lisiewski
34d2d16bd9 fix(pm): bump the pinned npm 12.0.2 -> 12.2.2 for its bundled-module CVEs
npm 12.0.2 bundles brace-expansion 5.0.7, ip-address 10.2.0, tar 7.5.19
and undici 6.27.0, all with fixed releases. 12.2.2 (published 2026-11-04,
past the release-age window) bundles 5.0.12, 10.7.5, 7.5.22 and 6.29.1.
The pinned npm sits ahead of node's bundled copy on PATH, so this is the
npm every pm-run npm command uses. No node release yet bundles an npm with
these fixes (26.13.1 still ships npm 11.20.0), so the node pin stays.

Refs #143061
2026-11-12 20:03:58 +01:00
Adolanium
9ac84a11ca fix(pm): pin Chromium to Chrome for Testing 156.0.8078.80
The packaged browser was Chrome 145.0.7632.6. Playwright 1.64 looks up
chromium-1248, and linux-arm64 now downloads the same Chrome build
instead of Playwright's older mirror.
2026-11-12 19:55:11 +01:00
emozilla
f6506b50d6 chore(local-models): update llama.cpp to b12144
Moves all five engine backends from b11671 to b12144.

b12144 is the last upstream release whose notes and archives both name CUDA
toolkit 13.4 (b12167 carries 13.4 archives under notes that list 13.5 files).
Releases from b12170 on are built with 13.5, which raises the driver
requirement for every GPU that compiles its kernels at load, so the pin stops
here until Hermes can tell whether the CUDA build runs on the machine.

LFM3 models load on this build; b11671 stops with "unknown model
architecture: 'lfm3'".
2026-11-12 00:50:41 -05:00
emozilla
22afc49efd fix(pm): name llama.cpp CUDA archives by the toolkit each tag was built with
Upstream moved its CUDA 13 release builds from toolkit 13.4 to 13.5 at b12170
(ggml-org/llama.cpp 3ed7284f2). LlamaCppCuda hardcoded cuda-13.4 in its archive
names, so a pin for any tag from b12170 on asked for archives that do not
exist. The package now picks the toolkit from the version: 13.4 through
b12167, 13.5 from b12170.

The class docstring records what a 13.5 pin has to deal with: a GPU the build
carries no native code for (Turing, A100, Hopper, GB200/GB300) compiles its
kernels at load and needs a driver at least as new as the toolkit.
2026-11-12 00:50:41 -05:00
alt-glitch
5581f2e543 fix: mark the new PM-private import in pm/extras.py
Main added `from pm.environment import PM_BUILT_KEY` in pm/extras.py after this branch was cut. With the pm/** TID251 ignore removed, it needs the same per-line noqa as the other PM-private imports in pm/.
2026-11-11 16:00:17 +05:30
alt-glitch
6f1f08ef38 refactor: bring pm/ under the import bans and route plugin dir lookups through one helper
Remove the pm/** TID251 ignore (per-line noqa for pm-private imports) so future old-name bans reach pm/. Route six __file__-derived bundled plugins paths through get_bundled_plugins_dir().
2026-11-11 16:00:17 +05:30
BearHuddleston
322b801d33 fix(pm): wait out a scanner hold when Python.stage drops the ARM64 x64 CRT helper
On win32-arm64, Python.stage deletes the x64 vcruntime140_1.dll that
python-build-standalone ships beside ARM64 python.exe. The tree was
extracted and hoisted moments earlier, so a Windows antivirus or indexer
scan can still hold the file; the delete is then refused for a moment
([WinError 32], EACCES) and the single-shot unlink failed the install.

Run it through retry_held, as #153075 did for the same DLL in
_unpack_vc_runtime, so both ARM64 CRT drops ride out the hold. A hold
that never clears still raises PermissionError.

Suggested by @kshitijk4poor in his review of #153075.
2026-11-11 03:08:51 -06:00
BearHuddleston
fb5d314b10 fix(pm): wait out a scanner hold when dropping the ARM64 payload's x64 CRT helper
_unpack_vc_runtime writes each CRT DLL from the redist payload and
deletes the ARM64 payload's x64 vcruntime140_1.dll right after writing
it. A Windows scanner opens that file as soon as it is closed, so the
single unlink can be refused with [WinError 32] and fail the llama.cpp
or whisper.cpp install on Windows ARM64. Retry it like the other
fresh-tree mutations in PM.
2026-11-11 02:51:43 -06:00
BearHuddleston
1ceead0c53 fix(pm): wait out Windows scanner holds when staging pnpm
pnpm unpacks with its own hoist (flatten = False): it moves
package\pnpm.exe, or the launcher's package\dist, out of a tree
extracted moments earlier and deletes the rest. Each of those ran once,
so a Windows scanner still holding the fresh files failed the install
with [WinError 32] (a file) or [WinError 5] (a directory) under
tools\.staging-*\. pnpm is a required tool, so `hermes update` then
left the source updated and the dependencies incomplete, and every
retry re-extracted and hit the same hold.

Route the three mutations through retry_held, the helper #133484 gave
flatten_single_dir for the same hold (#131884). pnpm's own hoist came
later with the npm-to-pnpm switch (#149746) and never got it. A hold
that outlasts retry_held's budget still fails the install.
2026-11-11 02:51:43 -06:00
Bear Huddleston
29f6caf1a2 Merge pull request #152236 from NousResearch/fix/llamacpp-win-vc-runtime
fix(pm): ship the VC++ runtime beside the Windows llama.cpp engines
2026-11-10 07:43:10 -06:00
BearHuddleston
31dab7f497 fix(pm): tell the user when a published plugin keeps the staging DACL
StagedPlugin.publish dropped inherit_parent_acl's result. When Windows
refused the reset, the plugin still published with the tempfile staging
folder's protected DACL, which a non-elevated Hermes may be unable to
read, and nothing said so. The explicit grant it replaced had logged the
icacls remedy.

A refusal on Windows now prints a warning on the worker's stderr, which
reaches the user, with the `icacls "<plugin>" /reset /t` repair, and
records it in the sync receipt, the pattern carried_extras and
plugin_eviction use. The reset stays best effort and the publication
still commits.
2026-11-10 06:26:16 -06:00
BearHuddleston
e1ee6a8103 fix(pm): let the inherited DACL replace the explicit user grant
The previous commit, Casey's inherit_parent_acl from #142284, resets the
published root to inherit plugins/'s entries, and Windows propagates that
down the tree in-process. plugins/ already grants the user, so this covers
the elevated install this PR was opened for. On Windows 11 (build 26200), a
UAC-elevated install read back with a limited token failed with WinError 5
on the base; with the reset the tree is fully inherited (SYSTEM,
Administrators, the user) and discovery finds the plugin. It also covers
what the explicit grant never did: a normal install whose __pycache__ an
elevated gateway writes later, and the sandbox groups plugins/ grants.

The elevation-gated grant_user_access on top only added a redundant ACE and
an icacls launch per elevated publication, so it goes, with its tests.

kvnloo's ordering stays: the permission fix runs before the install
metadata commits, because recovery keeps a committed tree.
test_publication_acl_order.py pins that on every host, adapted from his
test_worker_grants_acl_before_cli_returns.

Co-authored-by: Casey <caseyrussell1976@gmail.com>
Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
2026-11-10 06:26:16 -06:00
Casey
f546a7e88b fix(pm): published plugins inherit plugins/'s Windows permissions, not the staging folder's
Python >= 3.13 gives tempfile folders a protected DACL on Windows (SYSTEM,
Administrators, OWNER RIGHTS), and plugin install/update stage in one, so the
published plugin dropped every entry plugins/ grants (the user, Users, the
sandbox groups). A gateway run as a Windows service is elevated, so its
__pycache__ there was owned by Administrators and the same user's non-elevated
hermes could neither read nor delete it.

StagedPlugin.publish now calls pm.filesystem.inherit_parent_acl on the
published root after the os.replace: an empty, unprotected DACL that Windows
propagates down the tree. Explicit entries are kept; best effort, no-op off
Windows.

[BearHuddleston: adapted to #152234, whose worker already granted the user at the same point; kept that grant below this call so this commit stays this change alone. The next commit drops it.]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 80ad13f6e5edce0301b0ade12ca347c6401ce515)
2026-11-10 06:26:16 -06:00
BearHuddleston
1fd05f6abb fix(plugins): grant a published plugin with one inheritable ACE in the PM worker
StagedPlugin.publish runs in PM's worker, whose runtime environment
(pm/pyproject.toml) has no pywin32. grant_tree_user_access therefore
took the icacls fallback for every entry: a whoami and an icacls
process per file, while holding the plugin metadata lock, so a plugin
with a node_modules tree launched thousands of processes on install.

grant_user_access(target, repair_children=True) does the right thing on
both writers. The icacls fallback first walks the whole subtree and
refuses one holding a link, then writes the root's inheritable ACE,
which propagates to the tree: one whoami and one icacls. The pywin32
write does not propagate, so it still grants each entry. Its own
warnings carry the remedy.

The fixture's fake pywin32 writer now returns True like the real one
when it wrote, so children are owed on that path.
2026-11-10 06:26:16 -06:00
BearHuddleston
2e1661f0d2 test(plugins): run the publication tests through the real PM move
The previous commit moved the elevated grant from publish_plugin into
StagedPlugin.publish, but the fixture still replaced sync_venv with a
bare shutil.move, so nothing granted on that path and the elevated
publish_plugin test failed. The fake sync_venv now runs the real
StagedPlugin.publish (without the dependency build), so both
publish_plugin tests exercise the move that grants. Also drops the
extra blank line before StagedPlugin and adds the missing one before
the new test.
2026-11-10 06:26:16 -06:00