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).
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.
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.
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.
#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.
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().
first_generation_selection pre-scanned the old venv and four callers (plus
`pm install`'s _first_selection) plumbed a second carry description into
sync_venv, whose with_pre_pm_baseline hook already carries the same extras under
the dependency lock. Callers now request only the default ([all] before a
selection is recorded, None after) and the hook adds the old venv's extras as
carried and automatic, exactly as before. `pm install` now also leaves out a
carried extra that no longer builds, like every other path.
A pre-PM tree can reach current code with no recorded venv selection: a
hand `git pull` whose launch migration was skipped (HERMES_DISABLE_LAZY_INSTALLS,
or no self-update stamp), or a first migration that died before it
published. Only whole-selection syncs carried the old venv then;
`hermes pm update`'s venv step recorded `[]` and a setup flow's
`sync_venv(["telegram"], explicit=True)` recorded only `['telegram']`, and
either ended the old venv's re-scan for good.
pm.install.sync_venv now unions any request on such a tree into the old
venv's selection, as it unions into a recorded one. The added extras are
automatic (a --without still wins) and carried (one that no longer builds is
left out). A tree with no old venv is unchanged.
The carry now keys on a recorded `venv` row (venv_selection_recorded), not
on facts.json existing: a facts file without that row turned it off.
Adds an e2e leg for the hand-pull state (red on main: telegram and discord
gone from the first generation).
Setup asked for just by name: `pm install --test-environment` and every
setup-pm toolchain. A lockfile without a just pin (an older branch, a test
fixture repo) then stopped setup with "just: not in the lockfile", and
archive_inputs refused it as an unknown pinned package.
Both paths now take the developer tools from the lockfile they read, so a
lockfile without just installs without it. The repository lock pins just,
so developers and CI still get it.
Add a `just` binary package (casey/just 1.59.0, musl on Linux, the static
aarch64 musl build on Termux like ripgrep) and pin all nine targets in
pm/lock.json. Digests come from GitHub's release API, as llama.cpp's do.
They match upstream SHA256SUMS.
The package is optional, so `source_install_packages` keeps it out of
every user install. `pm.testenv.DEVELOPER_TOOLS` names it, and
`pm install --test-environment` (what activation runs) installs it with
the default closure. activation_environment then puts it on the activated
PATH. setup-pm installs it in every toolchain, so every CI job can call
`just`.
Windows ARM64 just.exe imports no vcruntime140.dll (PE imports checked),
so it needs none of ripgrep's VC runtime staging.
The pnpm version lived in pm/lock.json and in root devEngines, kept equal
by a sync writer on every pnpm re-pin. node-deps.mjs, the only reader of
devEngines, now reads pm/lock.json. That drops root devEngines, the sync
writer and its test, and setup_toolchain's workaround for the
EBADDEVENGINES warning npm printed on every command in the checkout.
`pnpm update --no-save` reports it as STRICT_MIN_RELEASE_AGE_REQUIRES_SAVE,
which names no package. On that error, repeat the update with saving
allowed and no prompt on a scratch copy of the manifests and lock; its
NO_MATURE_MATCHING_VERSION record lists the picks, and the hint prints
each as the `- name@version # why` line to add.
pnpm's minimumReleaseAgeExcludePrune runs on every install that
settles the lockfile, so a stale entry made every user build rewrite
the tracked pnpm-workspace.yaml, and CI's install pruned it before the
policy test could see it. Turn it off; `hermes pm update --pnpm` drops
the entries the refreshed lock no longer holds itself, which replaces
the extra frozen install.
Reasons move to inline comments: pnpm's prune reattached a dropped
first entry's leading comment to the next survivor, and the PM prune
drops each line whole.
The 27 minimumReleaseAgeExclude entries were bare names and globs, each
lifting the 14-day gate for every future release of the package. Only
pele@1.13.0 in the lock is under 14 days old (CI's frozen install with
an empty list flags it alone), so it is the one entry left, as an exact
version.
minimumReleaseAgeExcludePrune drops an entry once the lock no longer
holds that version. pnpm runs it on install, frozen and --trust-lockfile
included, but not on `update --no-save`; `hermes pm update --pnpm` now
follows its update with a frozen lockfile-only install so the prune
lands with the lock change instead of on a user's checkout.
scripts/build/node-deps.mjs refuses any pnpm other than root package.json's
devEngines version, so `hermes pm update pnpm` or `pm lock --bump pnpm`
rewriting only pm/lock.json would break every install until someone edited
package.json by hand. Both now carry the new version into devEngines; runs
that do not re-pin pnpm leave package.json alone.
pnpm 12.15.0 (native executable) installs every JS workspace from one
pnpm-lock.yaml, imported from package-lock.json with the same resolved
versions. website/, the WhatsApp bridge and the photon sidecar stay separate
npm projects.
Configuration moves from .npmrc and the root manifest into
pnpm-workspace.yaml: the 14-day minimumReleaseAge and its excludes,
overrides, allowBuilds (the old allowScripts set, with strictDepBuilds
failing any unlisted build script), engineStrict, sideEffectsCache: false
(in-place rebuilds must not write into the store) and
verifyDepsBeforeRun: false (a `pnpm run` never installs).
The pnpm version is pinned in pm/lock.json and in root devEngines.
pmOnFail: ignore keeps that pin out of pnpm-lock.yaml: a leading pin
document makes osv-scanner read zero packages. scripts/build/node-deps.mjs
enforces the exact version instead, and every lock reader refuses a
multi-document lock. A root preinstall refuses `npm install`; devEngines
onFail is warn so npx (MCP servers, the tsc linter) keeps working inside
the checkout.
User-machine installs run --frozen-lockfile --trust-lockfile (release age is
checked when locking, in CI, not per user). node-deps removes npm-era
node_modules trees before the first pnpm install. Nix builds the store with
fetchPnpmDeps and a hash file that CI checks.
Review finding: configured-platform repair reads the declined extras, then asks PM
for the configured extra with explicit=True. A `--without` completing in between was
erased: the stale request rebuilt the extra and its opt-back-in clear emptied the
decline record.
sync_venv now takes `automatic`: the entries of `extras` Hermes chose on the user's
behalf. Under the dependency lock a declined automatic extra is left out, and only
the remaining (user-requested) extras clear a decline. Every caller is classified:
configured-platform repair, the update's and launch migration's legacy carry, the
container baseline restore and the carried part of pm install's first selection are
automatic; setup flows and `--extra NAME` stay requests.
`pm lock`'s new-opt-in-extras advice walked the [all] closure with its own
parser, beside `droppable_extras`, which `--without` validates against.
Two walks of the same set can drift, so the relock advice now subtracts
the previous extras from `droppable_extras` instead.
Recovery drops unrelated extras (Greptile r4448976307): when the first PM
migration failed before facts.json existed, `hermes pm install --without
matrix` synced only [all], so fal from the old venv was dropped and the new
facts ended every later re-scan. With no recorded selection, the install's
sync now carries the filtered legacy scan (declines applied) like the
launch migration does; fresh installs with no main-era venv are unchanged.
Concurrent sync undoes opt-in (Greptile r4448976297): sync_venv cleared the
decline after releasing the dependency lock, so a bare sync queued behind
`hermes pm install --extra matrix` could read the stale decline, build
without matrix and publish after the opt-in. The clear now runs while the
sync still holds the lock, and `--without` writes its decline under the
same lock so an in-flight opt-in cannot erase it.
Facts written by earlier releases hashed desktop metadata as payload. Verification now also accepts the include-everything digest, so an unchanged installed tree is not rejected after upgrading.
A machine stop during an install can leave an unpacked wheel in PM's uv
cache whose files are NUL bytes: uv renames its unpack directory into
archive-v0 without flushing the data. uv reuses that entry on every sync, so
every later plugin enable, repair or install failed with "The wheel is
invalid", and neither a retry nor the suggested `hermes pm doctor` helped.
When uv's install step fails on a cached artifact (invalid wheel, invalid
RECORD, or a cache pointer to a missing archive), PM now removes the named
package(s) plus any other entry that fails the same validation through
`uv cache clean`, deletes leftover corrupt archives, and retries. A retry
only follows a failure naming a package not purged yet (at most three), so a
source that serves a broken wheel fails once more with a message naming the
package and the cache directory. Other failures are untouched.
`hermes pm doctor` now reports corrupt uv cache entries, and
`hermes pm doctor --repair` removes them.
The six document skills each carried a copy of a venv bootstrap that ran
`python -m venv --clear` on a shared directory after an unlocked check, so two
agents could erase each other's install, and the pdf skill's optional installs
read a DOCS_ENV that was only set inside a branch.
`hermes pm environment NAME --extra E | --requirement R` exposes PM's existing
isolated environments (pm.ensure_environment) to shell callers: the identity
is re-checked under the environment's install lock, a rebuild lands in a new
generation published by an atomic selection, and the previous generation is
never deleted. It prints only the interpreter path on stdout. --extra reads
the extra's pins from pyproject.toml, so a Hermes update does not build a new
generation unless those pins change.
Every document skill now runs the same one-liner
(`hermes pm environment documents --extra documents --extra documents-pdf`)
when `python` lacks the libraries; the new documents-pdf extra carries
pdfplumber and pypdfium2. OCR libraries get their own named environments.
The no-tmux PTY recipe pauses 0.5 s between the text write and the Enter
write, like the tmux recipe, so the paste guard cannot read Enter as a newline.
- pm: AgentBrowser class + lock entry gone; Chromium default=True and its env
exports only PLAYWRIGHT_BROWSERS_PATH (Playwright launches without an
executable path still need it). A recorded or passed --without agent-browser
maps to chromium (pm.defaults.RETIRED_DEFAULTS), and pm gc forgets the stale
agent-browser fact so its store entry is reclaimed.
- install.sh --skip-browser/--no-playwright and install.ps1 -SkipBrowser pass
--without chromium; undo hint is hermes pm install chromium.
- Docker bakes /etc/hermes/chromium-executable-path; stage2-hook validates it
and exports nothing; the sandbox-desktop image drops the agent-browser npm
install and keeps its Playwright Chromium.
The curl|sh and irm|iex installers bootstrap uv (and, on Windows, git)
before any checkout exists, so they carry those pins as fragments that
scripts/gen-bootstrap-pins.py derives from pm/lock.json. Both re-pin
paths wrote only the lock: `pm update uv` left the installers on the old
uv, and the bootstrap-installer drift check failed until someone ran the
generator by hand.
Run the generator after either path saves the lock. It keys off the
saved lockfile's own checkout, so a fixture lock outside a checkout
regenerates nothing.
The termux pool lags nodejs.org, so one bionic 404 blocked a node bump for
every shipped target even though termux is off by default in release.py.
--skip-target drops the target from resolution; _pin_artifacts already
keeps rows for targets the decision does not cover, so the old pin stays.
str(HTTPError) is just "HTTP Error 404: Not Found", so a failed pin did
not say which upstream (nodejs.org, the Termux pool, a mirror) was
missing the file. Append e.url to the printed line and the receipt step.
Every checkout that boots Hermes commits its own dependency state under
<home>/installs/<sha256(path)[:16]>/ (venv, test venv, PM runtime; ~200 MB
each) and nothing removed it when the checkout went away. On a host that
runs `hermes -w` campaigns the directory held 499 entries / 92 GB, of which
402 (80 GB) belonged to worktrees and scratch clones that no longer exist.
The state dir already records its checkout in inputs/.project-root. A new
pm/install_states.py lists entries whose recorded checkout is gone and
removes them unless something could still be reading them (install lock
taken, or a generation lease held). `pm gc` runs it and reports the count;
the startup worktree pruner runs it after its own reaping so a removed
worktree's state follows the tree instead of outliving it.
Follow-up to the salvaged per-package pin isolation (#125400). Once a
failing pin no longer aborts the run, the surviving pins still run the
venv sync, whose receipt finalizes `ok` as latest.json. `hermes pm
status` and the desktop sync card read latest.json, so a run that left a
package on its old pin and exited 1 was recorded as a clean success.
Write a kind=update `failed` receipt after the sync, with one failed step
per pin, whenever any pin failed (also when every pin failed, which
previously wrote no receipt at all). Trim the tests to the two
invariants and assert the receipt in the mixed case.
_apply_pins let any exception from _pin_artifacts propagate: one broken
pin - a package's resolution bug (gh's 3-part target split) or one
target's upstream pool skew (Termux rolling pool 404 while nodejs.org
is ahead) - aborted the entire run, blocked every unrelated package,
and left lockfile.save() unreached, so any failure meant zero progress.
Catch per package, pin everything that succeeds, install the pinned
set, print a 'pinned X, failed Y' summary, and exit non-zero when
anything failed. A run where every pin fails still leaves the lockfile
untouched.
Fixes#125386
Every cleanup that runs after a publish or restore has finished deletes
garbage: the displaced .previous-* entry, a restored .displaced-* tree,
the fetch-* archives. A running Hermes process keeps the replaced
interpreter's DLLs mapped, so on Windows that delete can fail far past
the retry window and turned a completed update into "install failed:
[WinError 5]" (#124807).
One helper now owns that cleanup for all four sites. When the delete
fails it renames the tree to .reclaim-<uuid> (Windows permits renaming a
tree with mapped images): the old slot is free for the next publish of
the same entry, no restore can ever pick the half-deleted tree up, and
the next install or `hermes pm gc` deletes it once the hold is gone.
This replaces the sidecar marker for restored displacements (#128955)
and the warn-and-keep for previous entries from the salvaged commit:
a kept .previous-<entry> blocked the next publish of that entry, could
be restored half-deleted, and was unreachable by gc after a version bump.
Computer use and browser use are meant to work out of the box. The PM rewrite
(3d12e86ef1) and the MSIX installer rework (47f4ab3a17) dropped the
install-time cua-driver fetch (7060ac7bed) and the Browser Use CLI install
(baa6b2e34d). On a fresh install the computer_use check_fn therefore stayed
False, so the tool never reached the model and its lazy ensure could not fire,
and browser_exec quietly fell back to the built-in tools.
- cua-driver is a default PM package, so the installers, a bare
`hermes pm install` and `hermes update` carry it on every target it builds
for. Adds the missing Android gap (the lock has no bionic artifact).
- The shared default-tool step, which the installers (via source completion)
and `hermes update` both run, provisions the Browser Use CLI for the default
and explicit Browser Use backends. `--skip-browser` declines it along with
agent-browser, and `off`/Camofox never use it.
- Installers regain --skip-computer-use / -SkipComputerUse (recorded as
`--without cua-driver`).
- The update message stops calling every default "browser tools".
packages.py and security_packages.py imported the private _MUSL_TARGETS
across modules; make it a public store constant next to ALL_TARGETS.
The _pin_tool hash memo is an unrelated optimisation, out of scope here.
A bare `pm install` fetched agent-browser (~200 MB with Chromium) before
the venv sync, so a Windows ARM64 machine without build tools downloaded
it and then failed preparing the native build. Install defaults only once
the venv (and its build tools) succeeded.
Browser tools find agent-browser only in PM's store or on PATH and their
readiness check never installs it, so a fresh install silently had no
browser_* tools. Package.default marks an optional package that a bare
`pm install` also carries; a failed download of it warns instead of
failing the install. `pm install --without NAME` records the opt-out in
declined-packages.json beside PM's install state, and naming the package
explicitly clears it. agent-browser and chromium gain a Termux gap: Termux
owns its browser stack and there is no bionic Chromium.
The no-argument relock first runs PM's lock check, which reported a stale
lock the way build_env --check-lock does: a red "✗ Resolving Python
dependencies failed" plus uv's raw output, printed right before the relock.
A stale lock is the expected case for this command, so the check now takes
`quiet=True`, which captures uv's output instead of reporting it. The command
prints "→ Checking uv.lock…" then either "already current" or "out of date;
relocking" with the relock's own progress. build_env --check-lock keeps its
failure report unchanged; CI's remediation relies on it.
Contributors had to run `python -m pm.build_env --source . --lock-only`, then
re-source activate, then call sync_venv for opt-in extras, while `hermes pm
lock` only pinned tool artifacts in pm/lock.json. Now `hermes pm lock` with no
arguments is the one step: it runs the same PM check_project_lock /
lock_project operations as build_env's --check-lock / --lock-only (same
exclude-newer quarantine), writes nothing when the lock is current, changes
no environment, and prints the activate command to run next. Activation
syncs [all] plus recorded extras only, and --test-extras replaces the
default, so a newly added extra outside [all] gets
`source ./activate --test-extras all,NAME` (`-TestExtras` on PowerShell).
`hermes pm lock --bump NAME VERSION` keeps writing pm/lock.json; NAME and
VERSION are now only accepted together. build_env --lock-only is unchanged
for scripts. Contributor docs, AGENTS.md, CONTRIBUTING.es.md, the pyproject
comment, and the uv.lock CI remediation text point at `hermes pm lock`.
cmd_install: flag validation and the venv/test-environment phase move
to helpers (CC 40 -> 18). cmd_update: resolution, per-row report, pin
application, uv and npm refreshes move to helpers (CC 51 -> 22). The
messages, order and exit codes are unchanged; a dead `target` local in
cmd_update is dropped.
PowerShell hands child processes a console with
ENABLE_VIRTUAL_TERMINAL_PROCESSING off, so conhost drew the progress
line's ESC[2K as a glyph: every install.ps1 status line printed as
'<-[2K✓ ffmpeg'. The progress stream now opts its console handle in to VT
before use, and a handle that is not a console (NUL reports isatty()
too) gets plain lines instead.
The _hermes-python prologue compared uv.lock / pyproject.toml / pm/lock.json
against facts.json with `-nt`. facts.json is only rewritten on a real sync,
so a checkout that rewrites an input without changing it left the input
newer forever: every run from an activated shell re-sourced activate
(~370ms instead of ~13ms).
pm now records, after every successful full-closure install (no-op syncs
included), a stamp per input under installs/<key>/inputs carrying the exact
mtime the install was verified against, snapshotted before installing so
an input edited mid-install still reads as stale. The prologue re-activates
when any input's mtime differs from its stamp in either direction (branch
switches can move it backwards), when an input is missing, or when there
are no stamps. It globs the stamp dir, so pm owns the only input list.
Also read pyvenv.cfg as utf-8-sig (footgun lane, same file).
source ./activate and . .\activate.ps1 always run setup, and setup always
runs `python -m pm.cli install`. An explicit install re-hashes every
published tool entry so it can repair a corrupted one. On this machine
that hash reads about 550 MiB and takes 6.0 of the 6.6 seconds, even
when nothing changed.
Shell activation now passes --trust-recorded and trusts the digest the
install recorded, the same check startup already uses. A missing tool
is still installed and a stale venv is still rebuilt. `hermes pm
install` and `hermes update` keep the byte check, and the flag refuses
names, --extra, and --target so it cannot narrow an install someone
asked for by name.
Measured on this machine, already up to date: the activation path drops
from 6.6 s to 0.9 s. A bare `python -m pm.cli install` stays at 7.2 s.
The remaining 0.9 s is process startup and imports, not hashing.
Windows PowerShell 5.1 returns every match from Get-Command. .Source on
that array joins the paths with a space, and the call operator then treats
the joined string as one program name. Git for Windows ships git.exe in
cmd\ and bin\, so setup died with CommandNotFoundException before pm
install ran.
setup-hermes.ps1 now installs the tool closure first (`pm install
--tools-only`), then prepares the ARM64 compiler environment, then syncs
the venv. The sync inherits that compiler environment. A bare `pm install`
and the update takeover path publish tools and put them on PATH before
uv sync. A missing tool stops the sync. A missing venv does not.
Verified: scripts/run_tests.sh on test_install_default_closure.py,
test_install_extra.py, and test_windows_build_deps.py — 13 passed.