Previously `scripts/bundles/linux_appimage_acceptance.py` held the x86-64
type 2 AppImage header + SHA-256 check (`check_image`), but CI ran
`scripts/bundles/appimage_checks.py` directly via
`scripts/ci/linux_x64_userland.sh accept` without the header check, leaving
`linux_appimage_acceptance.py` unused outside its own test import.
Move `check_image` into `scripts/bundles/appimage_checks.py`, invoke it in
`main()` before `--appimage-extract`, forward the producer digest from
`scripts/ci/linux_x64_userland.sh accept`, update `appimage_checks.py`'s
docstring, and drop the duplicate bubblewrap launcher.
The Ubuntu 22.04 acceptance container drops every capability and keeps
Docker's default seccomp profile. That profile refuses clone and unshare
with namespace flags without CAP_SYS_ADMIN, and chroot without
CAP_SYS_CHROOT. AppRun's `unshare -Ur true` probe therefore failed and it
launched Electron with --no-sandbox. The window and gateway checks still
passed, so the floor check accepted a desktop running without the
Chromium sandbox, which a 22.04 desktop with user namespaces never does.
The 22.04 run now uses moby/profiles seccomp v0.1.0's default.json
(Docker 29's builtin profile), unchanged, plus two rules appended. Its
upstream sha256 is
01536f1d1df938ae611eba20d6349e0de7a99b6ecdee1549427a0b01b8301e28.
clone and unshare may
create user, PID and network namespaces; mount, UTS, IPC and cgroup
namespaces stay refused. chroot is allowed, which needs a capability
only Chromium's own user namespace grants. --cap-drop ALL, --network
none and the non-root user are unchanged. The 24.04 run, which doesn't
start the desktop, keeps Docker's default.
check_execs now refuses any successful exec that carries --no-sandbox.
That covers AppRun's fallback and the app's own sandbox relaunch.
check_desktop fails first, naming the cause, when the container can't
create a user namespace.
On spark-0 (Ubuntu 24.04 arm64 host, apparmor_restrict_unprivileged_userns=1,
Docker 29.2.1), an Electron 44.9.3 arm64 AppImage was launched under the
leg's container flags in ubuntu:24.04:
- Docker's default profile: AppRun added --no-sandbox, and the window
and gateway still came up.
- This profile: no exec carried --no-sandbox. The sandboxed zygote and
the renderer ran in their own user namespace (uid_map 1000 1000 1)
and nested PID namespaces. The real check_desktop accepted the run.
- Without the chroot rule: no window within 380 s.
- check_desktop under Docker's default profile: refused with the
user-namespace cause. With that precondition bypassed, it refused
the trace instead: "Chromium ran without its sandbox".
Not run: the x64 AppImage and the Blacksmith runner.
Review: https://github.com/NousResearch/hermes-agent/pull/154545#discussion_r4623972093
Actions rejects matrix expressions in step.shell before any job starts. Give the four shared steps a literal shell and select their existing x64 container or native arm64 Bash via the matrix label in job env.
Verify locked CUDA and ROCm payloads on Ubuntu 24.04; refuse to select or execute them below their ABI floor. Build the desktop on Ubuntu 22.04 with a pinned bootstrap interpreter and check desktop startup, offline CPU inference and both packaged GPU probes against one producer digest.
A store opens under its own profile folder as the Hermes home, so the connection settings it reads at open are that profile's. The binding compares the store's folder with the current home first, a home read the guard refuses unless it is listed with its reason; it is listed now.
hermes_state.py becomes the stand-in plugins import, the rest of the legacy store and its test folder go, and the per-process modules the backend imported from main move under persistence/sqlite/_state/. The backend checks PID namespaces and lease holders through process_identity and its WAL setup through sqlite_support, and its error module takes the shared predicates and classification from storage_errors, so neither helper set has a second copy. The backend, sqlite_support.py and the tests that pin those modules reach their final imports, and the backend-import guard allows no file outside persistence/. The modules no caller imports any more go with it: the agent's onboarding rules (now in session_rules) and gateway/session_admission.py.
The stand-in's SessionDB releases its store on close() and, used again afterwards, opens it again with a warning, as the old class reopened its connection, unless the file at its path was replaced or the store is latched corrupt; a read-only one raises. A close during a call releases the store when the call returns. A named source wins over a source list in its session listing and count.
An agent given a writable stand-in SessionDB as session_db= and no persistence= takes the store handle that SessionDB forwards to as its persistence, so its turn flush, token counts, compression and session row writes go through the storage interface, as an agent given the old SessionDB wrote through it.
The backend-import guard also holds the backend's remaining reads of the process or task home, each with its reason, and refuses any other and any import of the stand-in inside persistence/sqlite/.
Plugin context engines get the agent's store as persistence= beside the deprecated session_db=, in each hook whose signature accepts that keyword, including the rebind after /new, /resume and /branch, and the context engine guide and the plugin guide's replacement table name it. A test fails once the running release reaches the stand-in's removal release, listing what goes with the stand-in.
release_unheld_media and collect_unheld_api_images take a store only: their SessionDB branches, which no caller reaches, go with the gateway's own copies of the admission and transcript queries.
hermes_state_loop_guard.py wraps the backend holder's _read_ctx and _execute_write (StoreHolder is the store's choke point once SessionDB forwards to it), so it imports persistence.sqlite._holder like the other legacy modules the guard already allows until the removal.
The text prefilter skipped any file without "persistence.sqlite" or "import sqlite" before the AST check, so `from persistence import core, sqlite`, the two-space form and the parenthesised multi-line form a formatter writes passed the guard.
The prefilter now only skips files that never mention "sqlite"; the AST check decides the rest, and the tree stays clean under it.
New guard cases pin the three forms.
Evals, the end-to-end and conformance suites, scripts and CI reach the store through the interface.
scripts/ci/check_backend_imports.py, run by scripts/check, refuses an import of persistence.sqlite outside persistence/ and persistence_assembly.py (tests excepted). The two evals that instrumented the backend now reach it through the interface: the failure-ownership probe patches the message repository class of the store it opens, and the attachment bench meters whole-blob reads at the gateway attachment store.
The Hermes Marketplace replaces them and the portal already redirects both
routes there. The published feeds (plugins.json, skills.json, skills-index.json)
and their generators stay.
tools/ holds model tools. These six files register none: they snapshot and
restore a working directory for the agent loop, /rollback, /undo's
changed-files line and `hermes checkpoints`. They move next to the agent
loop that takes the checkpoints:
tools/checkpoint_manager.py -> agent/checkpoints/manager.py
tools/checkpoint_maintenance.py -> agent/checkpoints/maintenance.py
tools/checkpoint_pruning.py -> agent/checkpoints/pruning.py
tools/checkpoint_refs.py -> agent/checkpoints/refs.py
tools/checkpoint_undo_hint.py -> agent/checkpoints/undo_hint.py
tools/checkpoint_manager_profile_rename.py -> agent/checkpoints/manager_profile_rename.py
agent/checkpoints/__init__.py is a docstring only. Nine test files move to
tests/agent/checkpoints/. Every importer changes its import line in place,
inside the same function. Nothing stays at the old paths: none of the six
names is on the plugin API list, the shipped-release list or the
old-updater list.
Behaviour is unchanged. The four loggers keep their tools.checkpoint_*
names, so the lines stay under `hermes logs --component tools`. The folder
is not a root checkpoints/ package because the checkpoint store is
HERMES_HOME/checkpoints, which is the same directory as such a package on an
install whose checkout root is HERMES_HOME. agent.* is already packaged, so
pyproject.toml and the lists of root packages do not change.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py.
utils.py held three subjects in one 871-line file. It is now a package with
one module per subject: utils/files.py (atomic writes, temp files, file mode
and owner, signatures and digests, JSON and YAML file helpers), utils/urls.py
(the base_url helpers) and utils/env.py (truthy values, env numbers, proxy
env helpers). utils/__init__.py re-exports every public name, so no importer
changes. Function bodies are unchanged, no function-level import moved, and
the logger keeps the name "utils".
Tests patch a name in the module that now defines it. Patches stay on the
package where production reads the name through a function-level
"from utils import". The tests of utils itself move to tests/utils/.
A root module that becomes a folder drops out of anything that copies root
*.py files plus a fixed list of packages, so the fixtures that build a partial
source tree now list utils, as do pyproject's packages.find, three check
scripts and the CI change classifier.
The _git() helper ran git with text=True but no encoding=, which the
footgun checker rejects (locale codec on Windows); pass encoding='utf-8',
errors='replace', and the same in the test file's git() helper.
pr_head() checked for the commit only before each fetch, so a head that
only the final fetch retrieved still resolved to "" (PR head unavailable).
Resolve it once after the loop instead.
Refs #128930
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
A pull_request checkout is refs/pull/N/merge, whose first parent is main's
tip, so merge-base origin/main HEAD always succeeded and the gate could never
reject. The step now gets github.event.pull_request.head.sha, fails closed
when that commit cannot be resolved, and also rejects a head whose root
commits are not all already in main (a main-descended branch that merged an
unrelated history).
Fixes#128930
Co-authored-by: beardthelion <56458543+beardthelion@users.noreply.github.com>
update_cmd_force_stop now imports tools/process_registry.py (the left-behind
sweep) and gateway/host_topology.py (served homes), so a change to either can
break `hermes update` and must start e2e_upgrade (test_update_ci_routing).
`python -m hermes_cli.main update` from releases before update_cmd.py was split
out runs cmd_update/_cmd_update_impl as `__main__`, so in_historical_update()
did not see them and e.g. bc747001eec5's post-pull update_managed_uv() import
raised instead of handing off, leaving the update half-done. A `__main__` frame
now counts when its code was compiled from this checkout's hermes_cli/main.py;
the current tree's own entry points stay live code via the sentinel local.
The shim runtime tests discovered shims by parsing source (banned in tests).
The shim list is now data (tests/fixtures/retired_updater_shims.json, 63 shims,
generated from the former scan); scripts/ci/check_retired_shims_manifest.py runs
the AST scan as a repo-guards step and fails on drift or an empty scan.
The probe's stdout is appended to $GITHUB_OUTPUT, so a CR/LF in the
fetched generated_at, a skill's source key, or a JSON decode error
would start a new key=value line and could forge status=ok, silencing
the watchdog. Flatten those remote-derived values before formatting.
Fixes#108382
The self-updater gate rejects any plugin script that both fetches from
GitHub and writes or renames files. rom-studio (#153798) trips it on
kit/kit.ts, which downloads the third-party poryscript 3.6.1 compiler
from its own release, checks a fixed sha256 and unpacks it into
kit/.cache. It never fetches or replaces rom-studio's own files, so the
pin stays the only update path (README rule 3).
Teknium ruled to allow it. A maintainer now lists such a file in
scripts/ci/catalog_self_updater_allowlist.json by repo, pinned sha, path
and the file's sha256: a re-pin, an edit to that file or a second
fetching file is gated again. The list lives under scripts/ci/, which an
entry PR may not touch (catalog_changed_entries.py), so a submitter
cannot add themselves. Rule 3 in both rule blocks names the exception.
The AGENTS.md chain cap is 30,600 so a chain at the cap still loads whole after the loader's per-file headers.
`from hermes_agent import <moved published module>` is no longer reported as a private import.
Code health pairs a module moved a second time with its last path, not the generated file at its first path.
The lint matched only tools.lazy_deps. The move gives the package one new name under hermes_agent,
so the lint drops that prefix before matching; this also holds in a tree whose MOVES does not list
tools/ yet (the commit before the move, a test fixture). The script stays stdlib-only.
boundary_lint, check_agents_md_size and the old-updater audit take a root that can be a fixture or
another checkout; they map paths through that tree's moves.py. resolve_in_tree reads a moved module
where it lives, not the forwarder at its old path (scouts 07, 08 and 12 each carried a copy of this).
boundary-lint reports targets under their original name, as its baseline keys them.
Importing a moved module runs hermes_agent/__init__.py and the inits where it lives now; the
classifier lists them by original path, which is what classify() reads. The lane-table tests map
tracked files back through original_path, find listed files where they live now, and walk the
update entry points' imports by original path, skipping the old-path forwarders.
check_agents_md_size read agent/subdirectory_hints.py by its old path, and the code-health CLI
fixture copied that file from the old path, so both raise once agent/ moves. Both go through
current_path. The fixture keeps an empty MOVES, so its copies stay at their old paths.
A module added directly under hermes_agent/ is not in MOVES, so original_path leaves it there and
its first path part was not a source directory: its dropped public names went unchecked. Add
hermes_agent to SRC_DIRS and drop the src/hermes_agent/ strip, a layout the move does not use.
The exact-input key lists hermes_cli/ and hermes_platform/ modules by old path and hashes a missing
file as <missing>, so after a move an edit to those modules stops changing the key. Each input is
read at current_path(name) and still keyed by its listed name, so a move alone keeps the key. The
compat modules this now imports join the key, as the import-graph test requires.
The classifier kept a package __init__.py in the e2e_upgrade and e2e_desktop_update tables only if
the file existed at that path. The CI detect job runs in a sparse checkout that has no package
inits, and after a move no init exists at its old path, so both lanes stopped firing for nine
inits. A listed path that does not exist never matches a changed file, so the filter is dropped.
Scan roots and lists go through current_path (footguns --all roots, config reader/writer trees,
detached-spawn trees and root files, subprocess-stdin dirs, the gateway parity scan root, the
plugin validator's core-handle source globs). Keys written in old paths (install-root baseline
and its depth test, detached-spawn helper and baseline, stdin KNOWN_SAFE, config-reader foreign
files, boundary-lint baseline, code-health rule globs, CI lane tables, public-surface source
dirs, plugin public-API names) are looked up by original_path/original_module of the file or
import under inspection, so they stay valid and a moved file is not judged new.
Root-name sets gain hermes_agent and the old names in MOVES; the plugin audit's registry-call
table follows MOVES; update_downgrade_guard drops the stale src/ path (its test and the
code-health CLI fixture follow). With MOVES empty every guard is unchanged.
After c2h5oh's explicit-key fold in #155077, section_keys still split
quoted file: keys at the first embedded ': '. This truncates the
package name/version in semantic lockfile reports for a legal POSIX
file path containing ': ' and long enough to trigger js-yaml's pair.
Reuse the quote-aware _ENTRY parser at the keys-only call site and
pin the real 1024-character threshold without changing pnpm defaults.
Follow-up to c2h5oh's #155077 and BearHuddleston's #150296 review.
(cherry picked from commit 0d8141d97fb09e3439b76b89f6da090134e049df)
js-yaml (pnpm's lockfile emitter) writes a mapping key longer than 1024
characters as an explicit pair, which a long peer suffix on a snapshot key
or a long file: path reaches. _section_lines refused the '? ' line, failing
the lockfile-diff step on a lock pnpm wrote itself; fold the pair back
into the usual key: lines.
Follow-up to #150296 (review nits).
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
BuildKit drops comment lines and blank lines inside a RUN continuation, and a
top-level comment ending in a backslash does not continue; the guard joined
lines naively, so 'curl u \\ / # c / | tar' and '# c \\ / RUN curl u | sh' slipped
through. '| /bin/tar' and '| /usr/bin/sh' were missed by the matcher too.
docker/sandbox-desktop.Dockerfile streamed the cua-driver release asset
straight into tar, so whatever the server returned became a root-owned
binary on PATH in the published default terminal sandbox. Fetch to a
file and sha256sum -c it against committed per-arch digests first, the
way the root Dockerfile already handles SQLite and s6-overlay.
Add scripts/ci/check_dockerfile_downloads.py (repo-guards step and
`scripts/check --only dockerfile-downloads`) so no tracked Dockerfile
can pipe a download into an extractor or interpreter again.
Fixes#126942
Co-authored-by: Yuan Li <dskwelmcy@163.com>
A catalog entry whose repository was deleted, or whose pinned commit was
force-pushed away, can't be installed any more: `hermes plugins install` clones
the repo and checks out the pin, and both fail. Nothing noticed until a user
hit it.
scripts/ci/catalog_dead_repos.py looks up every entry (GitHub in GraphQL batches
of 50, with REST confirming each miss so a renamed or transferred repo is never
taken for deleted; other hosts via git ls-remote). Any unclear answer, or more
than 25 dead at once, aborts with nothing delisted, because that shape is an
outage, not a week of deletions. The weekly workflow deletes the dead entry
files on bot/catalog-dead-repos and opens one PR for review; nothing
auto-merges. It delists (deletes the file) and never touches removed.yaml,
which is the security blocklist.
First run, on today's catalog: 8 of 2,087 entries are dead (7 deleted repos,
1 force-pushed pin). Their files are deleted in a separate commit.
tests/ci/test_update_ci_routing.py requires every module an update entry point
imports to start its suite; _relaunch_bare now imports strip_supervisor_markers.
`hermes update` respawns each profile gateway through a detached restart
watcher that hands its own env to the gateway it starts. For a named
profile the watcher inherited the updater's os.environ, which already
holds the updater's profile .env. A profile with no TELEGRAM_BOT_TOKEN of
its own (an API-only profile) then started the root bot and took its
polling lock, and the default gateway's Telegram failed with "token
already in use".
The watcher env now follows the rule update_cmd_posix_pause._replay_env
already uses for the same respawn: the launcher's own named profile keeps
the launcher's env (an exported token may be its only credential); any
other home gets that home's own secrets via served_profile_child_env and
none of the launcher's. The host path is unchanged.
The env choice moves into hermes_cli/gateway_restart_env.py
(hermes_cli/gateway.py is over its line cap).
Fixes#135792.
.gitattributes asks git to store text with LF, but only a client that
honours it does: a GitHub web upload or an API commit lands bytes as sent.
plugin-catalog/board-insights.yaml arrived that way. Every fresh checkout
then showed it as modified, and the icon check (which needs a clean tree)
failed on every catalog PR until #154171 rewrote it.
- scripts/ci/check_line_endings.py reads `git ls-files --eol` and fails on
any index blob that is crlf/mixed, except -text (binary) and eol=crlf
(*.ps1) paths. `--fix` rewrites offenders with LF and stages them.
- Runs as a Repository guards step and as `scripts/check --only
line-endings` (so the pre-push hook catches it locally too).
- `* text=auto` catch-all in .gitattributes, so text files outside the
listed extensions are normalized at check-in too (renormalizing the
whole tree with it changes nothing but the file below).
- Fixes the one remaining offender:
contributors/emails/uperLu@users.noreply.github.com.
Co-authored-by: lancelotsh51sh <283335493+lancelotsh51sh@users.noreply.github.com>
* fix(ci): the supply-chain scan judges a moved file by what changed in it
The supply-chain pattern scan failed on a pull request that moves hermes_cli/_launchers.py to hermes_agent/hermes_cli/_launchers.py and leaves a small forwarding file at the old path. Git showed the old path as modified and the new path as an added file, so all 1,177 unchanged lines counted as added. Line 334, which builds a Windows launcher with exec and base64.b64decode and has been on main for a long time, was then reported as a critical finding.
The scan now runs git diff with --find-copies -l0. Git pairs the new file with its old path and shows only the lines that changed as added. -l0 removes git's file limit: on a diff of about 5,000 files git otherwise skips copy detection and also drops rename detection.
Copy detection alone would also hide a payload-shaped line that a pull request copies into a new file while the original file keeps it. The scan therefore still judges every line of a copied file that its source file still contains after the pull request. A line is treated as moved only when it left its old place.
It still reports a payload line added anywhere: new lines in a moved file, a new file, a copy of an existing file with a line inserted, and a copied line whose source still has it. Renamed files without a forwarding file were already judged by their changed lines and are unchanged. On the 5,230-file move range the scan takes about 8 seconds instead of 1.3.
* fix(ci): the supply-chain scan judges a moved line by whether the diff also removes it
The scan paired a moved file with its old path through git's copy detection and then re-read both files. That missed a payload line when one file was copied to two new paths, and it split lines at characters git does not treat as line ends.
The scan now diffs without rename detection and leaves out an added line only when the same diff removes a line with the same text, once per removed line. A second copy of a moved file and a copy whose source keeps the line are judged.
The copy detection, the name-status parser and the cat-file reader are removed, so the scan no longer needs git 2.38.
* fix(ci): the supply-chain scan treats a line as moved only between files of the same name
An added line was left out whenever the diff removed the same text anywhere, so a payload-shaped line deleted from a test fixture and added to another module produced no finding.
The removed line must now come from a file with the same file name, which is what a move to a new folder keeps. Text taken from a file of another name is judged.
- agent.verbose: the example config seeded it, but verbosity comes from
--verbose / display.tool_progress (de5a88bd97 dropped the read).
- display.copy_shortcut: default added in 645a2f482d with no reader; the
Ctrl+Shift+C binding never consulted it.
- slack.reply_prefix: the Slack docs promised a prefix on every message, but
only the WhatsApp adapters read reply_prefix.
Part of #126448