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.
python-build-standalone's Windows build ships python.exe only, so python3
(npm/vitest helpers, POSIX-minded scripts) resolved past the activated PATH
to the Microsoft Store App Execution Alias stub, which fails. Stage a copy of
the python.exe launcher as python3.exe beside it, before publish so the tree
digest covers it. verify() requires the copy to match python.exe, so an
entry staged earlier restages once on the next explicit install (activation's
setup); startup's facts check never calls verify.
A FileNotFoundError on the lock file was retried whenever the caller asked for its parent
directory to be re-created, so a dangling symlink at .install.lock spun one CPU forever and
ignored the timeout (main raised at once). Retry only when the parent really vanished, and
never past the deadline, on either retry path.
Tests: pin the collector's unlink-while-held order (worst interleaving: removal after
release lands once a waiting launcher holds the lock) and the dangling-symlink failure.
collect_orphan_install_states released a state's .install.lock and only then unlinked it.
A launcher from a checkout re-created at the recorded path that had already opened the
lock (waiting on the collector) got it on release, the collector then unlinked the file it
held, and the next launcher created a fresh lock file at the same path and took it too:
two installers in one state. Predates #145527; that PR narrowed the window.
- pm.filesystem.lock_path: open + lock, then on POSIX confirm the held descriptor is still
the file at the path (samestat; missing = stale) and otherwise retry on the current one,
inside the caller's timeout. Optionally re-creates the parent the remover took.
- runtime_lock and install_states._install_lock (the only .install.lock acquirers of an
install state) take the lock through it.
- The collector unlinks the lock file while still holding it on POSIX, so a waiter always
sees it gone; on Windows an open file cannot be unlinked, so the unlink stays after
release and a waiting launcher's open handle makes it fail.
puts back what that build deliberately left for the remote backend, on
main's seam shape:
- RemoteBackend implements main's protocol (read_user_doc, probe_readable)
and is not a FileBackend; _route returns (backend, home) and explicit
files go through _ExplicitFile, so the is_layer branches are gone.
- One bootstrap: _ensure_bootstrap_env / bootstrap_deployment select the
backend from the process env, the launch home's .env and the managed .env.
#134362's _dotenv_backend_override did not survive its file-only refactor,
so nothing stacks; its rules are now tests (stale shell remote + .env file
boots file; empty .env value resets to file; .env-only remote selects
remote; an absent key keeps the shell value).
- The file-tooling gates main removed (backup/import/snapshot restore,
config edit, migration write-back, config backups, profile clone and
distribution install, raw config editor, xAI migration, gateway --config).
- profile_serve_signature uses the backend version for config.yaml.
- restore_config_model_settings_if_rewritten is a no-op without file tooling.
- PM's dependency runtime reads a home's selection from the local file it
publishes to (config_backend.local_file_layer), so a remote deployment
never needs the plane there or fails PM closed.
- Ratchet: _container_slots/_validate_quoted_containers move to
config_value_checks, _count_cron_jobs to backup_restore, the gateway
--config load to gateway/config_loader.
installs/ is shared by every profile of a data root, but retention was read from the active
profile: a named profile without the key applied the 14-day default to state the root kept
forever (0). Read worktrees.install_state_retention_days from the config of the root that
owns installs/ (scoped via the home override, through load_config_readonly).
Candidates were all decided before any removal; a state launched (lease taken and released)
while an earlier large orphan was being removed was then deleted. Each candidate is now
re-validated (checkout still missing, provably deleted or idle past retention by a fresh
_last_used, no live lease) while holding its install lock, which stays held through removal.
orphan_install_states only reclaimed installs/<key> when the recorded checkout
was provably deleted (under the data root, or directly in an existing
.worktrees/ dir). A checkout anywhere else (~/.cache/review-*/head, a scratch
clone outside the data root) kept its ~0.5 GB / ~27k-file state forever once
deleted: ~235 of ~300 states on one developer host.
The proof rule stays: a provably deleted checkout is reclaimed at once. A
missing checkout that cannot be proved deleted (it may sit behind a mount
boundary: a container sharing the data root, an unmounted volume) is now
reclaimed once its state has also gone unused for
worktrees.install_state_retention_days (default 14, 0 = keep forever).
"Used" is what the runtime moves, measured on a live install: every sync
recreates inputs/ (and rewrites facts.json on a change), every launch takes a
generation lease (moving its .leases dir). Present checkouts, record-less
states and held states (install lock, generation lease) are never reclaimed;
removal keeps the record-last order, and a part-way removal does not restart
the clock.
Follow-up to the two salvaged commits:
- gateway: the stale-PID-file drop moves into gateway/status_pid_records.py
(gateway/status.py is over the 2,000-line ratchet and must not grow) and
keys on the record's own start time. A PID file is dropped only when it
names a DIFFERENT process instance than the lock holder (another start
time) and that instance is gone or its PID was recycled. A PID file that
claims the holder's own start time under another PID is garbled, not
left over, so main's `test_pid_file_that_disagrees_with_the_lock_still_aborts`
keeps its original fixture and still raises. Adds the recycled-PID case.
- pm: a Windows live test where the OS holds a file inside the tools entry
while an explicit install re-realizes the same version (#139088), plus the
different-bytes control that must still fail.
Creating a symlink on Windows needs admin or developer mode; the scenario (a self-referencing config.yaml link) is POSIX behaviour, so the test runs on the Linux and macOS lanes per tests/AGENTS.md.
- pm read_home_selection: only a missing config.yaml means "no config". A symlink loop or
permission error used to look like "no file" (config_exists is Path.exists), so PM published a
dependency generation without that home's plugins; it now refuses like any unreadable config.
The stat runs before the YAML stack (FileBackend.version_path stats before importing utils),
so PM's bare runtime tree still needs no YAML for a home without config.
- check_config_yaml_readers: alias bindings iterate to a fixed point instead of two passes, so
`first = home / "config.yaml"; second = first; third = second` binds `third` too.
- ConfigIssue/_issue move to hermes_cli/config_issues.py, imported by the facade and its check
siblings, so config_value_checks.py / config_home.py no longer import the facade at all.
A plugin disabled for conflicting with an enabled one now comes back once
that plugin changes or leaves: the fingerprint is taken against the members
the update leaves enabled, and compared against the enabled members of the
next update.
Independent review findings on update-disabled plugins:
- Recorded plugins are tried only after the enabled plugins have built, one
at a time on top of them; an update that has to disable an enabled plugin
re-enables nothing, so a download failure can never swap two plugins.
- A resolver or build verdict records a fingerprint of what was tried (core's
dependency inputs plus the plugin's) and is not built again until one side
changes; a download failure is retried by the next update, and those go
first because they fitted beside the rest before.
- The update publishes against the config snapshot it decided from, and a
rejoin needs the record to still be there, so a user's mid-update choice
stands.
- Recorded reasons keep their readable start, not the tail of a uv error.
- An installed provider that fails to import is reported as such instead of
running recovery, and the startup notices dedupe per kind.
- A provider-only record is retried only while memory.provider still names
it, so a rejoin never installs a provider the user switched away from.
- An installed provider that still fails to load after startup recovery is
reported even when recovery printed an install notice.
- One spelling reader: plugin_spellings uses the shared native manifest
reader (plugin.yaml or plugin.yml), and the memory loader uses it too.
When an update had to disable a plugin it also cleared memory.provider, so
the memory provider stayed lost even after the plugin was re-enabled, and
nothing ever retried the plugin: one transient failure (a TLS proxy, a mirror
outage, a since-fixed resolver bug) left it off for good.
- The dependency union now honours plugins.disabled for memory.provider the
same way the provider loader already does, so eviction no longer has to
blank the selection. Re-enabling the plugin brings the provider back.
- The eviction is recorded in the home's config under
plugins.disabled_by_update (was it enabled, and why). Every later update
retries recorded plugins after the enabled ones and undoes exactly the
edit once a plugin fits again.
- A user's own enable/disable/remove takes the decision back: PM's selection
publication forgets the record for the plugin the user settled, and
`hermes plugins disable` on an update-disabled plugin now writes that.
- Spellings come from the plugin's own manifest instead of a plugin scan of
the PM process's home, so a profile's plugins are matched in that profile.
- A parked provider is reported, not re-installed: agent init tells the
user once why external memory is off (naming the update's reason), and
`hermes memory status` and `hermes doctor` show it instead of "plugin not
found" or "All checks passed". Doctor lists every update-disabled plugin.
Review follow-up on #131220: _spellings re-ran _discover_all_plugins for every evicted name. Scan once, lazily, and pass the entries to _plugin_aliases.
uv fails the whole workspace lock when any platform fork lacks wheels for a
dependency (uv >= 0.12.14). The generated plugin workspace inherited core's
environments, which admit every platform, so a Linux or macOS update evicted
mnemosyne (onnxruntime) and any torch-backed plugin over Android, a platform
the install never runs on, and cleared memory.provider with it.
Generalize the Android exclusion to the whole class: the generated workspace's
environments are narrowed to the sys_platform and platform_machine of the
interpreter uv installs into (emscripten, other OSes and other arches drop out
too). The interpreter is probed rather than this process, because PM can run
under a bootstrap Python whose sys.platform differs (older Termux interpreters
report linux). Core's committed lock keeps full platform coverage; it never
passes through the generator. Admission and update eviction both build through
lock_and_sync, so both are covered.
Replaces the unit tests over the dict rewrite with one invariant test on a real
generated workspace.
uv 0.13.5 (pm/lock pin) solves every platform named by tool.uv.environments,
Android included. A plugin-carried native transitive (torch behind nerve's
optional laya extra) has no Python 3.14 Android wheels, so the whole workspace
lock fails and hermes update evicts the plugin instead of installing it.
Generated workspaces install on one host, so narrow the solve to non-Android
platforms on non-Android hosts (Termux keeps today's behaviour). The core's
own lock is untouched and keeps full platform coverage.
- The stall-after-progress case asserted the private `_durable_done`
counter; the request sequence (four retries after the last saved block)
already proves the budget renews only on saved progress, and is red on
main through that behaviour rather than a missing attribute.
- Drop the Retry-After=120 mirror case (same class as 290) and the
Retry-After=7 unit case (main already honours waits under 30 s).
Every kept case fails on main. Sidecar reads in the test pass an explicit
encoding (windows-footguns).
The container image keeps PM's tool store inside the `tools` Python package
directory (/opt/hermes/tools: interpreter, Chromium, ffmpeg, node, uv). The
build snapshot copies every package root whole, so each generation built on
the data volume (a plugin enable, a lazy extra, the boot-time refresh) carried
~1.5 GB of binaries nothing builds from, and an enable briefly held two such
generations (~3 GB) before the old one was collected.
Skip the entries a store's facts.json records as published (plus hash-keyed
fetch caches) when copying core inputs. A directory with no store facts is
copied as before.
install.sh --skip-browser / --no-playwright and install.ps1 -SkipBrowser
now hand PM `--without agent-browser` again instead of `--without chromium`.
The downloaded installer is the newest script, but by default it installs
the stable tag, whose PM (v0.22.5) rejects `--without chromium` with
"--without accepts only optional default packages (agent-browser,
cua-driver)" and exits 1, failing the whole install. The new PM already
reads `agent-browser` as `chromium` (pm.defaults.RETIRED_DEFAULTS), so the
legacy spelling works against both the stable tag and main. Direct
`hermes pm install --without chromium` stays valid on the new PM.
An entry's env is derived from the package code, not its bytes, but pm
recorded it once at install time and served it from then on. A store built
before Chromium stopped exporting AGENT_BROWSER_EXECUTABLE_PATH kept the old
env, and build admission (verified_tools) compares the recorded env with the
code's, so the Desktop bundle job refused the restored cache: "chromium: tool
source failed verification: binary or environment".
prepare/_install's already-current branch now re-records the env when it
differs. The recorded digest still vouches for the bytes, so nothing is
re-fetched.
- 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.
test_malformed_secondary_cannot_evict_recorded_member failed in CI with
`uv sync` "Hash mismatch for member-dep @ file://.../member_dep-1.0-py3-none-any.whl".
Mechanism: installing_member() rebuilds member_dep-1.0 into the same
wheels/ dir for the second plugin. _wheel used ZipFile.writestr(name, ...),
which stamps the wall clock (2-second zip resolution), so a rebuild that
crosses a tick has different bytes. The final sync seeds from home A's
recorded lock (pm/packages.py: seed = prior resolved_lock), and uv 0.13.5
keeps that lock's sha256 for an unchanged path-wheel version (uv 0.12.13
re-hashed it), so sync then verifies the new file against the old hash.
The test runs in ~2 s alone, so it passed whenever both builds fell in
one tick; CI load pushed it across.
Not caused by 07ee800dc70's relock: 7c0905a008 (rc.1) and 07ee800dc7
fail identically under the injection below.
Repro: a 2.1 s sleep before the second installing_member() call, with
uv 0.13.5 first on PATH, fails base on every run (3/3) and passes with
this fixture (3/3); uv 0.12.13 passes on base too.
Fix: fixed ZipInfo date_time and mode, so a same name/version wheel is
one artifact, as on an index. test_fixture_wheels pins it (clock moved
an hour between builds -> identical bytes; red on base).
uv 0.13 writes no _virtualenv.pth, so the sealed arms passed even if the build
never called prune_site_pth. The fixture wheels now ship an __editable__ pointer
that only the sealed build removes.
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.
Enabling or updating a plugin whose pyproject.toml declares `dependencies = []` (the official
agent-importers plugin) ran "Resolving / Installing Python dependencies" and built a new
environment generation although nothing gets installed, and every update of the plugin did it
again.
Workspace membership keyed on "has a pyproject", so such a plugin became a uv workspace member,
and members_stamp hashes a member's whole tree into the venv stamp: enabling it, or any change to
its files, made the recorded environment stale. A plugin is now a member only when it installs
packages (`PythonDeclaration.installs_packages`, the predicate dependency consent already uses
since the sibling fix for the empty consent step), so membership, requires-python checks and the
stamp all follow what the plugin actually puts in the environment.
Test fixtures that used a dep-less pyproject as a cheap stand-in for a member now declare a real
dependency (a local wheel through tool.uv.sources, resolvable offline, or a requirement where no
resolution runs); their assertions are unchanged. New: enabling a `dependencies = []` plugin
through the real admission path keeps the selected generation and recorded stamp, a later change
to its files keeps the venv current, and a plugin with a real dependency still joins.
test_fragmented_resume_obeys_connection_limit read `maximum == 2` with
connections=1 (main run 37594754436). The fake server decremented `active` in a
`finally` AFTER wfile.write: once the client has the bytes it opens its next
sequential gap, so a handler thread descheduled between the write and the
decrement overlapped the next request on the counter alone. Decrement right after
the release wait, before the body; a genuinely concurrent request has already
entered while the first sat on the release, so overlap is still caught.
The two-process sibling (test_processes_share_partial_ownership_...) had the same
write-then-decrement shape; fixed the same way.
Requirements builds (Termux deb assembly and wheelhouse gate, PM runtime
wheelhouse install) install the lock's export with uv pip install, which
re-resolves and rejects the overridden graph. Pass the lock: its manifest
overrides become --overrides and the closing check accepts them.
FORCE_COLOR/CLICOLOR_FORCE made uv pip check emit ANSI the report parser
cannot read, failing every install with an expected override mismatch.
An environment created with an output sink streams uv and keeps only
the last 2,000 characters, so a long `uv pip check` report could lose
its head: the "Found N" total and any unrelated failure printed before
2,000+ characters of override-covered lines. unexpected_incompatibilities
skipped the count check when the total was missing, so the surviving
lines read as fully explained and check() accepted a broken environment.
check() now runs pip check captured (it is a quiet step, so streaming
showed nothing anyway), and override exceptions are accepted only when
uv's "Found N" total is present and matches the lines parsed.
Pillow 13.0.0 fixes 28 advisories open against 12.3.0, three critical:
GHSA-8g5g-8vmr-9782 (heap overflow in ImagingJpegDecode),
GHSA-332p-7hrc-92wf (heap overflow saving TIFF to a buffer) and
GHSA-w889-685w-c8fh (Ghostscript argument injection), plus 16 high and
9 medium decoder/encoder memory-safety and DoS fixes. None has a 12.x
backport.
browser-harness 0.1.13, a core dependency and its latest release, pins
pillow==12.3.0 exactly, so the bump needs a uv override. The override
equals the direct pin (the existing contract for direct overrides).
browser-harness only opens, converts, composes, thumbnails and draws
images; its contact-sheet, masked-frame, thumbnail and click-overlay
output is pixel-identical under 12.3.0 and 13.0.0. pillow-heif stays
at 1.6.0 (requires pillow>=11.1.0); its HEIC round trip is identical
too. uv.lock changes only pillow.
An override installs a version the dependent's own metadata rejects, so
PM's install-time `uv pip check` failed every install (activate, pm
install/repair, fresh and bundle builds) with "browser-harness requires
pillow==12.3.0, but 13.0.0 is installed". check() now takes the uv.lock
the environment was installed from. pm/pip_check.py accepts a report
line only when that lock's [manifest] overrides name the dependency and
it is installed at the version the lock resolved. Missing packages,
other mismatches and any report it cannot fully parse still fail.
pm/pip_check.py is stdlib-only (with a tomllib-less fallback) because
the bootstrap runner loads pm.environment on older system pythons.
test_direct_overrides_preserve_the_declared_exact_version compared the
declared spelling (Pillow) with uv.lock's normalized names, so it found
no locked rows for the first capitalised override; it now compares
canonical names.
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.
A plugin whose pyproject.toml declares `dependencies = []` reached the
Python-dependency consent question with nothing to list. Non-interactive
`hermes plugins install --enable` refused it ("dependency install skipped
(non-interactive)"), and in a terminal a default answer left it installed
but disabled, so official plugins had to drop their pyproject.toml.
The gate keyed on workspace membership, which every pyproject has. Ask
only when admission would put packages in the shared environment
(`PythonDeclaration.installs_packages`): applicable dependencies, a
buildable plugin package, extras, or dependency groups (uv sync
--all-packages installs a member's default groups). The install gate,
the active-replacement veto at publication and the update re-consent
all read it. PM membership and requires-python handling are unchanged.
Consent-test fixtures that used an empty pyproject to stand for "declares
Python dependencies" now declare one; their assertions are unchanged.
Every pinned tool artifact already has a content-addressed copy on
hermes-assets.nousresearch.com, and the downloader falls back to it when the
upstream is unavailable. That fallback was gated on the retry set
{408, 429, 500, 502, 503, 504} plus 401/403/404/410 and DNS failures, so a
CDN's origin-down codes (520-527) failed the install outright. On 2026-10-21
macOS ffmpeg's only upstream (ffmpeg.martin-riedl.de) returned 521 for an hour:
every macOS install/update leg died in setup, and so would every Apple Silicon
user's install, while the mirror held the identical bytes.
Any 5xx is the host failing, not its bytes changing, and the sha256 still
guards whatever the mirror serves. Retries against the same host are unchanged.
Every checkpoint git child runs selected_git_env() -> pm.ensure("git"). On
POSIX git is a declared registry gap ("uses system git by choice"), but the
client only learned that by spawning a PM worker, which raised
InstallError(..., "none") so the caller fell back to system git: ~1.1 s per
git call (plus ~8 s preparing PM's runtime in a fresh home). One
ensure_checkpoint made 15 such calls, one rollback.diff made 5. On a loaded CI
runner that pushed the gateway's /diff, /rollback and checkpoint-limit tests
past their RPC bounds. Main went red at cc6b1f299b, and the same sha is
green on a dispatched rerun.
_missing_or_refuse now answers a missing package's registry gap with the
worker's own refusal, without spawning one. Gaps are static registry data;
installed, non-gap, explicit and in-runtime paths are unchanged, and nothing
is cached (a selected managed git still applies per call).
Also pin the clock in test_room_log_pages_are_bounded_by_serialized_event_bytes:
it sizes the page budget from one event's JSON, and a wall-clock created_at's
float repr varies by a few bytes between events.
mkdir_under_hermes_home fell back to plain mkdir when hermes_dir_acl
could not be imported, so whether an elevated run left the dir usable
by the same user depended on which files happened to be present (the
same fact that broke the two minimal-snapshot tests). hermes_dir_acl is
stdlib-only; no launcher/recovery closure module calls this function
(only hermes_logging, plugins and tools do), so it now imports it
unconditionally (still lazily, so hermes_constants imports alone).
tests/pm/test_bootstrap_import_closure.py pins both halves in a -S
staged closure: hermes_constants + hermes_dir_acl create a home dir,
hermes_constants alone still imports, and a missing hermes_dir_acl is a
loud ImportError rather than a silent plain mkdir (red before).
Review finding by @alt-glitch on #140490 (suggestion 3)
Refs #134889 (W8)
Refs #140337
hermes_constants.mkdir_under_hermes_home and update_host_obligation import
hermes_dir_acl, so the takeover preparation and the fresh-install acceptance
snapshots (hand-picked root modules, not the whole tree) died with
"No module named 'hermes_dir_acl'". The product ships every root *.py
(setup.py _root_py_modules), so only these fixtures needed the file.
Refs #134889 (W8)
Refs #140337