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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Child-process code passed as python -c text or a string template has no compat finder,
so an old name there fails only at run time; the rehearsal on tui_gateway found 13.
scripts/move/renames.py reads old -> new dotted module names from a git mv commit.
scripts/move/rewrite_imports.py rewrites imports and their attribute chains with LibCST, plus
the strings the strict compat finder in tests cannot see: -m module arguments of child
processes, sys.modules keys and logger names. Every other site that names a moved module or
path is printed as a flag with its class, and the run fails until it is resolved.
libcst joins the dev dependency group; just move-rewrite runs it.
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.
A stacked pull request is judged against the previous chunk, whose files already name earlier-moved modules the new way, while the ratchet renamed only the head back to the old names. So an old violation on such a line, in any file the pull request touches, was reported as new: CI failed chunk 11 with 1 blocking finding and chunk 12 with 5. The base now goes through the same renaming (hit texts and the lines matched to place hits); against main nothing changes, because renaming leaves old names as they are.
After a move the old folder holds only generated forwarders (tools/ held 6 files), so these scans
passed on next to nothing. Scan roots go through current_path; allow-lists, exempt trees and the
config-module pattern keep old keys and judge a file by original_path.
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.
P32 and P33 restrict themselves with regexes anchored at old top-level names (gateway/, plugins/,
hermes_cli/, ...), matched against the raw path in the advisory lint and the code-health regex
rules. Once those trees move both patterns stop matching. Both now match original_path(path).
The module and core scans joined old names to the root (root / "plugins", root / top), so once
plugins/ or a core package moves both directions count 0 and the lint exits 0. Scan roots and the
in-module lookup go through current_path (targets through original_module), a missing plugins/
or an empty core scan exits 2, and a file reached under two package names is scanned once.
Judging by the original depth flagged a new file in a moved package that climbs to the package,
and passed a moved file whose old root climb now stops inside hermes_agent/. A climb now reaches
the root by the file's current depth. A moved file that the baseline knew as a root climber and
that still climbs only its old depth fails outright, since a baseline cannot hold it. Reports name
the file by its real path.
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.
Released code takes plugins/platforms/<name>/ for a bundled platform only when the folder holds __init__.py
and plugin.yaml, and loads <name>/gateway_env.py by path only after that. The list kept gateway_env.py for
16 platforms and nothing else, so after plugins moves the scan found no platform and never read those files.
An updater that restarts paused gateways itself after the swap reads that scan to strip platform credentials
from a served profile's environment (by the code: v0.22.7 and v0.23.0, and v0.23.1 on Windows). Measured with
a v0.23.1 process whose checkout was swapped: 24 prefixes with no platform found, 60 with all 26.
Each of the 26 platform folders now keeps a marker __init__.py (kind exists) and a byte copy of plugin.yaml
(kind copy). The gateway_env.py rows become by-path, which is what a release does with them.
An exists file used to be a forwarding shim. It is now a marker that raises ImportError naming the moved
module. A gateway that started before the update and loads a platform late would otherwise get the moved
adapter, which is not an instance of the adapter base class it holds; it now fails with a message that says
to restart.
Two cases the generated old-path files did not handle.
A `python -m <old name>` launch puts the current folder first on sys.path. When that folder holds another
hermes_agent/ package (a developer's checkout opened as a workspace), the old-path package found it and
forwarded into the wrong tree. The generated file now puts its own root first for a `-m` launch, as it
already did when run as a script.
A `copy` row keeps a byte copy of a moved file at its old path. The generator resolved every row to
`<module>.py`, so a row for a data file would have copied the sibling module's source. A row whose name is
not a .py file now copies that file. Released apps fetch such a file from main by URL.
After a failed forward the generated file imported hermes_bootstrap only when Python was locating a module
for `python -m` (sys.argv[:1] == ["-m"]). A file that runs as __main__ (`python cli.py`, a documented
command) is a process entry too: with hermes_agent/compat/__init__.py cut short by a killed update it raised
SyntaxError and the checkout was not restored. Both launches now reach the bootstrap; a plain import still
re-raises without it, and a healthy launch never gets to this branch.
The generated old-path file imported the root hermes_bootstrap on every python -m launch, so light targets that never imported it (an old updater's abort recovery, uninstall) ran launch preparation and dependency activation, and exited 1 when activation failed.
It now forwards first and imports hermes_bootstrap only when forwarding fails during a python -m launch (a torn or moved-aside hermes_agent), then forwards once more. The torn-update test tears the compat package itself, so it fails when the repair comes after the compat import.
Package shims import the root hermes_bootstrap first during a python -m launch, and relaunch_command reads the -m module from sys.orig_argv while Python is still locating it.
Six acp_adapter modules that an editor ACP server imports lazily get old-path files.