Commit Graph

810 Commits

Author SHA1 Message Date
Maciej Lisiewski
bdc5ecd808 Merge pull request #157620 from NousResearch/salvage/154883-run-tests-named-account-store
fix(tests): keep faked-HOME test runs off the account's tool store
2026-11-19 14:30:16 +01:00
Maciej Lisiewski
cd60f7f25d fix(tests): refuse, with the right cause, a faked-HOME store path readlink cannot read
A failing readlink already refused the run, but no test pinned it (dropping the '|| return 1' let resolution continue from the link's parent), and the refusal blamed a link loop.
2026-11-19 13:05:24 +01:00
Maciej Lisiewski
5637797202 fix(tests): read link targets and store paths byte-exact on BSD readlink
macOS/FreeBSD readlink (stat.c) only appends its newline when the target
does not already end in one, so stripping one LF after $(...; printf x)
turned a link to 'x<newline>' into 'x' there: the macOS tests job failed
test_link_target_ending_in_a_newline_is_followed_as_named. Read the target
with readlink -n (GNU, BSD and busybox all take it) and strip only the
sentinel. The same $(...) capture dropped a resolved store's own final
newline in _avoid_account_stores; sentinel those too.

setup-hermes.sh stages its bootstrap uv into $HOME/.hermes/tools before pm
runs, so with that path linked to the account's store and HERMES_HOME
selecting another, the staging wrote into the account's store. Point
HERMES_RUNTIME_DIR at the store pm resolves in that case.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-19 13:05:24 +01:00
BearHuddleston
8c9be67bd5 fix(ci): verify x64 AppImage header and digest inside the CI acceptance worker
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.
2026-11-19 02:35:54 -06:00
BearHuddleston
39ddddb932 refactor(bundles): derive x64 pre-staged GPU tools from Package.minimum_glibc
`scripts/bundles/native.py::_tools_for_builder` and
`scripts/bundles/stage_x64_gpu.py` previously repeated the
`("llamacpp-cuda", "llamacpp-hip")` tuple already declared via
`Package.minimum_glibc` on `LlamaCppCuda` and `LlamaCppHip`.

Filter by `get_package(name).minimum_glibc.get(target)` in both places so
`Package.minimum_glibc` is the single declaration, and add a contract test
in `tests/scripts/test_bundle_glibc_floor.py` pinning `glibc_floor.EXCEPTIONS`
to `Package.minimum_glibc` while keeping `glibc_floor.py` stdlib-only.

Review: https://github.com/NousResearch/hermes-agent/pull/154545#discussion_r4625655955
2026-11-19 02:35:54 -06:00
BearHuddleston
9c15b7cf2c fix(ci): run the x64 floor desktop check with Chromium's sandbox
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
2026-11-19 02:35:54 -06:00
BearHuddleston
06c0b83444 fix(desktop): build the x64 AppImage on Jammy and stage its GPU engines on Noble
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.
2026-11-19 02:35:54 -06:00
BearHuddleston
07e99b4a5e test(bundles): use a portable filename for the ELF byte-order fixtures 2026-11-19 02:35:54 -06:00
BearHuddleston
cdca5cca57 fix(bundles): account for packed relative relocations in the glibc floor 2026-11-19 02:35:54 -06:00
BearHuddleston
71cebffa7e fix(bundles): reject short files with a complete ELF signature
A truncated identification header was counted as a non-ELF and let the audit succeed. Keep ignoring non-ELF files, but count and name a short ELF as unreadable.

Co-authored-by: Mark S. <274530371+unsupportedpastels@users.noreply.github.com>
2026-11-19 02:35:54 -06:00
BearHuddleston
f23af6fd92 fix(bundles): fail the glibc audit on an ELF whose needs it can't read
An ELF with no section table returned no requirements, so a dynamically
linked executable stripped of its section headers counted as checked
while the loader still enforced its needs through the dynamic segment.
That case is now a named failure. A truncated or malformed ELF, which
crashed the audit with a traceback naming no file, is reported the same
way and the scan goes on to list every other problem.

Failing closed is enough today: none of the 686 ELF files in the
packaged arm64 app lacks section headers.
2026-11-19 02:35:54 -06:00
BearHuddleston
469d6c1e72 fix(release): keep diagnostic Linux AppImages off the download tables
The builds table lists every table-shaped object under releases/tag/<tag>/,
and it already knew the AppImage name shape, so a staged Linux AppImage
would become a download row in the canary release body and on the canary
downloads page. These builds have no smoke and no update path yet, and the
AppImage's gateway still runs from its per-launch mount, so the table
leaves them out (_UNLISTED_OS) while they stay in the tag archive.

The commit page's Linux rows said "Disabled (release leg disabled)" and
the smoke note said Linux bundles are disabled; both now say what is true:
commit builds skip Linux, and Linux AppImages are not install-smoked.
2026-11-19 02:35:54 -06:00
BearHuddleston
ad485727a6 chore(ci): run the desktop build cache action inside a job container
The describe step located desktop_build_cache.py through
${{ github.action_path }}. In a container job that expression still names
the runner host's path (/home/runner/work/...), which does not exist inside
the container (actions/runner#2185, open), so the step, and the job with
it, would fail before any build. $GITHUB_ACTION_PATH is the same directory
on a plain runner and the translated /__w/... path in a container.

The action resolves its source, cache and work inputs itself, so a container
job can pass workspace-relative inputs (github.workspace and runner.temp
also name host paths there); the test now covers that input shape.
2026-11-19 02:35:54 -06:00
BearHuddleston
1b8bfaa72e fix(release): report the Linux desktop builds without gating releases
publish-canary required build-linux-x64 and build-linux-arm64 to succeed,
the builds table's release gate required every need to succeed, and the
canary controller rechecked both Linux jobs. That was harmless while the
Linux jobs were echo-only dummies, but a real Linux build that fails would
leave every canary release a draft, exactly as a failed Termux .deb does.

Linux builds are diagnostic until they have proven themselves green, so:

- scripts.releases.job_groups.DIAGNOSTIC_JOBS names the two Linux builds and
  gating_jobs() drops them from a needs list.
- The builds table still needs the Linux builds and receives their results,
  but its release gate requires only gating_jobs(needs), and the renderer
  no longer counts a diagnostic job as incomplete, so a failed or skipped
  Linux build neither blocks publish-canary nor holds back the channel's
  downloads page.
- publish-canary no longer needs the Linux builds or requires the
  linux-x64/linux-arm64 groups to be selected; channel_releases.CANARY_NEEDS
  drops them to match.

Making Linux gating later is emptying DIAGNOSTIC_JOBS and restoring the
publish-canary needs and conditions. The darwin/win32 feeds, stable and
channel publication never depended on the Linux jobs.
2026-11-19 02:35:54 -06:00
BearHuddleston
afb03ddd2d feat(bundles): audit a packaged Linux app against its glibc floor
A Linux desktop bundle runs only where the host's glibc and libstdc++
provide every symbol version its ELF files need, so one library built on a
newer distribution silently drops support for every older one.

scripts/bundles/glibc_floor.py reads each ELF file's .gnu.version_r
(no readelf dependency) under electron-builder's unpacked app and fails when
anything needs more than the arch's floor:

- x64: GLIBC_2.35 / GLIBCXX_3.4.30 (Ubuntu 22.04, Debian 12)
- arm64: GLIBC_2.39 / GLIBCXX_3.4.33 (Ubuntu 24.04, Debian 13)

The x64 llama.cpp CUDA and ROCm engines get their own ceiling
(GLIBC_2.38 / GLIBCXX_3.4.32): upstream builds them on Ubuntu 24.04
(b12144 measured at exactly that), so those two engines run only on 24.04
and newer.

Checked against readelf -V on all 686 ELF files of a real arm64 build
(3,325 version names, no differences): it passes the arm64 floor and fails
the x64 floor on the arm64 llama.cpp engines (GLIBC_2.38) and the
sdist-built _libolm (GLIBCXX_3.4.32).
2026-11-19 02:35:54 -06:00
Teknium
27896fd2cd fix(dev): hooks find hoisted lefthook installs and set up the environment only for a matched job
scripts/run-lefthook now searches the hoisted node_modules layouts the generated hook
searches (npm, pnpm --node-linker=hoisted), in this tree and the clone's main checkout,
and only execs lefthook. The jobs call `{just}` (scripts/hook-just), which falls back to
scripts/run-in-hermes-env only once lefthook has matched staged files to the job, so a
commit no job matches never runs, or fails on, environment setup.

Tests: hoisted lookup, main-checkout lookup from a linked worktree, the no-`just` job
path, and a real docs-only commit without `just` that never reaches setup.
2026-11-18 20:35:04 -08:00
Teknium
61f57070a0 fix(dev): git hooks never fall back to uv run, so a commit cannot re-point another checkout's venv 2026-11-18 20:35:04 -08:00
Maciej Lisiewski
c3f28b98b9 fix(tests): keep a link target's own trailing newline when following it
$(readlink) drops every trailing newline, so a link to 'x<newline>' was
followed to a sibling 'x' that pm's Path.resolve() never visits.
2026-11-19 00:57:30 +01:00
Maciej Lisiewski
d8841d7f5c fix(tests): follow every symlink and read relative stores from the checkout
pm reads HERMES_RUNTIME_DIR with Path.resolve(), which follows dangling links
too, and setup-hermes.sh reads it (and HERMES_HOME) after cd'ing to the
checkout. The runner kept dangling links literal and read relative values from
the caller's directory, so both could still name the account's store unseen.
2026-11-19 00:57:30 +01:00
Maciej Lisiewski
a21108f3b7 fix(tests): read store paths as pm does and only guard runs that reach setup
pm takes HERMES_RUNTIME_DIR through Path.resolve(), which collapses a `..`
after a missing component lexically; `-ef` stats the literal path, so
`<account store>/missing/..` was not recognised and setup provisioned the
account's store. HERMES_DATA_DIR_SUFFIX is appended literally (hermes_constants)
so a `/../..` suffix walked the faked home's fallback back into it the same way.
Every compared path is now resolved like Path.resolve() first.

The store check ran before the HERMES_PYTHON / current-activation branch, so a
run that never provisions anything was refused when no bootstrap Python could
answer. It now runs only on the path that re-executes into setup.

The refusal also said "no bootstrap Python" when pm itself failed to resolve
the store; it now names the actual reason.
2026-11-19 00:57:30 +01:00
Maciej Lisiewski
38d45192a1 fix(tests): refuse a faked-HOME run that cannot keep off the account's tool store
The redirect to the faked home's own store trusted three things it never
checked: that $HOME/.hermes/tools is not itself a link into the account's
store, that the account's store is only ~/.hermes/tools (HERMES_DATA_DIR_SUFFIX
selects ~/.hermes<suffix>), and that a bootstrap Python exists to ask pm. Each
let setup provision the account's store anyway.

Compare the fallback by identity and refuse when it is the account's store,
protect the suffixed store too, recognise an explicit HERMES_RUNTIME_DIR
without Python (pm takes it verbatim), and refuse when no interpreter can
tell which store pm would pick: setup would fetch its own and provision it.
2026-11-19 00:57:30 +01:00
Teknium
c3edbe7c33 fix(tests): a faked-HOME run that names the account's tool store no longer re-stages it
run_tests.sh already refuses to share the OS account's tool store with a
faked-HOME run unless that store records the checkout's pins, because
facts.json selects one entry per package and provisioning other pins
re-points the account's own runtime. The check only ran when the runner
picked the store itself. A run that named the store reached pm with no
check at all:

- HERMES_RUNTIME_DIR=<account>/.hermes/tools, the recipe lanes used before
  the runner shared by itself, and
- an inherited HERMES_HOME=<account>/.hermes, which an agent's shell
  exports, so pm resolves <account>/.hermes/tools under the faked HOME.

Either way `pm install --test-environment` re-downloaded and re-staged the
checkout's pins (Chromium included) over the ones the account's Hermes
runs on. On a dev host whose gateway checkout pins chromium 1208 while
origin/main pins 1248, every worktree test run flipped facts.json, and
browser_exec in the gateway failed with "Chromium is not installed: run
`hermes pm install chromium`" while both builds sat in the store.

The runner now asks pm's own resolver which store this run would
provision. When that is the account's store and it records other pins,
the run provisions the faked home's own store instead and says so. A
named store at the checkout's pins is used as before, and so is any other
explicit store.
2026-11-19 00:57:30 +01:00
yoniebans
be3d6affc8 refactor(state)!: remove the old session store
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.
2026-11-17 19:10:57 +01:00
yoniebans
0c4023c030 fix(ci): the backend import guard reads every file that names sqlite
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.
2026-11-17 17:51:21 +01:00
yoniebans
2f3405ba9c test(evals): evals, end-to-end suites, scripts and CI on the persistence interface
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.
2026-11-17 17:51:21 +01:00
teknium1
c3b90ccc70 fix(install-e2e): keep a profile cache's durable subdirs judged; cover --profiles-dir
Greptile on #156531: making all of profiles/<name>/cache/** advisory also
stopped judging the subdirs hermes_cli/backup.py keeps because nothing can
rebuild them (delivered media, the citations ledger). Only rebuildable cache
entries are advisory now; those subdirs and cache/ itself stay judged.

The predicate also missed the --profiles-dir walk, which passes <name>/...
paths and prefixes profiles/ afterwards. It accepts both shapes now.

The parametrized test (home profiles and --profiles-dir) rewrites the schema
memo (must pass) and deletes a citations ledger (must fail). It fails on main
and on the previous commit, passes here.
2026-11-16 05:58:52 -08:00
teknium1
634d43c882 fix(install-e2e): a profile's cache/ is advisory, not user state
The rc.9-v0.23.2 attempt's linux and macos "installer-script -> hermes-update
(v0.23.1 -> HEAD)" legs failed USER-STATE PRESERVATION on exactly one entry:

  MODIFIED profiles/e2e-second/cache/schema_columns.json

That file is the session-schema memo hermes_state_schema._parse_schema_columns
writes, keyed by a sha256 of SCHEMA_SQL; any release that changes the session
schema rewrites it. The root home's cache/ is in no judged root, but every
entry under profiles/ is judged, so a profile's cache was. Treat
profiles/<name>/cache/** as advisory (still listed in the report), like the
bundled skills tree.

The new test fails without the change and passes with it.
2026-11-16 05:58:52 -08:00
alt-glitch
5e53407e2c fix(move): a path joined through a folder variable to a moved file is flagged
When a file leaves a folder that stays, the folder's name no longer counts
as moved, so the only trace of the old place in a join is the file's own
name. rewrite_imports.py flagged that name only when the join started at a
repository-root expression: tools_dir = ROOT / "tools" followed by
tools_dir / "blueprints.py" kept its old path with no flag.

A path join that ends in the name of a file that left a folder that stays
is now flagged whatever expression holds the folder. For a whole-package
move that set of files is empty, so its output is unchanged.
2026-11-16 18:09:00 +05:30
alt-glitch
3e931466c0 fix(move): files that leave a folder that stays move alone
rewrite_imports.py and rewrite_docs.py treated every folder above a moved
file as a moved folder. That holds when a whole package moves. When a few
files leave a folder it does not: moving three files from tools/ to cron/
printed 58 flags that named tools/, tests/ and tests/tools/ as moved, and
rewrote every `tools/*.py` glob in the docs to `cron/*.py`.

A folder now counts as moved only when every tracked file under it moved.
renames.py holds that rule once (emptied_folders) together with the path
questions the import and TOML passes ask (MovedPaths); the docs pass reads
the same rule. A path built from pieces is flagged by the name of the
outermost file or folder the move took away, so a file that left a folder
that stays is still found. A docs glob follows a move only when every file
it matches moved together under its own name; otherwise it stays as
written and is counted as partial-glob.

rewrite_imports.py takes --no-compat-table for a move whose old names no
release, updater or plugin imports. The default still writes the table,
so build_chunk.py and migrate_branch.py are unchanged.

Whole-folder moves give the same output as before: on
`git mv acp_adapter hermes_agent/acp_adapter` both scripts print the same
log and write the same diff with and without this change.
2026-11-16 17:23:26 +05:30
alt-glitch
a1bbd329ea refactor: split utils.py into the utils package
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.
2026-11-16 17:16:20 +05:30
alt-glitch
aa6d201dfd fix(code-health): packaged-imports models namespace packages; AGENTS.md names its exceptions
Some checks failed
Live provider canaries / Live provider canaries (push) Has been cancelled
packaged-imports knew 69 packages while setuptools ships 181: pyproject's
packages.find leaves `namespaces` at its default of true, so folders
without __init__.py (most of plugins.*) ship too, and the 92 of them
holding Python were never scanned. The shipped set is now every
directory with tracked Python, plus its parents, filtered by `include`,
as setuptools does. Git paths are read as PurePosixPath, so the dotted
names also match on Windows, where str(Path) uses backslashes and the
guard found nothing. test_files_under_a_namespace_directory_are_scanned
fails on the previous guard.

Root AGENTS.md's package section disagreed with three area rules:
- "add none" now excepts the flat siblings tui_gateway/AGENTS.md (RPC
  methods) and tools/AGENTS.md (backends) still prescribe;
- the tools/environments/ example says its table still sits in
  terminal_tool_backends.py;
- input parsing also allows the area's wire model (Pydantic in
  tui_gateway).
Root is 12,038 of its 12,100 characters.

Both changes are the reviewer's patches as posted.
2026-11-16 11:52:44 +05:30
alt-glitch
ec6827c388 fix(code-health): the packaged-imports scan is a guard, and it sees submodule imports
The scan that flags a package the wheel would drop read production
source from a test, which tests/AGENTS.md bans. It is now
scripts/check_packaged_imports.py, registered as `packaged-imports` in
scripts/check with its own lint.yml step, beside `tool-discovery`; the
hook fixture copies it like every guard. It uses only the standard
library: tomllib for the include patterns, the find_packages walk done
over `git ls-files` (a package is reachable only through parent
packages), and ast for imports.

`from acp_adapter import server` and `from . import server` now count
`acp_adapter.server` as imported, not only `acp_adapter`, so a submodule
turned into a folder is caught whichever form imports it.

tests/scripts/test_check_packaged_imports.py covers a root module turned
into a folder, both from-import forms, and a clean tree, on temporary
repos. On the real tree the guard passes, and fails with `toolsets` or
`acp_adapter.server` when either module becomes a folder.
2026-11-16 11:52:44 +05:30
alt-glitch
e6f7b6732d fix(code-health): a folder made from a root module ships, and the guard needs __init__.py
Two review findings on the folder rule:

- A root module or an acp_adapter/ module turned into a folder drops out
  of setup.py's _root_py_modules and ships only if
  [tool.setuptools.packages.find] include matches it. The FILE_LINES fix
  text now names that step, and
  test_every_package_packaged_code_imports_is_found fails when packaged
  code imports a regular package the wheel would not ship (moving
  toolsets.py to toolsets/__init__.py fails it with ['toolsets']).
- Discovery skips a tool package without __init__.py, so
  check_tool_discovery counts only candidates whose package has one,
  and its message says so. An intent-added tools/newpkg/tool.py with no
  __init__.py now fails the guard.

Both changes are the reviewer's patches as suggested.
2026-11-16 11:52:44 +05:30
alt-glitch
9f67098233 fix(code-health): carry the tool-discovery guard into the checker fixture
tests/scripts/test_code_health_cli.py builds fixture repos with a hand-kept
copy of every guard scripts/check runs; the new guard and what it imports
(tools/registry.py, hermes_constants.py) were missing, so three hook tests
failed on "can't open file". The guard drops its empty-scan branch, which
failed any tree with no tools, and exposes `unreached_registrations` so
tests/scripts/test_check_tool_discovery.py can prove it flags a module
registering outside `<pkg>/tool.py` on a temp repo.
2026-11-16 11:52:44 +05:30
alt-glitch
fd8a6c41ac test(code-health): fixture repos carry ruff.toml
The hook fixtures copied pyproject.toml for the ruff pin but not
ruff.toml, so their ruff check ran under pyproject's [tool.ruff] block,
the config a real checkout ignores. With that block deleted the fixtures
fell back to ruff's default rules and three hook tests failed. The
fixtures now copy and commit ruff.toml, the config a clone runs.
2026-11-15 14:02:40 +05:30
BearHuddleston
968a1bdf7e fix(install-e2e): answer App Installer's metered-connection warning
In rehearsal rc.7-v0.23.2 the Windows x64 upgrade leg found and pressed
App Installer's Update for the first time (#155621), and still failed
with "Native update did not automatically relaunch the new package".
App Installer's log stops at DisplayAppsInfoState: nothing deployed.
The screenshot taken after the press shows why. App Installer 1.26
opened "Warning: Metered Connection. The network you are connected to
is metered. Would you like to proceed? (extra charges may apply)" over
the prompt, with Yes and No. The runner's network is metered, and the
driver never answered.

Confirm-AppInstallerPrompt presses the prompt's Update or Install, then
watches for 20 s (MeteredWarningTimeoutSec) for that warning's Yes, as a
user on a metered network would. Yes counts only after the prompt was
pressed. On an unmetered network the warning never comes, and the
driver goes on after the 20 s. The driver's result JSON lists what it
pressed (appInstallerPressed).

Checked on a Windows 11 x64 VM with App Installer 1.26.510 and its
network set to metered (DusmSvc UserCost 2, cost type Fixed). The same
warning opened over the prompt. The driver's Invoke-Button pressed
Update at 17:56:29 and Yes at 17:56:32, App Installer went to
GoToPreparingDeploymentState at 17:56:32, NEW reported
DeploymentSuccessState at 18:04:39, and App Installer relaunched it
20 s after the package changed.
2026-11-14 12:41:51 -06:00
BearHuddleston
a68ea49d83 fix(install-e2e): find App Installer 1.26's Update prompt inside its UWP frame
In rehearsal rc.6-v0.23.2 the Windows arm64 upgrade leg passed with
the any-window lookup from #155329, and the x64 leg failed as in rc.5:
App Installer showed "Update Hermes Agent?" with its Update button, and
the driver reported no dialog.

The runners have different App Installers. arm64 has 1.29.379, a WinUI
desktop app that owns its top-level windows. x64 has 1.26.510, a UWP
app. A UWP app's window is an ApplicationFrameHost frame (class
ApplicationFrameWindow): the top-level window belongs to
ApplicationFrameHost, and only the frame's CoreWindow child belongs to
App Installer. Find-WindowButton looked only at top-level windows owned
by an App Installer process, so on 1.26 it found none.

Get-ProcessWindows now also returns the CoreWindow children that
App Installer owns inside ApplicationFrameWindow frames. A frame around
another app's CoreWindow is never searched.

Checked on a Windows 11 x64 VM with App Installer downgraded to
1.26.510: launching OLD and opening NEW's descriptor showed the prompt
in an ApplicationFrameHost frame (pid 7580) around App Installer's
CoreWindow (pid 2224). main's lookup found no button; this one found
Update in pid 2224, and invoking it through InvokePattern started the
update.
2026-11-14 09:25:46 -06:00
BearHuddleston
422ad18618 fix(install-e2e): find App Installer's Update prompt in any of its windows
Some checks failed
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Canary Release / Tag, draft, and start the canary build (push) Has been cancelled
Canary Release / Prune canaries older than 14 days (push) Has been cancelled
Live provider canaries / Live provider canaries (push) Has been cancelled
In rehearsal rc.5-v0.23.2 both Windows upgrade legs clicked Update now
and App Installer opened "Update Hermes Agent?" for the NEW version
(its log: update Available, DisplayAppsInfoState). The driver watched
for 120 s, reported "no App Installer dialog appeared", never pressed
Update, and the leg failed 15 min later with "Native update did not
automatically relaunch the new package". The x64 screenshot taken when
the watch ended shows the prompt on screen with its Update button.

The driver looked at the first AppInstaller process and that process's
first top-level window. When OLD launches, Windows runs the package's
update check through App Installer (ms-appinstaller:?checkForUpdates),
and that leaves an App Installer window with no buttons open. The
prompt then opens either in a second process (arm64: two AppInstaller
processes, the dialog in the second) or as a second window of the same
one (x64: one process logged both activations). Reproduced on a
Windows 11 VM with App Installer 1.26.509: after the checkForUpdates
activation, pid 9032 kept a buttonless "App Installer" window and the
prompt opened in pid 6092 with an Install button. Taking the buttonless
process first, the old lookup found nothing.

Find-WindowButton (windows-uia-buttons.ps1) now searches every top-level
window of every AppInstaller process, and the driver uses it. On the
same VM state it found Install in pid 6092.
2026-11-13 21:48:17 -06:00
BearHuddleston
3ce8eb78c3 fix(install-e2e): use the env bash shebang the shebangs lint requires 2026-11-13 21:47:45 -06:00
BearHuddleston
35ba93e2fe fix(install-e2e): wait for the relaunched Mac app's backend wherever it runs
In rehearsal rc.5-v0.23.2 the macOS upgrade arm got further than ever:
Squirrel.Mac installed 0.23.2 (signature and notarization valid) and
relaunched the app on its own. Six seconds later the arm failed with
"could not discover the relaunched backend's listening port".

The probe looked once, and only among the app's direct children for a
process named like `serve` (or a listener whose parent is the app). At
that moment the relaunched app was still starting: its only backend
process was `python3 -m hermes_cli.main gateway run`, which 0.23.2
starts as a launchd job through osascript, so its parent chain is
osascript -> launchd, not the app.

The probe moves to mac-backend-health.sh. Like the Windows arm, it
polls for up to 180 s, finds processes by executable path under the
payload, and asks each one's TCP listeners for /api/health. Only
processes no older than the relaunched app count: an in-place update
keeps the payload path, so an OLD process there must not answer for
NEW. On timeout it lists the payload processes it saw.

Checked on mini (macOS, /bin/bash 3.2) with the real ps, lsof and curl,
using the signed v0.22.0 app's payload Python: an "old" server started
before the reference process was ignored, and a "new" one that bound 6 s
later was found after 9 s. With only the old one running, the helper
timed out and listed it.
2026-11-13 21:47:45 -06:00
Siddharth Balyan
d312b4989e Merge pull request #151880 from NousResearch/sid/migrate-branch-tool
feat(move): just migrate-branch carries a branch across module moves
2026-11-14 05:37:07 +05:30
BearHuddleston
12bf6ef4d4 fix(install-e2e): fail loudly when App Installer's loopback exemption is not removed
The helper's Remove action piped CheckNetIsolation to Out-Null and returned, and Windows
PowerShell 5.1 ignores a native command's exit code, so a refused removal left the exemption in
place with no sign of it. Remove now re-reads the exemption list and throws when the exemption is
still there, as Add already did.

The leg calls Remove from its finally block, so it catches that error and prints it as a GitHub
Actions warning: a throw there would replace a failed leg's own error and skip the package removal
after it, the same reason evidence collection is guarded in that block.

Reported by Greptile on #155191.
2026-11-13 15:37:45 -06:00
BearHuddleston
a1f8549695 fix(install-e2e): let App Installer reach the Windows update leg's loopback feed
The x64 signed-package upgrade leg failed the same way in rehearsals
rc.1, rc.2 and rc.4 of v0.23.2: Update now opened App Installer, which
showed "Cannot open app package. Reason: Error in parsing the app
package." and never requested the NEW bundle. Its own log names the
cause: fetching http://127.0.0.1:<port>/update.appinstaller fails with
0x80072efd (cannot connect). The windows-2025 runner image ships App
Installer 1.26.510 and gets no Store updates; that version fetches the
descriptor from inside its AppContainer, and Windows keeps AppContainers
off loopback unless they are exempted. The arm64 runner (Windows 11, App
Installer 1.29.379) reaches the same feed. Installs from the public feed
never use loopback, so users are unaffected.

Reproduced on a Windows 11 VM with App Installer 1.26.509: the leg's
descriptor gave the same dialog and 0x80072efd, and no request reached
the feed. With App Installer exempted (CheckNetIsolation LoopbackExempt),
the same descriptor opened "Install Hermes Agent? Version
2026.7600.1335.0" and App Installer streamed the bundle from loopback.

The leg now exempts App Installer for its duration and removes the
exemption in its teardown, only when the leg added it. It fails loudly
when the exemption does not take.
2026-11-13 15:37:45 -06:00
alt-glitch
4967d6c0ce chore(move): drop unit tests for the temporary move tools
The move tools are deleted after the move. The end-to-end rehearsal is their proof.
2026-11-13 20:47:06 +00:00
alt-glitch
285cc20598 feat(move): just migrate-branch carries a branch across module moves
scripts/move/migrate_branch.py finds the move chunks a branch is missing by
their Hermes-Move trailer and, for each in landing order, merges the commit
before the rename, merges the rename with directory rename detection, runs
scripts/move/rewrite_imports.py on the Python files the branch changed, and
merges the import rewrite keeping the branch version of those files. It then
merges the target. Any other conflict stops the run; --continue resumes and
--abort restores the branch. Merges only; the remote is touched only with
--push.
2026-11-13 20:47:06 +00:00
alt-glitch
edd4b3ed51 fix(move): docs pass keeps gateway.platforms before a placeholder as written
The config.yaml key gateway.platforms.<name>.enabled was rewritten to
hermes_agent.gateway.platforms.<name>.enabled. The config-path deny list
matches gateway.platforms. only when a real segment follows, and a name
token stops at a placeholder or a wildcard, so the bare gateway.platforms
was read as the package. A config path that is also a package, alone or
before a placeholder or wildcard, now stays as written and is counted as
flagged-config-or-module for a person to check.
2026-11-13 20:47:05 +00:00
alt-glitch
3d7774434f fix(move): count a skipped whole-folder glob only when its folder moves
The docs pass counted a `bare-dir` skip for every `cron/*`, `tools/*` or
`plugins/**` it saw, even in a chunk that does not move that folder, so the
skip counts in the build log were inflated. The check now runs only for a
folder the chunk moves. What the pass writes is unchanged.

Add a test that a whole-folder glob on a moved folder that is not ambiguous
(`tui_gateway/*`) is still rewritten, and that an unmoved `cron/*` counts no
skip.
2026-11-13 20:47:05 +00:00
alt-glitch
1a91ce56b7 fix(move): docs pass keeps whole-folder globs on ambiguous names such as cron/* as written
A glob that takes every file of a folder whose name is also a HERMES_HOME dir or an MCP method family (cron/*, tools/*, plugins/**) is skipped like the bare folder; a file pattern such as cron/*.py still follows the move.
2026-11-13 20:47:05 +00:00
alt-glitch
e12251663a chore(move): drop unit tests for the temporary move tools
The move tools are deleted after the move. The end-to-end rehearsal is their proof.
2026-11-13 20:47:05 +00:00
alt-glitch
82b3de05e7 feat(move): rewrite moved paths and module names in docs and comments 2026-11-13 20:47:05 +00:00