discover_builtin_tools() imports the modules named in
tools.registry._TOOL_MODULES, in that order, each inside the same try as
before: a module that fails to import is logged and skipped, and the rest
still register. The safe worker still loads only its three modules. The list
is today's scan result in today's order, 38 modules.
Gone with the scan: the AST parse of every tools/*.py at startup, its verdict
cache in HERMES_HOME/cache/tool_discovery_cache.json (an existing file is left
alone and no longer read), the skip set NOT_TOOL_MODULES, which no release
shipped, and the tools_dir parameter, which only tests of the scan passed.
scripts/check_tool_discovery.py now compares the list with the tracked files
under tools/ that call registry.register() at their top level, and fails on
either difference. It reads the list from the text of tools/registry.py and
holds the predicate itself, so the guard imports no application code. A listed
module inside a package must be <pkg>/tool.py in a package with an __init__.py.
Adding a built-in tool is now three edits: the tool file, its name in
_TOOL_MODULES, and its toolset. `just check` names a tool file that is missing
from the list.
The ratchet read a move as one old file becoming one new file. When several
modules are folded into one, each with its own MOVES key, two things read as
new code:
- A line that names the new module was spelled back as the first key only, so
an import that had named one of the other old modules no longer matched its
base line. Every old name of the file is now spelled as the first one, on
both sides.
- An old module that leaves a generated file at its path was dropped from the
comparison as generated, so the functions that moved out of it had no base
unit to match. Such a file now reads as deleted.
A fold of tools/ modules otherwise fails PLC0415 once per function-level import
it only renamed.
Run as `python tools/<name>.py`, Python puts tools/ first on sys.path. The
generated file put the checkout root in front and left tools/ behind it,
so the moved module it runs as __main__ imported tools/mcp/ in place of
the installed mcp package. The file now removes its own folder before it
adds the root. An import, a -m run and an isolated (-I) run are unchanged.
The ratchet compares code line by line, so a function-level import that
only names a different module read as a new import. Splitting a file
moves names to a new module, and every caller that imported one of them
inside a function then failed PLC0415 for an import it already had.
Lines are now compared with the module of a `from` import left out: the
same names imported in the same place are the same import. A further
name imported there is still new.
The xai_video_edit and xai_video_extend tools move from tools/xai_video_tools.py into the xAI video
plugin (plugins/video_gen/xai/__init__.py). The x_search tool moves from tools/x_search_tool.py to
plugins/web/xai/x_search.py and is registered by the xAI web plugin. Both plugins register the tools
through ctx.register_tool, with the same names, toolsets, schemas, availability checks, required
environment and emoji. The tool list and every tool schema are unchanged.
A user can notice two differences. A call that leaves out prompt or query now gets the handler's own
error ("query is required for x_search") instead of core's generic missing-argument refusal, which
applies only to tools whose handler lives under tools/. Disabling the video_gen/xai or web/xai plugin
now also removes that plugin's tools.
x_search drops max_result_size_chars=100_000: the result budget is capped at that value already, so
the field changed nothing. The video tools drop self_checked_args, which only affects tools under
tools/. The boundary-lint baseline loses the core-to-plugin import that tools/xai_video_tools.py
made.
tools/xai_http.py held three unrelated things and is gone. The xAI credential
resolver and the cheap credential probe now live in hermes_cli/auth_xai.py beside
the rest of xAI sign-in, and plugins may import both: they join the published
plugin API. Callers that sent the xAI User-Agent use hermes_user_agent("Hermes-Agent"),
which gives the same header. Imagine storage options and the one-time storage
notice live in plugins/image_gen/xai/storage.py, which the video plugin imports.
The video_generate tool no longer names xAI: a video backend may return
description_notes from capabilities(), and the xAI backend supplies its chaining
and storage lines that way, so the description text is unchanged.
Git for Windows builds the x64 PortableGit under ucrt64/ and the arm64
one under clangarm64/ (build-extra make-file-list.sh maps aarch64 to
MSYSTEM_LOWER=clangarm64). The pinned PortableGit-2.56.1-arm64.7z.exe
keeps its 1,162 Git doc files in clangarm64/share/doc/git-doc and has no
ucrt64/ at all, so the allowlist matched only the Vim tree there and the
win32-arm64 MSIX kept every Git doc page.
Allowlist clangarm64/share/doc/git-doc beside the ucrt64 path. The trim
test now runs both layouts; the arm64 case removed 2 of 4 files before.
The Windows staging step refreshed every tool digest in facts.json right
after trimming PortableGit, then record_tools() hashed every selected tool
again a few lines later. Git is in record_tools' selection on win32-x64 and
win32-arm64, it writes the same out/tools/facts.json, and nothing between
the two reads a digest (_arch_guard only probes binaries), so the first pass
hashed every staged tool tree for nothing.
Drop the refresh. The trim test now publishes through record_tools from a
facts.json seeded with the untrimmed digest, so it pins the step the
pipeline relies on: a record_tools that kept the staged digest fails it.
Raised by Greptile on #161818.
Trim audited non-license files under usr/share/vim (2,362 files) and ucrt64/share/doc/git-doc (1,162 files) from staged Windows PortableGit payloads (-3,524 MSIX entries) and refresh tools/facts.json digests afterward.
Preserves cmd/git.exe, usr/bin/bash.exe, sh.exe, ssh.exe, git-core, zoneinfo, all license/COPYING files (including ucrt64/share/doc/xz/COPYING* and usr/share/licenses/**), and existing runtime editor behavior.
Once the appInstallerPath override was gone, xmlAttrEscape ran only on
EMBEDDED_APPINSTALLER_PATH, a constant with no XML metacharacters, so it
could never change anything. The constant is interpolated directly. The
real template's manifest output is byte-identical.
embedAutoUpdateManifest checked for "</Properties>" anywhere but inserted
by replacing " </Properties>" exactly. A template whose closing tag used
any other indentation, or shared a line, got the uap13 namespace and an
Update.appinstaller resource but no AutoUpdate element. The build still
passed, and the package never bound to its feed.
The check and the insertion now use one line-anchored match and keep that
line's indentation. A template with no such line is refused. The real
template's output is byte-identical. The appInstallerPath parameter was
never passed, so it is gone.
A stable sideload MSIX embedded releases/win32/stable/<bundle> as its
MainBundle Uri, an object nothing publishes. Stable promotion points
stable.appinstaller at the receipt-bound archive copy,
releases/tag/<archive>/<bundle>. Canary was right only because
publish_canary_appinstaller keeps its bundle beside the feed.
The JS renderer was a second App Installer writer. The header of
msix-shared.mjs and the stable-releases guide both give that job to
scripts.bundles.release_artifacts. write_embedded_appinstaller now
derives both URLs there and calls write_appinstaller. before-build passes
it the release facts through HERMES_PYTHON, the same way
channelBuildRequest does. The archive is the one the workflow's handoff
stage uses: HERMES_ARCHIVE_TAG, else the payload tag. msixBundleName gives
stage-msixbundle.mjs and the descriptor one bundle filename.
The contract tests check that the embedded bytes match what stable
promotion and canary publication write.
Embed <uap13:AutoUpdate><uap13:AppInstaller File="app\resources\Update.appinstaller" /></uap13:AutoUpdate> and stage Update.appinstaller for official stable and canary sideload MSIX builds so manual local .msixbundle installs automatically bind Windows App Installer auto-update feeds on install.
Strictly excluded from Store manifests (build/store-msix-manifest.xml), commit builds, light builds, dev/local builds without an authoritative HTTPS feed, and unqualified channel requests, with stale build/Update.appinstaller files cleaned on non-eligible builds.
os.walk() skips a directory whose listing fails unless it is given an
onerror handler, so one transient listing error (an antivirus or
indexer holding the directory) left that subtree out of the archive.
The pack then removed the loose package, and the staged probe, which
imports only the top-level package, still passed: the bundle shipped
lark_oapi without the subpackage.
Both member walks now re-raise the listing error, before anything is
written or removed.
stage_native() runs prepare with PYTHONPATH set to the repo root and the
builder's own sys.path, and _verify_staged_import() started the staged
interpreter with -S alone, so that path came first in the probe. A
builder whose path holds a loose lark_oapi (a developer venv with the
feishu extra) failed the pack on a valid archive, and the builder's
packages could stand in for dependencies the staged site lacks.
The probe now runs with -I -S, like the compile and audit steps beside
it: it ignores PYTHON* variables and the user site, and the explicit
site.addsitedir() still processes the staged .pth.
verify_hpkg_archive_bytecode() read only the first 16 bytes of each
archived pyc and no caller set its expected_magic parameter, so a
header-only pyc, one stamped with another interpreter's magic, or one
whose body is not a code object passed both the pack check and
_uncovered(). Only the later staged import probe caught them, after the
loose package and its dist-info were already removed.
The audit now runs under the staged interpreter, the one zipimport loads
the archive with: each pyc must carry its magic number, the
unchecked-hash flag and a code object it can unmarshal, and a .py member
without a pyc is compiled with its grammar. Packing runs it before it
touches the loose tree, and the staged import probe keeps only the
zipimport, metadata and inspect checks, so one function defines a valid
archived pyc. _uncovered() now takes the interpreter to pass it through.
Reported by Greptile on #161819.
Pilot Windows site-package .hpkg zipimport packing on lark_oapi alone (21,463 pure-Python files, ~17.0% of the MSIX entry count, zero data or native files).
Packs validated .py sources, deterministically compiled adjacent legacy unchecked-hash .pyc bytecode (-s stripped build root for cross-runner delta stability), and .dist-info metadata into a ZIP_STORED lark_oapi.hpkg archive (DEFLATE-compressed in 64 KiB blocks by MakeAppx), wired via a build-generated relative plain-path _hermes_hpkg.pth loaded by site.addsitedir(). Coordinates scripts/bundles/bytecode.py::_uncovered() to verify .hpkg bytecode coverage and runs staged-interpreter zipimporter, importlib.metadata, inspect.getsource, and .pyc header/marshal verification at build time.
pack_uv_cache_archive staged the archive under a random mkstemp name in the
payload directory. An exception reaches the finally that removes it, but a
killed pack (closing the console on Windows, an OOM kill) left the partial
archive there, and the next preparation into the same output staged under a
new name. Desktop packaging copies the payload directory whole, so a
rebuild without --clean shipped the partial archive beside the real one.
The staging file is now always .uv-cache.hpkg.tmp beside the archive. The
next pack unlinks whatever is there and creates the file exclusively, so it
replaces a killed pack's leftover and never writes through a link left at
that name (mkstemp's O_EXCL gave the same guarantee for its random name).
Packs into one output are already serialized by preparation_lock.
Two new tests hard-kill a real child mid-pack (os._exit, so no finally
runs) and pack again. One expects only uv-cache.hpkg in the directory; on
the previous commit the killed pack's .uv-cache-<random>.hpkg.tmp is still
there. The other puts a hard link to a file outside the payload at the
staging name and expects that file untouched; opening the fixed name in
write mode instead fills it with the archive.
Raised by the Sol review of #161706 (S2, S7).
os.walk ignores a directory it cannot list unless given onerror, so
pack_uv_cache_archive could write an archive missing that subtree.
_prepare_native then deleted the loose cache it was packed from, and the
digest it records is of the incomplete archive, so nothing downstream would
notice the missing wheels until an offline sync needed them. The walk now
re-raises, and preparation fails before writing the archive.
The new test makes one bucket directory unlistable; on the previous commit
the pack succeeds without it ("DID NOT RAISE").
Raised by the Sol review of #161706 (S3).
pack_uv_cache_archive opened each member with ZipInfo.file_size still 0, and
zipfile chooses a member's ZIP64 header from that size before writing, so
allowZip64=True never applied to it: any single cache file past 2 GiB - 1
stopped the Windows bundle build with "File size too large, try using
force_zip64". The member's size now goes in from the open file first.
Ordinary members come out byte-identical, so archives for today's caches do
not change. The new test lowers zipfile.ZIP64_LIMIT to stand in for 2 GiB and
fails on c83f704484 with that RuntimeError.
Raised by the Sol review of #161706 (S1).
Collapse ~33,191 loose Windows uv-cache files (~26.3% of the MSIX entry count) into a single deterministic ZIP_STORED archive (uv-cache.hpkg) during Windows native payload staging.
Using the non-excluded .hpkg extension lets MakeAppx DEFLATE-compress 64 KiB blocks natively (preserving MSIX size and block-level delta updates) while cutting ~33k HTTP Range requests and Defender file-open scans on remote and local MSIX installs. POSIX payloads keep loose symlinked uv-cache/ directories unchanged.
Update pm/packages.py to read both uv-cache.hpkg and loose uv-cache/ directories, preserving selective scope='sdists' seeding (.seeded-sdists), selective-to-full upgrade (.seeded), atomic interruption-safe extraction with retry, path-traversal rejection, and expanded 4 KiB-block uv_cache_seed_bytes() accounting. Update scripts/bundles/native_prepared.py to stream file digests and validate uv-cache.hpkg on win32 targets.
scripts/stage-msixbundle.test.mjs was a node:test file outside every JS
test root (tests-js vitest includes only tests-js/**, apps/desktop only
its own scripts/), so CI never ran it. It moves to
tests-js/stage-msixbundle.test.mjs under vitest.
The happy-path test now pins the order of every tool call per bundle:
makeappx at the feed version (/bv), then sign, then verify. The old test
only listed the verify calls, so dropping /bv or verifying before signing
passed it; both now fail. The plan snapshot test duplicated the output
assertions and goes, with the plan's kind field, which only it read.
The staging rewrite changed the missing-input error from "need both
per-arch msix to bundle" to "missing per-arch msix to bundle". The native
Windows test apps/desktop/scripts/commit-bundles.windows.test.mjs still
matches /need both per-arch/ in the CLI's stderr, so its missing-input
case failed even though the CLI refused correctly.
The thrown error keeps the old prefix and still lists the missing files.
The Node test now asserts the same text the native test reads.
The downloads-page label for the single-arch bundles said "manual; in-app
updates". That is false on every page that renders it. Those pages list
tag and commit builds, which carry no channelBuild in their install stamp,
and a bundle opened directly registers no App Installer source. With no
updates.desktop_feed_base_url configured, the app-installer checker
reports "No App Installer update source is registered" and apply() falls
back to the manual-install message.
The label now reads "manual install and updates": a direct install is
updated by opening the next release's bundle, which upgrades it in place.
The downloads-page test asserts the Windows rows say "manual" and never
"in-app".
Emit and sign single-architecture Windows .msixbundle packages (-win-x64.msixbundle and -win-arm64.msixbundle) alongside the existing universal -win.msixbundle in scripts/stage-msixbundle.mjs, and update all release consumers atomically.
Windows rejects in-place upgrades from an installed .msixbundle to a bare .msix, while downloading a single-arch .msixbundle via one HTTP GET cuts clean installs and in-place upgrades from 63–99 minutes down to ~5–6 minutes (verified on Win11 x64 and ARM64).
Key changes:
- scripts/stage-msixbundle.mjs: stage each bundle from an isolated hardlinked/copied directory (removing staging dirs immediately to preserve runner disk), sign all 3 with Azure Trusted Signing, and verify /pa on each.
- scripts/bundles/release_artifacts.py: add select_windows_bundles() and validate_windows_arch_bundle(); accept either historical universal-only receipts (v0.22.0/rc.2) or complete 3-bundle sets (universal + x64 + arm64), failing loudly on incomplete sets.
- scripts/releases/stable.py, scripts/bundles/channel_artifacts.py, scripts/releases/channel_publish.py: select universal vs per-arch bundles explicitly via select_windows_bundles() and validate per-arch manifests when local bytes are present.
- scripts/releases/downloads_page.py: prefer signed per-arch .msixbundle (labeled manual install; uses in-app updates) over bare .msix when present, while keeping .appinstaller primary for OS-managed feeds.
Add contributors to INERT_SNAPSHOT_DIRS in scripts/bundles/payload.py so repository-root contributor attribution files (3,256 tiny files totaling ~0.1 MiB, read only by CI attribution scripts) no longer ship inside macOS, Linux, and Windows desktop payloads.
runtime.py passed the literal "tools.bot_desktop.idle_watch" to the
launcher's idle command. It now passes next_check_in.__module__, the
module it imports two lines above, so the name follows the file when the
package moves. The value is the same today.
The row in scripts/move/exclusions.py that told the move rewrite to keep
that literal is removed with it.
pm imports hermes_cli.config inside functions, so a utils helper could
reach config through it with no waiver. No utils module imports pm, so the
allowlist entry goes.
utils/AGENTS.md: the product test names its one standing exception (the
atomic writers call hermes_constants.mkdir_under_hermes_home so a write
never resurrects a deleted profile), the owner table gives
hermes_cli/config_backend.py its real path, and the submodule-import rule
is scoped to new callers. The utils/__init__.py docstring says the same.
tests/AGENTS.md no longer lists utils among the modules whose tests sit
directly in tests/.
The rule's tests now cover a root-level product module, `not in
sys.modules`, and a relative import inside utils.
utils is meant to be importable from every package without pulling the
product in, and nothing enforced that. HX018 is a blocking code-health rule
over utils/: it flags an import of a first-party module at any depth,
importlib.import_module or __import__ of a literal name, and a sys.modules
get, subscript or `in` lookup of one. Allowed: other utils modules,
hermes_constants, hermes_platform, hermes_yaml and pm.
First-party names come from the judged tree's tracked files (NAME.py or
NAME/__init__.py at the root), so there is no list to keep in sync.
The two hermes_cli.config imports in utils/files.py, the config writer's
round-trip YAML path, carry `# health: allow HX018 -- why`. They are the
whole exception list.
utils/AGENTS.md states what belongs in utils and what the rule allows. The
root routing table gets no row: root plus gateway/AGENTS.md is 11 characters
under the chain cap.
Text-to-speech engines, transcription, voice mode and wake word register no
tool, so 28 files leave tools/ for a root package with four sub-packages:
speech/synthesis, speech/transcription, speech/voice and speech/wake_word.
tools/tts_tool.py, which registers text_to_speech, stays, and so does
tools/tts_elevenlabs_voices.py, which builds part of that tool's schema. Each
__init__.py is a docstring only.
File names keep their stem and drop the prefix the folder makes redundant.
transcription_tools becomes transcription/transcriber, transcription_common
becomes transcription/settings, wake_word becomes wake_word/listener, and
tts_tool_openai becomes synthesis/openai_compatible: neutts_synth.py runs by
file path from that folder, where an openai.py would shadow the openai package.
The NeuTTS samples and the bundled wake-word model move with the code that
reads them through __file__.
Function bodies are unchanged and every import stays where it was. Logger
names follow the modules: a moved module logs under its speech.* path, and a
literal that named a moved module names its new path. speech joins the tools
log component, so `hermes logs --component tools` shows the same lines. The
seven synthesis files that share the logger of tools/tts_tool.py keep it.
tools.tts_streaming keeps a generated file at its old path. Every release from
v0.21.6 to v0.23.5 imports it inside the CLI and TUI turn, outside any try, and
an idle process has not loaded it yet, so a process that outlives `hermes
update` would fail its first turn. No other moved name gets a file.
speech joins pyproject's packages.find, FIRST_PARTY_MODULE_ROOTS, the plugin
isolation audit, the known logger roots of `hermes debug share`, six check
scripts, the P33 profile-scope pattern, the subprocess env guard test, the
packaging test and three fixtures that copy a source tree. Tests whose subject
is a moved module move to tests/speech/ with the fixtures only they use.
Pinned catalog plugins import these moved modules by the old name, so each has a key in
hermes_agent/compat/moves.py and the plugin guide lists it with the release
that may remove it (no earlier than v0.27.0):
tools.transcription_cloud
tools.transcription_tools
tools.tts_text_normalize
tools.tts_tool_providers
tools.voice_live
tools.voice_mode
tools.voice_mode_transcript
tools/ holds model tools. These 15 files register none: they launch and
track Chromium, hold the per-task browser sessions and run the CDP
supervisor the browser tools call. They move to a new root package:
tools/browser_session*.py -> browser/session*.py
tools/browser_launcher{,_holders} -> browser/launcher{,_holders}.py
tools/browser_lightpanda.py -> browser/lightpanda.py
tools/browser_supervisor*.py -> browser/supervisor*.py
tools/browser_real_profile_logins -> browser/real_profile_logins.py
tools/bot_desktop/browser.py -> browser/desktop_profile.py
browser/__init__.py is a docstring only. tools/browser_tool.py and every
tool file stay. 38 tests and one helper move to tests/browser/; its
conftest.py imports the autouse fixtures of tests/tools/conftest.py they
ran under.
Old-path files, each a MOVES key, a REQUIRED_NAMES row and a file
written by scripts/move/generate_shims.py:
- tools.browser_supervisor and tools.browser_supervisor_capture are on
the published plugin API (hermes_cli/data/plugin_api.json), so a
plugin's import gives the same module object.
- tools.browser_session and tools.browser_session_cloud are imported
inside functions on every turn by a process started on v0.22.7 to
v0.23.5 (the per-turn browser cleanup), which keeps running its old
code after an update swaps the checkout.
Function bodies are unchanged and every import stays where it was.
Loggers follow their modules: every moved file keeps
getLogger(__name__), and the two literal supervisor loggers name
browser.supervisor. browser joins the tools entry of
hermes_logging.COMPONENT_PREFIXES, so `hermes logs --component tools`
shows the same lines. browser also joins packages.find,
FIRST_PARTY_MODULE_ROOTS, _KNOWN_LOGGER_ROOTS, the plugin isolation
audit, six check scripts, the P33 profile-scope pattern, the gateway's
stop-path preload list and the test fixtures that list root packages.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py; split imports, imports inside child-process code
strings, boundary-lint baseline keys, two resolution-allowlist rows and
docs globs were fixed by hand.
Pinned catalog plugins import these moved modules by the old name, so each has a key in
hermes_agent/compat/moves.py and the plugin guide lists it with the release
that may remove it (no earlier than v0.27.0):
tools.browser_session_cdp
tools.browser_session_lifecycle
The alias was dropped from the head's line only when it equalled the old
module name, so `from tools import helper as helper` stopped matching
itself after a move, and `from pkg import (helper)` was not read at all.
Both sides now drop the local name of a from-import that names a moved
module, and the pattern accepts an opening parenthesis.
The ratchet reads a line that names a moved module as the base's line
only when the module has a key in hermes_agent/compat/moves.py. Most
moved modules get no key, so under tools/ every function-level import
of one failed PLC0415 as new, in files the move did not otherwise touch.
module_moves adds the Python files the diff renames to the MOVES table
before lines are compared. module_renames also reads `from pkg import
module`, with the alias a move adds to keep the old local name.
- An import in a function defined under try/except ImportError is checked: the function runs when called, after the handler is gone.
- A try whose ImportError handler re-raises is not a guard, since the missing module still fails the import.
- Tests pin what stays checked: the handler, else, finally, a broader except, a plain if.
Co-authored-by: BearHuddleston <BearHuddleston@users.noreply.github.com>
tool-discovery now flags a registration in tools/registry.py or tools/__init__.py, which discovery never imports; both read one skip set in tools/registry.py.
packaged-imports no longer flags an import inside try/except ImportError or if TYPE_CHECKING, which cannot fail an installed wheel.
packaged-imports now flags a regular package under an unshipped namespace directory.
The FILE_LINES fix text no longer forbids flat siblings an area AGENTS.md prescribes, and is shorter.
CONTRIBUTING.md states the same flat-sibling exception as root AGENTS.md.
ruff's PLC0415 joins the ratchet's pattern rules, scoped to tools/. The 2,716
function-level imports already there are existing debt and keep passing where
they sit; a new one fails unless it carries
'# health: allow PLC0415 -- <why>' (an optional extra or a measured startup
cost). The fix text names the cause: a cycle that forced the import is fixed
by moving the shared names down.
On a Nix package every `hermes plugins enable|disable`, plugin install,
plugin update and `hermes pm install` died in the venv stamp: PM looked
for uv.lock beside the wheel-installed modules (#140765). Shipping the
lockfile does not help, because the sync then builds a dependency
generation from a source tree the package does not carry.
A Nix package's environment is its store closure, so the sync no longer
builds there. On a `distribution: nix` install it checks what a plugin
change brings in, and what extras were asked for, against the
distributions the application can already import, publishes the change
when they are satisfied, and refuses by package name otherwise, pointing
at extraPythonPackages and extraDependencyGroups. The sync records no
dependency state and downloads nothing.
- pm/nix_admission.py: the check. The application's sys.path reaches
every PM child through runtime_environment(), so the worker and
`hermes pm ...` judge the same environment.
- A plugin that was already enabled is not re-judged by an unrelated
change, so one enabled by hand cannot block enabling or disabling
another, or itself.
- `hermes pm install` without --extra no longer asks a Nix package for
[all]: the package variant chose its extras.
- Only the executing tree resolves through the package's stamp; a Nix
install asked to sync another checkout reads that checkout's.
Fixes#140765
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Both modules moved to gateway/outbound/ before v0.23.2. Nine pinned
catalog plugins import tools.send_message_tool by its old name, and one
of them also imports tools.send_message_targets. On v0.23.2 through
v0.23.5 five of those plugins fail to load and four lose a feature.
Two keys in hermes_agent/compat/moves.py map the old module names to the
modules that hold the code now. No file returns to tools/.
The plugin guide lists both names with the release that may remove them
(no earlier than v0.27.0). The moves.py docstring said a key is never
removed; that holds for a key a supported release reaches, and the
docstring now says so.
The boundary lint names a keyed module by its first name, so the one
baseline row for gateway.outbound.send is renamed; no count changes.
The 27 flat tools/mcp_*.py client files and tools/osv_check.py become
modules of tools/mcp/, each without its mcp_tool_ or mcp_ prefix.
tools/mcp_tool.py becomes tools/mcp/client.py, because discovery imports
any tools/<pkg>/tool.py. tools/mcp_tool_agent.py stays. tools/mcp/__init__.py
is a docstring only, so importing one module loads what the flat file loaded.
Their 118 tests move to tests/tools/mcp/ under the same names. Imports,
string patch targets, sys.modules keys and doc paths follow the move.
Three old module names keep a generated file at the old path, because a
process that started on a supported release and outlives the update
imports them lazily: tools.mcp_tool_discovery and tools.mcp_oauth when an
editor's ACP server opens its next session, tools.mcp_elicitation_form on
its next tool call. The other 25 names stop importing.
Logger names follow the modules. The eight files that use
getLogger(__name__) log under tools.mcp.<module>, and the literal name the
split modules share is tools.mcp.client. Every name stays under tools.
The "mcp_tool.py" entry in the discovery skip set is removed: discovery
scans only tools/*.py and tools/*/tool.py, so no file of tools/mcp/ is a
candidate. The same tools register before and after.
_VALID_ASSETS accepted both linux-x86_64.AppImage, the name
electron-builder gives the x64 AppImage and the one
scripts/releases/linux.py publishes feeds for, and a linux-x64.AppImage
alias nothing produces. Both normalize to the same (linux, x64) row, so
an archive holding both listed whichever name came last.
Drop the alias. The new test feeds both names and expects the produced
one in the row and in the version filter; it failed on the previous head
because the alias overwrote the real file.
Linux x86_64 and arm64 AppImages now build, pass native install-and-chat
smoke, unpack to a stable per-version `$XDG_DATA_HOME/hermes/bundles/`
payload path, and publish updater feeds on daily canaries (`#161336`)
and opt-in `--with linux` stable releases (`#161406`), but the builds
page renderer and documentation still hid them or described them as
unsmoked, unoffered artifacts:
- `scripts/releases/downloads_page.py`: accept real `linux-x86_64.AppImage`
and `linux-arm64.AppImage` filenames via `_VALID_ASSETS` (normalizing
`x86_64` to `x64` while rejecting invalid os/arch/ext combinations),
remove `_UNLISTED_OS = frozenset({"linux"})` so staged Linux AppImages
render in `Hermes Desktop` download tables, and update `_SMOKE_SCOPE`
to reflect diagnostic Linux AppImage smokes while preserving the
unsigned Store notice.
- `tests/scripts/test_render_builds_publication.py`: verify real
`linux-x86_64.AppImage` and `linux-arm64.AppImage` rows render in both
release bodies and R2 `index.html`, while YAML feeds and invalid
os/arch/ext pairs remain hidden.
- `apps/desktop/BUILDING.md`, `tests/install/README.md`, and
`website/docs/` (`platform-support`, `installation`, `updating`,
`desktop`, `shared-bundle-builds`, `stable-releases`): document the
Linux AppImage distro/glibc floors, first-launch payload extraction,
`AppImageUpdater` differential updates, measured canary sizes, and
current non-gating canary / opt-in `--with linux` stable status.
The docstring promised a bound on total wall time. Reads end by the
deadline, and the retries in `signed_request`, the downloads and
`put_object` skip a sleep the time left cannot cover; `copy_object`'s
retry, which no budgeted caller reaches, still sleeps. Connecting (per
address tried), the TLS handshake (CPython's `do_handshake` takes one
deadline from the socket timeout) and each send run with the timeout
the connection opened with, which is at most the per-request cap and
the time left at open. So each of those steps is bounded but can still
run that long past the deadline. Say so, so a caller sizes the
per-request cap knowing it is also the possible overrun.
`put_object` retries a retryable R2 status in its own loop with an
unconditional `time.sleep(1.0)`, so under `time_budget` it slept past a
deadline that `signed_request` had already declined to retry into, and
the next attempt then failed on the spent budget instead of the 503.
`_reconcile_linux` reaches it through `linux.publish_stable_record`.
Use `_retry_sleep(1.0)` like the other retry loops: outside a budget it
sleeps as before; inside one it re-raises the PUT's own error once the
time left cannot cover the sleep.
Test: a loopback endpoint answering 503 under a 0.5 s budget recorded
three 1 s sleeps and three PUTs on the previous head; now none and one,
and the error is the 503.
A socket timeout bounds one wait, not one read. `res.read(n)`, the
whole-body `read()` in `signed_request` and the status/header
`readline()` loop recv until they have their bytes, so a peer that sends
a byte every few milliseconds kept a single call going past the
`time_budget` deadline: the budget was only checked between 1 MiB
chunks, and `signed_request` and `read_public_receipt` never checked it
while reading.
Under an active budget, `_connection` now gives the connection a
response class whose socket reader sets each wait's timeout to what the
budget has left (`_effective_timeout`) and raises once it is spent. That
covers the status line, headers and every body read in all four
readers, so the per-loop `_clamp_socket_timeout` / `_check_budget` calls
go away and the chunk loops read as they did before. Connections opened
outside a budget keep the stock response class.
Sends are unchanged: each `sendall` is bounded by the timeout the
connection opened with, which the budget already clamps, and the
reconcilers only PUT small JSON bodies.
Tests: a loopback server that sends headers or a body one byte every
20 ms holds each of `signed_request`, `read_public_receipt`,
`download_public_object` and `verify_remote_artifact` for the whole
10 s trickle on the previous head (8 failed); all raise `TimeoutError`
at the 0.5 s budget now. A trickle that stops at 2.5 s under a 3 s
budget pins the per-wait clamp: without it the last wait runs the
connection's full 3 s.
Post-publication reconcilers (`_reconcile_store`, `_reconcile_linux`)
run after durable channels have already moved, inside `reconcile`'s
30-minute timeout. Previously they inherited `r2.py`'s 600-second
per-request socket timeout and unbounded retries, so a stalled R2
request could outlast the workflow timeout and fail the run after
publication. `_reconcile_store` also caught only `(StoreError,
ValueError, OSError)` and did not handle `r2.R2RequestError` or
`http.client.HTTPException` when reading the archived candidate
manifest.
Add a `ContextVar`-backed `r2.time_budget(total_seconds, *,
per_request_timeout=None)` context manager wired through
`signed_request`, `read_public_receipt`, `_download_url`, and
`_stream_and_hash` (clamping open socket reads and retry sleeps to the
remaining deadline, strictly tightening nested budgets). Wrap
`_reconcile_store` and `_reconcile_linux` in a 300 s budget with 60 s
per-request caps, and widen `_reconcile_store`'s advisory catch tuple
to log a structured Microsoft Store warning on R2/HTTP errors.
Retiring a name in the registry turned it into chat at the adapter boundaries: Slack `/hermes topup`
became the plain text `topup`, and Slack `!topup` / Matrix `!commands 2` were never rewritten, so the
model read them. Every adapter normalizer now asks one rule, hermes_cli.commands.is_command_on_input
(registry names and aliases, plugin commands, RETIRED_COMMANDS keys), and slack_subcommand_map (the
native and relayed `/hermes` input map) carries the retired names, so the gateway answers the rename
notice. Menus still list only the registry. The Matrix guide recommends `!help`.
Desktop's /hatch fallback for older backends runs only when the session's loaded catalog lists
/hatch; an unloaded catalog sends the command to the backend. On the shared gateway Ink offers only
the /pet arguments it runs itself (no `hatch`). Restricted /help drops the usage-hint parts a folded
form owns from its parent's line unless the caller holds that folded grant.
The folds Teknium approved are on main (/verbose focus, /statusbar battery|indicator,
/status's egress block, /model --runtime, /pet hatch, /goal add, /help <page>,
/billing topup|upgrade, TUI /verbose details|density), but the old names still ran.
They are now retired with RETIRED_COMMANDS: typing /focus, /battery, /indicator,
/egress, /codex-runtime, /hatch, /generate-pet, /subgoal, /commands, /topup,
/subscription or /upgrade (either _ or - spelling) runs nothing on the CLI, gateway,
TUI and Desktop and answers "`/old` is now `/new`.". The TUI answers its own /details,
/detail and /density the same way (slash.retired), since they never existed elsewhere.
The old names leave help, menus, completion, the Telegram menu priority, the Slack
/hermes-only set, the Desktop registry and description keys, and the docs tables (the
Renamed commands table lists each). Handlers only the old names reached are removed;
the umbrella commands still call the shared handlers.
Slash access: the folded forms check their own user_allowed_commands keys (goal-add,
model-runtime, status-egress, help-pages) instead of the retired names, and an
operator list that still names subgoal, codex-runtime, egress, commands or topup
grants what replaced it, so no existing config loses or gains access.