The out-of-process Telegram sender (_send_telegram and its bot, retry, text, media,
album and format helpers) moves from tools/send_message_senders.py into
plugins/platforms/telegram/standalone.py, registered as the PlatformEntry
standalone_sender_fn (the Signal pattern). _send_to_platform reaches it through
_plugin_standalone_sender and passes notify; core no longer imports the Telegram
plugin, and the plugin no longer imports tools.send_message_tool._send_telegram.
Small local copies of the caption split and the result/redaction helpers keep the
plugin on its published API. boundary_lint --update: only removals vs origin/main.
The standalone sender (hermes send, the send_message tool, standalone cron delivery) now
makes the gateway adapter's outbound decisions:
- rich_messages: true -> the adapter's own sendRichMessage gates and routing
(telegram_outbound.send_rich_standalone over the standalone Bot), so tables, task lists,
<details> and $$ math render natively; a transient rich failure is not resent as legacy.
- A rejected Bot API HTML chunk (an unsupported tag next to supported ones) retries as
MarkdownV2 before plain text, so its Markdown still renders.
- display.platforms.telegram.notifications applies to every standalone text/media send;
_send_to_platform(notify=) rings regardless, and cron's standalone lane passes
cron.delivery.notify so briefs ring in both lanes (#92929).
- Invisible-only text (zero-width, BOM, soft hyphen, bidi marks) is never delivered, in
both the adapter's send() and the standalone sender.
The notifications resolver moves from adapter.py into telegram_outbound.py and reads the
active profile's config.yaml through load_config_readonly(): it passed the GatewayConfig
dataclass to cfg_get, which only walks dicts, so the config.yaml key was always ignored
(regressed in 5600105478).
Fixes#74004, fixes#124413, fixes#145606, fixes#60848, fixes#131924, fixes#144895
Co-authored-by: Dean Chen <862469039@qq.com>
Co-authored-by: liuhao1024 <sunsky.lau@gmail.com>
Co-authored-by: Lavya Tandel <160998697+LavyaTandel@users.noreply.github.com>
hermes send, the send_message tool and standalone cron delivery built a bare
telegram.Bot: api.telegram.org only (platforms.telegram.extra.base_url ignored),
PTB's 5s/1s defaults and 20s media write timeout (HERMES_TELEGRAM_HTTP_* ignored),
no TelegramFallbackTransport. _telegram_bot now takes the platform extra and
builds the same request shape as the adapter's _build_ptb_requests: base_url /
base_file_url, the adapter's timeouts incl. media_write_timeout=60, proxy
(TELEGRAM_PROXY or extra.proxy_url), else the fallback-IP transport over the
configured or seed IPs (no DoH on a one-shot send).
The retry classifier also retries a connect or pool timeout (the request never
left, the adapter's _looks_like_connect_timeout / _looks_like_pool_timeout),
while every other timeout stays final.
Live probe (real `hermes send` -> stand-in Bot API via extra.base_url):
main: {"error": "Telegram send failed: Unauthorized"} (went to api.telegram.org)
head: success, one sendMessage on the stand-in, message visible.
Fixes#51223, fixes#62936, fixes#20915, fixes#47229, fixes#145412
Salvages #145428 (@locker95), #119934 (@OsmanSujoy), #125409 (@linfeng961)
Co-authored-by: Dean Chen <862469039@qq.com>
Co-authored-by: Osman Gani <32834772+OsmanSujoy@users.noreply.github.com>
Co-authored-by: linfeng961 <133505766+linfeng961@users.noreply.github.com>
run_tests.sh forwarded HERMES_E2E_UPGRADE_BASE and HERMES_E2E_N1_REF
but dropped the suite's other knobs: HERMES_E2E_INSTALL_REF (installs a
patched commit to prove a leg red), HERMES_E2E_GIT_OBJECTS (an extra
object store for the smart-HTTP origin) and HERMES_E2E_KEEP_ROOT. Set
through the runner, they were ignored without a message. None is a
credential.
Part of #150040
The existing handoff test supersedes only while the first attempt is still
signing, so consuming the key on use again would pass it. This sends two
requests, each signed at once, and checks both prologues carry an HMAC under
the QR secret. Follow-up from BearHuddleston's review of #150938.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
Baileys awaits prekey upload and passive IQs between CB:success and 'open', so
connectionState is still 'disconnected' when a passkey_prologue_request can
arrive; the guard now also accepts registered creds (creds.me.id).
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
readline's question() rejects Ctrl+C with its own AbortError while the attempt's
signal is untouched; passkey_socket.js dropped it as a supersede, so the bridge
kept running with no prompt. Only this attempt's aborted signal now counts as a
supersede; any other AbortError becomes an ordinary failure (exit 1).
A superseding passkey_prologue_request re-derived the handoff HMAC key from the
ADV secret the first request had already rotated in, which the phone never saw.
The key is now derived once per flow and kept for its five-minute window.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
runUntil returned a null status both when the test killed a live bridge after
the warning and when the 15 s guard killed a bridge that never printed it, so
removing the warning, or exiting 78 right after it, still passed. It now
reports alive only when the warning appeared and the bridge was still running
300 ms later; both mutations and dropping the connected-session guard turn
the test red.
The adapter's constant-agreement test regex-read bridge.js, which
tests/AGENTS.md rules out. The bridge test already observes the real exit
status 78 in gateway mode; the adapter test pins its constant to that value
and both sides name each other.
Clearing the current attempt when a newer prologue request arrives closes the
browser, and Playwright then rejects the interrupted page.goto or launch with
a plain Error (net::ERR_ABORTED, "Target closed") rather than an AbortError.
executePrologue rethrew it unchanged, so passkey_socket.js reported a
passkeyError and the bridge exited 1 instead of running the replacement
attempt. The same held for a code question or companion_nonce query that
failed after its attempt was superseded.
Both stages now rethrow the attempt's abort reason when its own signal was
already aborted; the prologue reads the signal before its own cleanup aborts
it, so a genuine failure still surfaces. The encryption key is passed to
sendPairingRequest instead of riding on the session object.
The dashboard text for passkey_required drops the EXECUTABLE placeholder and
literal backticks the page would have shown as-is.
Tests: a superseded attempt whose signer rejects with a plain error, and a
code question that rejects with a plain error after supersede, emit no
passkeyError and the replacement prologue goes out; the stale-answer test's
stub now ignores its signal so only the flow's own abort check stops the
send; the owner-confirmation test waits until the owner is asked. Rethrowing
the raw error in either stage, or dropping the post-confirmation abort
check, turns a test red.
The connected-session case proved the bridge stayed alive by letting
spawnSync hit a 4 s timeout, a fixed cost and a flake risk on slow runners.
It now waits for the bridge's own "ignoring it" warning and kills it; the
guarded exit would run in the same tick as the request, before that
warning, so a null status still proves the bridge survived (removing the
guard turns it red).
The adapter test asserted PASSKEY_REQUIRED_EXIT == 78 by hand. A separate
test now reads the constant out of bridge.js and compares it with the
adapter's, and the retry test parametrizes on the constant.
The code reached the terminal prompt through a synthetic connection.update
event, and the prompt then called back into the flow's
confirmVerificationCode with a socket-lifetime abort controller. A newer
prologue request aborted the old attempt but left its question open, so a
late "y" sealed and sent the newer attempt's pairing request without the
owner having seen that code. A second request also queued behind the
current browser prompt for up to its 600 s bound.
The flow now awaits an injected confirmCode(code, signal) itself and sends
the pairing request only for the attempt that derived the code; signal is
that attempt's own controller, so a newer prologue (which now clears the
current session at once) or a socket close cancels the question. That
removes the event round trip, the returned confirmation wrapper and the
bridge's second controller.
Also removed from the adapted flow: the emitPrologueSent hook, the
pairingHandoffProof argument and getVerificationCode, none of which had a
caller; the proof now comes only from the stashed handoff key. The bridge
prints the passkey failure's name and message instead of one generic line.
Tests: a superseding request cancels the pending question and a late
answer sends nothing; the handoff-window cases assert whether confirmCode
runs. Removing the supersede clear, or forcing or skipping the prompt,
each turns a test red.
The existing confirmation tests call executePrologue directly, which skips
the ADV-derived handoff key a server prologue request stashes first. Through
CB:notification (the path production takes) a fresh session always carries
that key, so the pairing request goes out without the code prompt unless
signing outlasts the five-minute handoff window. Pin both outcomes through
attachPasskeyFlow and say so in PASSKEY.md, with the gateway's new
already-connected behaviour.
PASSKEY-LICENSE: the cited commit c3d846d carries "Copyright (c) 2025"
(2026 is only on current master), and the notice now states the Hermes
modification (owner confirmation when no trusted handoff applies).
Before passkey support, Baileys rc13 acked and ignored passkey_prologue_request.
With it, any such notification made a signer-less bridge exit 78, which the
adapter parks as non-retryable, so a request reaching an already open
gateway session would stop a working gateway until a manual re-pair.
Exit only when the session has not connected yet (or in pair-only mode),
and log and ignore it otherwise.
Also name the exit status (PASSKEY_REQUIRED_EXIT) on both sides, and emit
the dashboard-readable {event: error, error: passkey_required} under
--pair-json instead of a passkey_required event no watcher handles. The
passkey_failed / passkey_confirmation_failed emits and the PAIR_JSON guard
in confirmPasskey are dropped: loadPasskeySigner rejects --pair-json, so
those paths only run in an interactive terminal.
Tests: bridge.passkey.test.mjs drives the real bridge entry point; a
stubbed socket that opens before the request stays alive, and pair-json
emits the error event. Both new assertions fail with the guard / emit
removed.
The aux, compressor and turn paths each grew "is this a <kind> error?"
helpers that read an exception's status_code or grep its text; every
copy drifted from classify_api_error until the previous commit moved
the aux decisions onto the shared classifier. HX014 keeps new copies
out.
What it flags: a def or lambda with an exception parameter (exc/err/
error/e/ex/exception, *_err/*_error/*_exc, or an *Exception/*Error
annotation; a ClassifiedError parameter is not one) whose own body reads
<param>.status_code (also via getattr or .response) or probes the
exception's text (`in str(exc)`, a local bound to that text,
startswith/endswith, re.search/match/fullmatch, _contains_any). Scope:
agent/auxiliary*.py, agent/context_compressor*.py, agent/turn_*.py,
tests excluded.
Like the other HX rules it ratchets base vs head, so existing hits are
grandfathered. Waiver: `# health: allow HX014 -- <why>`.
Tests: tests/scripts/test_code_health_error_predicate_rule.py covers
flagged and passing shapes, scope and the base-vs-head verdict.
Part of the Code Health plan.
The rule-17 archive scan refused a data corpus tarball because one member
was a .jsonld context (siblings: 34k .json files, two .ttl files). Those are
plain-text RDF serialisations, as reviewable as the .json and .xml already on
the source list, so dike's pinned corpus failed pinned-source-validate for a
reason that is not a payload.
Class bodies and match cases run at import, and the import branch of
an 'if __name__ != "__main__"' guard is the body, not the else. Removals
(remove, pop, clear, del) change the search path too.
hermes_cli.config.get_project_root, uninstall.get_project_root, the
PROJECT_ROOT constants of status, cron, gateway, setup, tools_config and
web_server, code_skew and runtime_downgrade_exit _PROJECT_ROOT,
runtime_cwd._PACKAGE_ROOT, shared_metrics_catalog._REPO_ROOT,
desktop_update_verify.checkout_root and host_supervisor._repo_root now
return hermes_cli._startup_fast.project_root_str() instead of their own
__file__ arithmetic. Names, values and test seams are unchanged.
Still separate, on purpose: pm.paths (Docker's tool stage ships pm without
hermes_cli._startup_fast), hermes_constants and hermes_bootstrap (they load
before any package), main.py's script-mode bootstrap, the recovery closure
and stub-tree modules (_early_recovery, update_lock, update_pause_record,
venv_sync: tests and recovery load them as lone files), the lexical
linux_desktop_entry root and self_repo_guard's .git probe. The lint baseline
drops by the 15 sites.
scripts/install_root_lint.py scans the shipped packages and root modules. It
counts __file__ path expressions that climb as many directories as the file
is deep (.parent, .parents[n], os.path.dirname, os.path.join with pardir),
and sys.path edits that run at import. Today's 106 climbs and 13 import-time
edits are the baseline; a file whose count rises fails, and the message names
hermes_cli._startup_fast.project_root_str() as the call to make instead.
Wired into scripts/check (install-root) and the lint workflow.
The skill drives the yb_* tools, which now ship in the yuanbao Labs plugin; the plugin carries
the skill (ctx.register_skill). Regenerated the skill pages, catalogs and sidebar with
website/scripts/generate-skill-docs.py, dropped yb_* from the ACP TOOL_KIND_MAP as the Home
Assistant move did for ha_*, and the boundary baseline's stale Yuanbao entries
(scripts/boundary_lint.py --update).
The upgrade suites chose their start version with a tag pattern that
matches only calendar-version tags, so after releases moved to v0.x
every run started from v2026.9.24, five releases behind. Three copies
of that resolver and a fourth tag scan are replaced by one:
upgrade_base() picks the newest release before HEAD, a ref, or the
newest release of a named updater generation (by-path, handoff,
pre-handoff), from HERMES_E2E_UPGRADE_BASE. scripts/run_tests.sh now
forwards that variable and its older name HERMES_E2E_N1_REF.
The handoff suite's synthetic next release only added a file. It now
also moves a module the gateway imports at boot and rewrites the
importer, so the relaunched gateway serves a turn only if the update
applied the move.
A source module moved under tests/ was skipped, and a test file moved
out of tests/ was compared as source. The base path now decides which
comparison applies. The cap and src/ canaries no longer follow the
values they check.
A renamed file whose path git quotes (non-ASCII) was dropped by the
.py suffix test, and a move out of the source roots was skipped because
only the new path was classified.
Three guards could report success while they checked nothing:
- The public-surface check listed only modified files, so a moved
file (git reports a rename) was never compared. It now pairs each
renamed file with its old path, and treats src/hermes_agent/ as
source.
- The change classifier read file names from the compare API, which
stops at 300 files without saying so and drops the old path of a
rename. A list at the cap now runs every lane, and a rename counts
under both of its paths.
- Tree guards skipped a scan root that did not exist. The config
reader and writer checks, the subprocess stdin check and two guard
tests now fail when a root they scan is missing.
mini_swe_runner.py and scripts/sample_and_compress.py have no importer
and no launcher. Each is reachable only as `python <file>` from a
checkout, and neither command appears in website/docs, docs/, skills/,
README, CONTRIBUTING or any AGENTS.md file.
Evidence (git grep over the whole tree, excluding the files themselves):
- mini_swe_runner: tests/test_mini_swe_runner.py (deleted here) and one
docstring line in trajectory_compressor.py (removed here).
- sample_and_compress: no reference.
- No Dockerfile, nix/, flake.nix, setup.py, pyproject [project.scripts],
.github/ or apps/ui-tui/web reference to either name.
- Neither appears in tests/compat/old_updater_surface.json or in the
plugin API (hermes_cli/data/plugin_api.json).
- No release tag from v2026.8.13 to v2026.9.24 imports either module
from outside the files themselves.
When git could not list the files dropped since the recorded commit, the
prune returned 0 and the caller stamped the new fingerprint, so no later
sweep looked at that commit again and the old folder stayed. It now
raises, the launch sweep keeps the old fingerprint and the update
completion records the bytecode_sweep follow-up. A recorded commit that
no longer exists in the repository still counts as nothing to prune.
A folder reached through a symlinked parent is skipped, so an empty
folder outside the checkout is never removed.
main_web_build.py joins the update-path routing, since the update
completion now imports it.
The Python import probe parsed production source, which tests may not do.
Key scripts/bundles/*.py, scripts/build/*.py and apps/desktop/scripts/*.py
by glob, as pm/*.py already is, so a new module or late import there needs
no list edit; shared modules outside them stay listed. The Python test now
reads only sys.modules after importing the entry points, and a new test
proves a module added to a globbed package changes the key.
The Node graph check moves to tests-js, where JS-only PRs run it; it calls
desktop_build_cache.py's CLI for the key, and classify_changes routes an
edit of that owner to the JS lane too.
The previous change keyed the Node half of the preparation graph only.
desktop_prepare.py and the helpers it calls also import, mostly inside
functions, scripts/bundles/{desktop,payload,bytecode,msix_names}.py,
scripts/releases/{versioning,semver,bundle_env,commit_build}.py,
scripts/termux/deb_version.py, and hermes_cli/hermes_constants/
hermes_platform modules. Key those too.
A new test imports the Python entry points in a subprocess, follows the
late imports of the functions that can run (only the names each importer
takes, so setup_toolchain's archive-inputs subcommand stays out), fails
on a broken repo import, and requires an edit to every repo module that
loads to change the key. The Node probe now converts URLs with
fileURLToPath. Both probes miss dynamic import() in functions that do
not run at import time and PowerShell dot-sourcing; those stay listed
by hand.
The desktop dependency-cache digest listed node-deps.mjs and
electron-runtime.mjs but not the modules they import (pnpm-lock.mjs,
frontend-common.mjs, python.mjs, apps/desktop/scripts/utils.mjs,
macos-sysroot.mjs), the Python helpers desktop_build_cache.py and
native_prepared.py import (scripts/ci/pnpm_lock.py, scripts/build/inputs.py),
or scripts/build/windows-deps.ps1, the provider pm/native_build.py runs. An
edit to any of them reused a cache keyed on the old code.
The test resolves the module graph of the preparation programs with Node's
resolve hook and requires an edit to each module to change the key.
A local client that dials the gateway itself had to spawn `hermes gateway
attach --json` (a Python start) for every connect, because only Python
could work out the endpoint, and it is subtle when a multiplexer serves the
profile. The gateway now answers that lookup itself with a new control verb,
`resolve-profile`, and the local control socket is documented as a public
client contract.
- gateway/control_resolve.py: `resolve-profile {home}` returns the verdict
`discover_gateway_endpoint` gives for that home (state, reason_code,
detail, endpoint plus ws_url/ws_protocol/ticket prefix), `attachable`,
`update_fenced` (the set `ensure` checks), `control` (self/host/null),
the CLI's failure `message`, and `install_code_sha` (read without
touching the gateway's cached boot identity). Built from the existing
discovery helpers; a strict envelope; no credential in the reply.
- gateway/control_socket.py: `resolve_handler` (None by default, so a bare
server keeps the unknown-verb answer) and one dispatch branch.
- gateway/run_bootstrap.py: install the handler over the `identify`
descriptor.
- hermes_cli/gateway_runtime.py: the missing-owner verdict moves into
`_missing_owner_verdict` so discovery and the verb share it.
- apps/shared/src/node/control-socket.vectors.json: request/reply vectors
for `session-ticket` (its current behavior), `resolve-profile` and the
legacy unknown-verb answer; tests/gateway/test_control_socket_vectors.py
runs them. tests/gateway/test_control_resolve.py proves parity with
discovery over real sockets.
- scripts/ci/classify_changes.py: a vectors-only edit runs the Python lane.
- gateway-internals.md: verbs, envelope, errors, rendezvous (POSIX, macOS
launchd, Windows), security model.
Existing verbs, replies, error strings and `supported_verbs` are unchanged.
Refs #141982
A client could not tell "no such plugin method" from "this server has no
plugin RPC": runtime.describe advertised nothing, and plugin.* was in no
contract or ledger. Under plugins.isolation: host the module-level
emit_plugin_session_event returned False and sent nothing, and an
in-process ctx.emit_to_session from a plugin's own thread on a multiplexed
gateway looked the session up in the launch profile.
- runtime.describe lists plugin-rpc-v1.
- tui_gateway/contracts gains CANONICAL_NAMESPACES (canonical_namespace):
plugin.{plugin_id}.{name} with open params, rendered as
CanonicalRpcNamespaces in the TS contract and x-canonical-namespaces in
OpenRPC; the serve handler ledger gets one row for it.
- The plugin host forwards emit_plugin_session_event to the gateway process
(host->parent request session_event), looked up in the host's profile.
- ctx.emit_to_session binds the plugin manager's home before the lookup.
Refs #142005, #141982
The win32 binding comes from the node-pre-gyp run in stage-native-deps, not
a dependency install script, and a skipped optional install is no longer how
get-windows goes missing. The compiler README now says an absent staged copy
is a degraded build.
pnpm >= 11.6 infers `os: [win32]` for optional dependencies whose name
contains "windows" (pnpm/pnpm#17774), so the filtered install that
node-deps.mjs runs drops get-windows on macOS. stage-native-deps already
treats that as a degraded tree and ships without read_window_below, but
validateNativeTree in scripts/build/desktop.mjs still required
get-windows/main on darwin, so every macOS `hermes update` failed with
"Prepared get-windows is missing its macOS helper" and re-owed the
desktop build.
Only refuse a staged get-windows that lacks its macOS helper; an absent
package is the documented degraded build.
Refs #149861
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a9f644c1c3c85b7e8e6808de2cd643fb27e8637f)
node-deps.mjs failed with a raw ENOENT/TypeError when pm/lock.json was
missing or pinned no pnpm; it now names the file and the field.
setup_toolchain.py keeps running `npm config get cache` outside the
checkout: a project package.json or .npmrc in cwd can change or fail it,
not only warn. The alignment test whose pnpm assertion went with
devEngines duplicated PM's lock validation and is gone with its type.
The pnpm version lived in pm/lock.json and in root devEngines, kept equal
by a sync writer on every pnpm re-pin. node-deps.mjs, the only reader of
devEngines, now reads pm/lock.json. That drops root devEngines, the sync
writer and its test, and setup_toolchain's workaround for the
EBADDEVENGINES warning npm printed on every command in the checkout.
pnpm round-trips root keys it does not define (Bit's bit: block) and
sorts them between packages and snapshots, so the fixed key list made
such locks unreadable. Comments, conflict markers and tabs still raise.
- An npm: alias (my-ms: ms@2.1.3, string-width-cjs: string-width@4.2.3)
was checked against its alias name, which is not a packages key, so a
move between locked versions was dropped. Check the real package.
- An edge added to or removed from a package on both sides (a
packageExtensions dependency) was not compared. Report it.
- Diff the direct dependencies only of projects present on both sides;
a project that appears or disappears is one "project <path>" row, not
a row per dependency (a rename went from 240 rows to 2).
- An entry of an unexpected shape raises ValueError rather than
AttributeError, KeyError or TypeError.
section() and section_keys() stopped at any column-0 line, so a stray
comment, a merge-conflict marker or a tab-indented field inside importers
truncated the section and the diff reported every later project as
removed. Only a pnpm lockfile top-level key or the end of the file now
ends a section; any other unindented line raises.
The lockfile diff reduced pnpm-lock.yaml to its packages keys, so a
project or package repinned to a version already in the lock (hermes-ink
semver 7.8.5 -> 7.7.4) reported no change. Also diff each importer's
direct dependencies and the snapshot dependency edges, shown only when
the package rows cannot explain the move, so a bump stays one row.
Core keys left out the importing file and module keys lumped every file
of a module together, so two PRs adding the same target from different
files both ran --update to the same count, merged cleanly, and left main
one above the baseline.
Key every baseline entry as `<importing file> <target>` (repo-relative
path, line dropped). Additions in different files are now different
JSON lines. A file importing one target twice still counts 2 under one
key. Moving an import to another file now reads as a swap and needs
--update.
Totals are unchanged (830 / 29) across 789 + 21 keys.
Known limit: two PRs adding the same target in the same file still
merge to a count one above the baseline; CI on the merged head
catches it.
The baseline held one count per direction, so two PRs that each accepted
a different new import with --update made the same edit (830 -> 831),
merged cleanly, and left main at 832 against a baseline of 831.
Key the baseline per crossing instead: `<module dir> <target>` for a
module's import, the target alone for core's. Two accepted imports are
now two different JSON lines, moving an import between files of one
module (or between core files) keeps its key, and a swap (one removed,
another added) still fails. --check names the new crossing and says how
to accept an intended one.
Totals are unchanged (830 / 29) across 776 + 16 keys.
Also cover dashboard-manifest modules, relative imports and the core-side
TYPE_CHECKING skip in a tmp-tree test.
A core import line naming several modules (`import plugins.web.exa,
plugins.web.firecrawl`, `from plugins.web import exa, firecrawl`) was
counted once. Collapse spellings per alias instead, so each distinct
module counts. Counts on this tree are unchanged (830 / 29).
Also state the ratchet precisely: CI fails when a direction's total
rises above the committed baseline; reductions stick only after
`--update`.