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.
Hosted Docker instances could not run the hermes-agent skill's tmux spawning
recipe (no tmux) or create Office/PDF files: the docx/xlsx/powerpoint/pdf
skills said `pip install ...`, but the image's sealed venv has no pip and the
root fs resets on restart.
- Dockerfile: tmux in the runtime apt layer (+3 MB); bake a new [documents]
extra (python-docx, openpyxl, python-pptx, reportlab, pypdf) into the
sealed venv (+14 MB compressed, ~+38 MB on disk).
- pyproject/uv.lock: the [documents] extra, exact pins, outside [all];
pm/extras ANCHORS gets its import anchors.
- docx/xlsx/powerpoint/pdf (+ optional excel-author/pptx-author): use
`python` when it already imports the libs, otherwise a persistent side
venv at $HERMES_HOME/environments/documents (recreated when its Python is
gone); pdf script hints and the OCR reference point there, never at pip
into Hermes's interpreter.
- hermes-agent skill: send text and Enter as separate tmux keystrokes (one
burst lands as a newline, verified live), plus a no-tmux fallback via
terminal(background=true, pty=true) + process_manage write.
Found on Hermes Cloud staging.
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.
CI on 86021e500e: pm.runtime.is_runtime() raises InstallError in an
application process with a packaged-runtime layout, so asking it on every
read_home_selection broke tests/pm/test_environment_build.py and
test_source_update_launch.py. A file deployment now never asks (main's
path, unchanged); a remote one treats InstallError as not-the-runtime.
tui_gateway.server._load_cfg_raw used the module-level config_version /
config_exists names from the rebase's import block, so
test_raw_config_cache_stat_errors could not inject the stat error main's
seam test injects through hermes_cli.config_backend. It now looks them up
on the module, as main does.
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.
Review follow-up on #145364 (kshitijk4poor):
- tool_store_pins.py now asks pm's own rule, _installed_location (new
heal=False keyword keeps it read-only), and also requires each entry's
recorded env to equal what this checkout's package code records. A store
at the right pins but with a stale env made `pm install`'s
_refresh_found_env re-record the shared facts.json.
- run_tests.sh: the concurrency comment now says the unlocked check keeps
runs that START on different pins apart and names the window before
pm install's lock; UV_PYTHON_INSTALL_DIR is reused only when the pinned
minor is already cached; dscl parsed with sed, same-home test with -ef;
PATH caveat and a never-forward note at the env -i allowlist.
- The test separates the checks: setup-hermes' uv copy broken while pm's
uv entry is fine, a non-executable ripgrep, and a stale node env, each
asserting the store is left byte-for-byte and mode-for-mode unchanged.
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.
docker/build_agent.py passes the venv's own python, .venv/bin/python, which
the image links out of the tree (/usr/local/bin/python3) and back to the
bundled interpreter under /opt/hermes/tools. The image's manifest therefore
names storePython ".venv/bin/python", and with the on-tree manifest read,
venv_command enters the venv through that chain (bundled python -S
pm/_venv_entry.py <site-packages>). The salvaged test used the bundled
interpreter directly, so the path the image actually takes was untested.
The test now builds that symlink chain, asserts the manifest's storePython,
and runs the venv_command argv to import a dependency from the venv. The
payload_venv docstring no longer says the venv always ships beside the tree.
The Docker image assembles /opt/hermes in place (repo: "."), so its
manifest.json lands on the tree itself, but _payload_manifest only probed
the tree's parent. committed_venv() therefore found no sealed payload and
every runtime_command child (skill install, MCP install, doctor, backup)
died with "no dependency environment is committed for this install".
Probe both locations and resolve a manifest's entries relative to its own
directory, which is the payload root in both layouts.
- tui_gateway _load_cfg_raw: only FileNotFoundError means "no config".
config_version_or_none folded every stat error into None, so after a
cached absent config a transient EACCES matched the cached {} and the
next config.set could save it over the now-existing file. Any other
stat error is a FailedConfigRead again, which _save_cfg refuses.
- ConfigBackend.read_user_doc replaces read_user_layer/UserLayer: no
caller used the version it stat'ed on every uncached read; cached
loaders already ask config_version first.
- Reader lint scopes follow Python: a self.<attr> bound in one method is
seen by every method of the class, and a comprehension's target no
longer leaks into the enclosing function. The class rule found
pm/publication.py's compare-and-swap re-read of self.path, now marked
like its twin in __init__.
- 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.
CI on the salvage was red on the code-health ratchet (over-cap facades grew; two blind excepts)
and on the pm observer fixture, whose isolated source tree carries pm/ + hermes_cli/ but no utils.
- config_backend imports become module-level in the facades (it imports only stdlib); gateway,
auth and telegram take config_exists through the hermes_cli.config import they already have.
- Pure helpers move to topical siblings, offsetting the growth: _csv_or_list_to_set ->
gateway/run_common.py, the dotted config-path pair -> hermes_cli/backup_restore.py, the
voice/timezone/web-backend checks -> hermes_cli/config_value_checks.py, _load_config_dict ->
hermes_cli/profile_memory_config.py (both callers are memory-provider code).
- _load_config_dict catches YAMLError/OSError/UnicodeError instead of Exception.
- _load_config_cache_hit probes readability with config_backend.probe_config_readable (a 1-byte
read through the backend's open) instead of a full parse plus a blind except.
- pm/plugins_state.read_home_selection checks config_exists before importing the YAML stack, so
a home with no config never needs utils.
- developer-guide/config-backend.md describes this build (file backend only).
Same approach as @benbarclay's 74421be709 in #122509, which does not cherry-pick onto current main.
The reader gate only bound plain `name = <config path>` assignments and never scanned pm/, so
direct local-file reads still passed it: `env_path, config_path = ...` then
`config_path.exists()` in tools/send_message_tool.py, and pm/plugins_state.read_home_selection
reading config.yaml with read_text().
The gate now binds tuple-unpacked elements, `self.<attr>` targets and for-loop targets; flags
unbound `Path.<method>(p)`, shutil copies and pm's byte readers (read_bytes_or_none,
file_digest); and scans pm/.
Routed through the backend: send_message_tool's missing-config check and
read_home_selection (same FileNotFoundError / OSError / YAMLError -> ValueError contract).
Marked as file tooling: pm's byte-level compare-and-swap publication/eviction rewrite and the
LKG backup copy, which operate on the local file itself.
Known limit: bindings flow into nested scopes, not across sibling methods, so a `self.x` bound in
`__init__` is not tracked in another method (pm/publication.PluginSelection.publish).
The local vault key sat in vault.key next to vault.json.enc, so any backup, synced
folder or copied ~/.hermes carried the ciphertext together with its key.
vault.key_storage: keychain (default stays `file`) puts a NEW vault's key in the OS
keychain via keyring (new lazy `keychain` extra, keyring==25.7.0), one entry per
profile, named by a non-secret vault.keyref. No reachable keychain (headless Linux,
extra not installed, plaintext/null keyring backends) falls back to the 0600 file.
`hermes vault key` shows where the key is; `hermes vault key migrate --to keychain|file`
writes the destination, proves it decrypts the vault, and only then removes the
source, so an interrupted move leaves a working vault and a rerun finishes it.
A vault whose key is missing (file or keychain entry) now raises a recovery message
and never mints a new key over existing ciphertext (before, a deleted vault.key was
silently replaced and the vault reported "key mismatch or corruption").
Opt-in rather than default: macOS can prompt for keychain access after Hermes'
Python changes, locked Linux keyrings prompt or are absent over SSH, cron while
logged out cannot read the key, and backups stop being self-contained.
A lazily installed SDK extra (anthropic, bedrock, ...) that the running process cannot adopt
raises "installed; restart Hermes to activate it". In the CLI-spawned `gateway run --idle-exit`
backend nothing ever restarts it: the next `hermes chat` (or the next prompt in the same session)
reattached to the same process and failed the same way until the idle window
(gateway.unmanaged_idle_exit_seconds, default 600 s) ran out.
pm.extras.ensure_import now records that pending restart (pm.environments_adopt.note_restart_pending),
and the unmanaged idle-exit watcher retires the backend within about a second once no agent work,
background work, admission, cron/kanban duty or messaging adapter holds it. Attached clients do not
hold it: they are the ones who need the fresh gateway, and they already wait out the `idle_exit`
drain and start a new owner, which boots into the new dependency generation.
Supervised gateways (systemd/launchd/Desktop's `gateway ensure`) never arm this watcher, so they
are unchanged: no self-restart without a supervisor that restarts them.
Carried from BearHuddleston's #93508 onto main. The Webapp relay and the
profile-incarnation fence stay out: carried code follows main's
named-profile rule and refuses a missing or deleted profile home.
- Webapp routes: one-use launch tickets, window handoff, and gateway
WebSocket tickets minted for the signed-in browser
- Browser surface policy and the SPA document policy
- A host terminal for the browser that survives reconnects
- Staged browser uploads and file tickets; file.attach takes a staged upload
- hermes sessions adopt
- Webapp bundle build helpers and the renderer freshness check
- Regenerated gateway contracts
Co-authored-by: emozilla <emozilla@nousresearch.com>
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 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.
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.
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.