Commit Graph

3238 Commits

Author SHA1 Message Date
Maciej Lisiewski
547739e466 Merge pull request #154471 from NousResearch/sec/126942-sandbox-artifact-integrity
fix(sandbox): verify the cua-driver tarball before extracting it
2026-11-13 17:17:57 +01:00
BearHuddleston
69a1ad5c08 fix(bundles): refuse a macOS update ZIP of 1 GiB or more
v0.22.0 ships Electron 40, whose Squirrel.Mac reads the whole update
ZIP into one NSData. From 1 GiB, CFData's growth asks Electron's
allocator for 2 GiB, which refuses, and the app dies with SIGTRAP
partway through the download (electron/electron#55089, fixed in
Electron 44.7). Measured with the real signed v0.22.0 app on macOS: a
1,070,000,000-byte ZIP downloads, a 1,080,000,000-byte one crashes it
at 1,076,887,552 bytes. rc.2-v0.23.2 shipped a 1,447,529,425-byte ZIP
and its macos-packaged-arm64 upgrade job crashed exactly this way.

Recording a macOS build now refuses a ZIP of 1,073,741,824 bytes or
more and prints the margin otherwise, so an oversized build fails in
its own job instead of in the upgrade gate or on users' Macs.
2026-11-13 10:17:50 -06:00
BearHuddleston
e9607bf4e9 perf(bundles): leave Chromium out of the macOS bundle; install it on first use
v0.22.0 on macOS cannot update in-app to a bundle whose update ZIP is
1 GiB or more: its Electron 40 Squirrel.Mac reads the whole ZIP into one
buffer and dies past 1 GiB (electron/electron#55089). The rc.2-v0.23.2
ZIP is 1,447,529,425 bytes, and its Chromium alone is 177 MB compressed.

Chromium is already an optional default: `install.sh --skip-browser`
declines it, and the browser tool installs PM's pinned build once per
process when none is found (browser_launcher._maybe_autoinstall_chromium,
under security.allow_lazy_installs). On a sealed payload that install
lands in the writable store (tests/pm/test_store_extensions.py).

The macOS payload now leaves it out, so the first browser use downloads
it (195 MB). Windows and Linux bundles still ship it.
2026-11-13 10:17:18 -06:00
Maciej Lisiewski
342b54fa53 Merge pull request #154614 from NousResearch/sec/46006-no-user-content-at-info
fix(gateway): keep user content and identities out of INFO+ logs (HX017)
2026-11-13 17:17:09 +01:00
BearHuddleston
96e4107167 perf(bundles): ship the payload uv cache's venv-identical files once, as links
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
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
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
v0.22.0 on macOS cannot update in-app to any bundle whose update ZIP is
1 GiB or more. It ships Electron 40, whose Squirrel.Mac reads the whole
ZIP into one NSData; past 1 GiB CFData asks Electron's allocator for
2 GiB, which refuses, and the app dies with SIGTRAP (electron/electron
#55089, fixed in Electron 44.7). Measured with the real signed v0.22.0
app: a 1,070,000,000-byte ZIP downloads, a 1,080,000,000-byte one kills
it. The rc.2-v0.23.2 ZIP is 1,447,529,425 bytes.

Most of that is the payload uv cache shipping a second copy of the
venv: 31,771 of its archive-v0 files (297 MB compressed) are byte for
byte the venv's installed files.

Off Windows, staging now replaces each archive-v0 file the payload venv
holds byte for byte with a relative link to the venv copy. Files the
installer rewrote (RECORD) or placed elsewhere (.data) stay. The uv
seed recreates links that stay inside the cache, as before, and copies
the bytes of a link that leaves it, so the machine cache keeps no link
into a payload an update will replace. MSIX packages hold no links, so
Windows is unchanged.
2026-11-13 10:16:38 -06:00
Maciej Lisiewski
ed8e8fa147 Merge pull request #154613 from NousResearch/sec/146032-update-repo-scope
fix(update): refuse to stash/reset/clean a repo enclosing a damaged checkout
2026-11-13 17:16:03 +01:00
Maciej Lisiewski
d352a19670 docs(debug): document debug-share consent, parity verdict and 1-day --expire default
Refs #94876
2026-11-13 14:05:03 +01:00
Maciej Lisiewski
46e6db2892 fix(gateway): HX017 sees transcripts, user_display and getattr names; persist salt without link()
Extend HX017 to transcript/user_display and getattr(obj, "<name>", ...) and move the five INFO
sites it then flags (Discord/run_voice transcript, Discord mention-only display name, Telegram
approval/clarify first name + choice text) to lengths/ids. The Discord expired-interaction
WARNING logs only the slash verb. Where link() is refused the salt is created with O_EXCL, and
a failed salt read is cached per home so log calls stop retrying file I/O.

Refs #46006
2026-11-13 13:59:40 +01:00
Maciej Lisiewski
53a5c32f18 fix(gateway): keep user content and identities out of INFO+ logs
Gateway and adapter logs reach `hermes debug share` uploads, whose redaction covers
secrets only, so message bodies, subjects, display names, e-mail addresses and the
inbound-message preview were being published verbatim. INFO+ lines now carry lengths,
platform ids or a short `hash_for_log` digest; the raw value moves to DEBUG.

HX017 (scripts/code_health/py_rules_log_content.py) flags INFO+ log calls in gateway/
and plugins/platforms/ whose args are content-named values (text, body, subject,
user_name, display_name, sender_addr, ...). It is name-based on purpose: ids are not
matched, and transport payloads (resp.text, error_text) are skipped. Every existing
hit is fixed or waived with a reason, none baselined. Policy documented in
gateway/AGENTS.md and ADDING_A_PLATFORM.md.

Refs #46006
2026-11-13 13:59:39 +01:00
Teknium
513f8bfbfd ci: route default_plugins.py to the upgrade lane (the update tail imports it) 2026-11-13 02:36:06 -08:00
Teknium
7adcd5e76d feat(plugins): catalog entries marked default: true are installed in every home
A catalog entry at tier official or verified can now set `default: true`.
Every Hermes home then gets it installed at its catalog pin and enabled,
once:

- at the end of every source install and `hermes update` (the shared
  maintenance tail install.sh / install.ps1 / the updater all run), for
  every profile home;
- on first start, through the boot bootstrap, for installs that never run
  that tail (bundled Desktop payload, Docker, Nix, Termux); a failed fetch
  stays owed and is retried on later starts behind an hour-to-a-week
  backoff checked before any network;
- when a profile is created.

Each home records what it got in `_default_plugins_installed` (the way the
left-core migrator records its one-time install), so a user who removes or
disables a default plugin keeps that choice through later updates. Homes
with security.allow_lazy_installs off fetch nothing. The parser ignores
`default` on community entries and the catalog validator refuses it.

Lane B1.12 (default plugins installed and enabled from the catalog).
2026-11-13 02:36:06 -08:00
Teknium
4f2fd3b8c0 fix(plugin api): publish hermes_cli.urllib_security:open_credentialed_url
The redirect-safe opener (drops credential headers when a redirect leaves
the origin) is what plugins sending API keys should use, and the bundled
model providers already do; validate still warned on it as a private
import. List it in plugin_api.json with a short docs section, regenerate
public-api.md, and drop the three now-public crossings from the
boundary-lint baseline.
2026-11-12 22:33:52 -08:00
BearHuddleston
dbc135f5d0 fix(bundles): let the payload launcher run a named module
A bundle's bin/hermes could only start hermes_cli.main. The store launcher
that source installs publish (.hermes/bin/hermes) also takes
`--run-module <module>`, and services persist that form for the launchd
stderr wrapper (installation_command), so a service could not run through
a bundle's own launcher.

posix_launcher now handles `--run-module` the same way, with the same
interpreter, PYTHONPATH, site dir and outside-the-app bytecode cache as its
main entry. The module name is spliced into the -c source, so anything but a
dotted Python name exits 2 before Python runs. Keeping the name in the
source keeps the stderr wrapper's argv in the shape gateway/status already
matches for runtime_command's bootstrap.

The next commit makes a macOS app's gateway service use this.
2026-11-12 23:36:59 -06:00
BearHuddleston
58e0b85e91 fix(bundles): bake the interpreter's stdlib and every existing pyc as unchecked-hash
A sealed macOS bundle is user-writable, so any payload Python that runs without
a cache prefix rewrites stale bytecode inside the signed app. codesign then
reports "file modified", spctl rejects the app, and the next Squirrel.Mac
update waits on a Gatekeeper prompt. The shipped Nov 10 canary (da06acacc9),
inventoried on a real Mac, had:

- stdlib: 1,061 modules, 140 timestamp pycs (all stale: they record the
  2024-01-01 source mtime, the .py files carry the build time) and 921 with
  no pyc at all. bake_bytecode never compiled the interpreter's own library.
- venv site-packages: all 25,439 pycs timestamp-based and stale; pm-runtime:
  all 61. uv's --compile-bytecode writes timestamp pycs, and compileall
  without -f keeps a timestamp pyc whose mtime still matches, even in
  unchecked-hash mode, so the bake left them as they were. Packaging then
  moved the sources' mtimes.
- hermes-agent: unchecked-hash, as intended.

On that build, Desktop's ticket helper rewrote 94 stdlib pycs inside the app,
and a `python -I` import of the gateway (which ignores PYTHONPYCACHEPREFIX)
wrote 248 (103 stdlib, 145 venv).

The bake now also compiles the staged interpreter's library, found by
CPython's own landmark (os.py) beside the binary and refused when it lies
outside the payload, and forces every root (-f) so existing timestamp pycs
become unchecked-hash too. The same payload baked with this change on the Mac:
every module in all four roots unchecked-hash, nothing stale or missing, and
neither the ticket helper nor the `python -I` import wrote a file. The bake
took 25 s there; the stdlib grows by about 16 MiB. The prepared-payload
digests skip __pycache__, so they are unchanged.

Windows and Linux install trees are read-only, so their payloads never hit the
seal break. The Windows launcher reads these source-adjacent pycs (it sets no
cache prefix for a baked payload), so there the change only removes
recompiles.
2026-11-12 22:34:16 -06:00
BearHuddleston
7350e53f27 refactor(termux): name the tools the .deb payload records
payload_facts.py recorded the bionic payload's tools from an inline tuple,
and its assembly test kept its own copy. PAYLOAD_TOOLS names the set once,
so a test can check it against what PM requires on linux-arm64-bionic.
The assembly test's fixture moves into a helper for that reuse.
2026-11-12 18:57:08 -06:00
Maciej Lisiewski
efc7d5d9cf Merge pull request #154491 from NousResearch/sec/132195-docs-url-scheme
fix(plugins): reject non-https catalog docs_url end-to-end
2026-11-13 00:34:52 +01:00
Maciej Lisiewski
faef126c03 fix(plugins): require a hostname for catalog docs_url at admission
https://:443/docs and https://user@/docs matched the authority regex but
carry no hostname; the loader already dropped them, admission now refuses
them too (urlsplit ValueError counts as a rejection).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-12 23:28:03 +01:00
Maciej Lisiewski
b545c8d95f fix(plugins): drop malformed catalog docs_url instead of failing the load
urlsplit("https://[") raises ValueError, which aborted load_catalog, the live parse and site extraction instead of dropping one link. Both https gates now treat a parse error as "not https". Admission also requires a non-empty authority so a hostless https:///docs is rejected up front rather than silently dropped after merge.

Refs #132195
2026-11-12 23:28:03 +01:00
Maciej Lisiewski
f62ffe0895 fix(plugins): drop non-https catalog docs_url at load and gate every docs href
The salvaged extractor/validator check covers the docs site build, but the
runtime loader re-validates the raw live catalog JSON and passed docs_url
through to the dashboard's <a href>, and the site rendered plugins.json
values verbatim. Drop non-https docs_url in entry_from_mapping (entry kept,
like image/version) and route the website and dashboard links through the
shared externalUrlTarget scheme gate. The validator's docs_url check moves
into _check_page_fields to keep validate_entry under its CC ratchet.

Fixes #132195
2026-11-12 23:28:03 +01:00
kokhlo
549c8dd634 fix(website): reject non-https plugin catalog docs_url before it reaches the site 2026-11-12 23:28:03 +01:00
Maciej Lisiewski
f2cadb13ae fix(whatsapp): launch bridge.js from the scrubbed child env
The gateway bridge and both pairing launches (dashboard, `hermes whatsapp`)
built their env with with_hermes_node_path(), which copies os.environ, so the
networked Node bridge and its third-party npm deps saw every provider key,
platform token and gateway allowlist. They now start from
hermes_subprocess_env(); the gateway path still re-injects every WHATSAPP_*
value bridge.js reads from the adapter's resolved settings, so the
blocklisted WHATSAPP_ALLOWED_USERS keeps reaching the bridge's DM gate.

Fixes #38079
2026-11-12 22:57:42 +01:00
Maciej Lisiewski
5fbd151e32 fix(install): move a dangling .git symlink aside instead of refusing the dir
test -e follows the link, so a .git symlink to a missing target skipped the
repair probe and the rerun stopped at "not a Hermes git checkout". -L counts
the link as present; the ceiling-bounded probe then moves the dir aside.

Co-authored-by: kvnloo <7121943+kvnloo@users.noreply.github.com>
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-12 22:23:29 +01:00
Maciej Lisiewski
ae83d51886 fix(install): delete git location vars via Env: so pwsh 7.5+ leaves no empty GIT_DIR
PowerShell passes $null to a .NET string parameter as '', and .NET 9+
stores SetEnvironmentVariable(name, '') as an empty variable instead of
deleting it. git then read GIT_DIR= as a path: a healthy checkout was moved
aside, clones failed with "could not create work tree dir ''", and the
restore left empty vars in the user's iex session.

Co-authored-by: BearHuddleston <BearHuddleston@users.noreply.github.com>
2026-11-12 22:23:28 +01:00
Maciej Lisiewski
8c53f972c5 fix(install,plugins): ignore inherited GIT_DIR/GIT_WORK_TREE around checkout git calls
An exported GIT_DIR/GIT_WORK_TREE (dotfiles alias, git hook) retargets every
`git -C <checkout>` at the user's other repo, so an installer rerun stashed and
reset that repo, and the plugin foreign-checkout guard passed because GIT_DIR
disables discovery. install.sh unsets the location vars in the repository and
complete stages (subshells); install.ps1 clears and restores them around the
same stages; noninteractive_git_env drops them for every internal git call.
install.ps1 also builds the probe ceiling from the link-resolved InstallDir
without a trailing separator, matching install.sh's `pwd -P`.

Fixes #146032
2026-11-12 22:23:28 +01:00
Maciej Lisiewski
2cf7a4ef72 fix(install): keep the damaged-checkout probe from resolving to an enclosing repo
The installer's `rev-parse --verify HEAD` probe passed when a damaged
INSTALL_DIR/.git made git walk up to a git-managed $HOME, so the rerun
that `hermes update` now recommends ran fetch, `stash push
--include-untracked`, checkout and `reset --hard` against the home repo.
install.sh and install.ps1 now run the probe with GIT_CEILING_DIRECTORIES
set to INSTALL_DIR's parent, so a damaged checkout is moved aside and
cloned fresh.

Also: the updater's run_git drops inherited GIT_DIR/GIT_WORK_TREE and
friends (they retarget every mutator away from the checkout), and the
pinned-feed plugin update refuses a plugin dir git resolves elsewhere.

Fixes #146032
2026-11-12 22:23:28 +01:00
Bear Huddleston
91b9cf805f fix(release): cap the canary draft body so Canary Release drafts again (#154321)
* fix(release): cap the canary draft body below GitHub's limit

Canary Release has failed at "Tag and draft" since 2026-11-11 (runs
42974584993 and 43170357147): `gh release create` got HTTP 422, "body
is too long (maximum is 125000 characters)". The daily changelog lists
every commit since the previous canary tag, and main now lands 800 to
1,300 commits a day: 1,314 commits made a 234,391-character body on
Nov 11 and 829 made 149,678 on Nov 12. Nov 10's 108,144 still fit.

The stable path has refused an oversized body before its claim since
74c365a85a; the canary path had no check, pushed its tag, and then
failed to draft. With no draft, no Desktop Bundled Release was
dispatched.

When the changelog would not fit, the canary now drafts the
--no-changelog body (title, builds-table marker, Full Changelog link).
The check keeps 10,000 characters for the builds table that the
builds-table job later splices into the marker, also under GitHub's
limit. A full matrix with diagnostics renders about 3,000.

* fix(release): recover an undrafted canary tag without GitHub-generated notes

When a canary tag exists with no release (a cut whose draft failed after
the tag push, as on Nov 11 and 12), the next run with no new commits
recovers the tag and drafts it with --generate-notes. GitHub builds
those notes server-side from every pull request since the last
published release and does not truncate them (cli/cli#7705). Every
canary since Oct 31 is still a draft, so that range starts at v0.23.1:
970 merged pull requests on Nov 12, about 131,000 characters at their
average line length, so the recovery would fail with the same 422. The
generated notes also carry no HERMES_BUILDS_TABLE marker, so the
builds table could never render into a recovered draft.

Recovery now drafts the --no-changelog body over stdin: title,
builds-table marker and changelog link.

* fix(release): link a recovered canary draft to its own repository

The recovered draft's only link came from generate_changelog's default
repo_url, NousResearch/hermes-agent, so a fork's recovered canary
pointed at a repository that lacks its tag. Build the link from the
repository the draft is created in, as the stable path does.

The cut path keeps the default: its commit lines link upstream pull
request numbers, which a fork does not have.

Raised by Greptile on #154321.
2026-11-12 14:48:36 -06:00
BearHuddleston
3944af0ea3 fix(bundles): build the Webapp in source desktop bundles too
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
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
`pnpm run dist:bundled` stages its payload through scripts/bundles/stage.py,
not the prepared desktop builder. Its automatic route compiled only the TUI
and dashboard, so a payload stamped `bundled` shipped no Webapp and
`hermes webapp` stopped at "This desktop app ships no Webapp renderer".

Install the Desktop workspace in the frontend snapshot, compile the Webapp
there and pass it to stage_native. The native staging child takes its
products as flags and only knew --tui/--web, so it also learns --webapp;
without that, handing it the Webapp exits 2 on an unrecognized argument.

The regression test runs stage.main through the real stage_native argv into
native.main and asserts the planted payload: red on the PR head (no
dist-webapp), red with stage.py alone changed (argparse exit 2).

Reported by @kvnloo on #154325, whose b294b532 changed stage.py the same way.

Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
2026-11-12 14:16:57 -06:00
BearHuddleston
f3ad28864a fix(bundles): ship the prebuilt Webapp in every desktop bundle
Desktop bundles (MSIX, Store, DMG/ZIP) plant prebuilt TUI and dashboard
products into the agent payload, but not the Webapp renderer, and the
payload drops apps/ and scripts/, so nothing in the app can build one.

desktop.py now compiles the Webapp with scripts/build/webapp.mjs from the
checkout whose apps/desktop dependencies the bundle job already installed,
and hands it to finish_native beside tui and web. The assembler plants it
at hermes-agent/apps/desktop/dist-webapp, where the gateway serves it.

- webapp.mjs gets the --source/--out CLI its sibling builders have.
  Compiling in place tripped its own overlap guard: the workspace's path
  relative to the source is '', which protected the whole checkout.
- The prepared payload's source digest ignores dist-webapp, as it does
  tui_dist and web_dist. Windows assembles the bundled and then the Store
  variant from one preparation; without this the Store pass fails with
  "prepared bytes changed: hermes-agent".

The renderer adds about 45 MB in 1,083 files to the payload, about 18 MB
deflated. It built in 23 s on linux-arm64.
2026-11-12 14:16:57 -06:00
unsupportedpastels
5c3421082d fix(gemini): replayed tool calls without a thought signature on Interactions
The Interactions API answers HTTP 400 ("Request contains an invalid
argument") when a model turn that calls tools does not open with a
thought step. A turn written by another provider has no signature to
replay, so a conversation switched to Gemini 3+ mid-session failed on
its first request.

Such a turn now opens with the placeholder signature Google accepts in
place of a real one, the same one the generateContent path already
sends. Turns that open with their own signature and text-only turns are
unchanged.
2026-11-12 14:32:53 -05:00
Maciej Lisiewski
5b7b470cc3 fix(ci): catch streamed downloads hidden by comments, blank lines or absolute paths
BuildKit drops comment lines and blank lines inside a RUN continuation, and a
top-level comment ending in a backslash does not continue; the guard joined
lines naively, so 'curl u \\ / # c / | tar' and '# c \\ / RUN curl u | sh' slipped
through. '| /bin/tar' and '| /usr/bin/sh' were missed by the matcher too.
2026-11-12 19:57:31 +01:00
Maciej Lisiewski
c321b8f406 fix(sandbox): verify the cua-driver tarball before extracting it
docker/sandbox-desktop.Dockerfile streamed the cua-driver release asset
straight into tar, so whatever the server returned became a root-owned
binary on PATH in the published default terminal sandbox. Fetch to a
file and sha256sum -c it against committed per-arch digests first, the
way the root Dockerfile already handles SQLite and s6-overlay.

Add scripts/ci/check_dockerfile_downloads.py (repo-guards step and
`scripts/check --only dockerfile-downloads`) so no tracked Dockerfile
can pipe a download into an extractor or interpreter again.

Fixes #126942

Co-authored-by: Yuan Li <dskwelmcy@163.com>
2026-11-12 19:55:14 +01:00
Maciej Lisiewski
02e67b7361 Merge pull request #154135 from NousResearch/sec/80096-whatsapp-bridge-auth
fix(whatsapp): require a per-session bearer on the bridge HTTP API; adopt a running bridge only after it proves the secret
2026-11-12 15:42:42 +01:00
Maciej Lisiewski
ccb6562066 Merge pull request #154129 from NousResearch/sec/81525-node-tarball-owner
fix(install): don't adopt the uv tarball's uid on root bootstrap
2026-11-12 15:42:23 +01:00
Teknium
d92c31ae65 feat(catalog): weekly check delists entries whose repo or pin is gone
A catalog entry whose repository was deleted, or whose pinned commit was
force-pushed away, can't be installed any more: `hermes plugins install` clones
the repo and checks out the pin, and both fail. Nothing noticed until a user
hit it.

scripts/ci/catalog_dead_repos.py looks up every entry (GitHub in GraphQL batches
of 50, with REST confirming each miss so a renamed or transferred repo is never
taken for deleted; other hosts via git ls-remote). Any unclear answer, or more
than 25 dead at once, aborts with nothing delisted, because that shape is an
outage, not a week of deletions. The weekly workflow deletes the dead entry
files on bot/catalog-dead-repos and opens one PR for review; nothing
auto-merges. It delists (deletes the file) and never touches removed.yaml,
which is the security blocklist.

First run, on today's catalog: 8 of 2,087 entries are dead (7 deleted repos,
1 force-pushed pin). Their files are deleted in a separate commit.
2026-11-12 02:21:17 -08:00
kshitijk4poor
0b29d8fe75 fix(config): stamp migrations to the last step that succeeded
A step that raised was logged and skipped, then migrate_config stamped the
latest version, so the step never ran again (v21 on a nested list in
plugins.disabled: plugins stayed off for good). Boot could not keep partial
progress either: any stamp below latest counted as a failed migration and
restored the backups.

- run_migrations stops at the first failing step and returns it; the
  stamp moves only to the step before it. Later steps wait, so a one-time
  step never runs twice over a value the user set in between. An
  unversioned file that fails stays unversioned.
- Boot keeps the steps that succeeded, records the failing step, and
  retries it on every start of the same revision (one warning per start,
  also kept for the next visible turn). Docker does the same.
- hermes doctor says why the version is behind, and --fix reports a pass
  that stopped instead of "migrated".
- A config stamped by a newer build runs no step, keeps unknown keys, and
  refuses whole-file saves; key-level writes (config set) still save.
- The remote backend migrates in memory and never writes back, so it
  keeps running the whole ladder.
- disable_suspicious_mcp_servers moves to config_migrations (size cap).
2026-11-12 14:09:07 +05:30
Teknium
9a735ca353 ci: run the cwd-restart Telegram E2E in the messaging-gated job
It probes for the real python-telegram-bot, which only the e2e job installs
(tests/ci/test_messaging_gated_selection.py).
2026-11-12 00:32:41 -08:00
Teknium
d5cf6deff4 ci: route gateway_runtime_start to the update suites now that the pause replay imports it
tests/ci/test_update_ci_routing.py requires every module an update entry point
imports to start its suite; _relaunch_bare now imports strip_supervisor_markers.
2026-11-11 23:20:47 -08:00
Teknium
a2620368c0 ci: run the paused-/new Telegram E2E in the messaging-gated job
It probes for the real python-telegram-bot, which only the e2e job installs
(tests/ci/test_messaging_gated_selection.py).
2026-11-11 23:09:40 -08:00
Teknium
753ea6bb16 fix(update): a sibling profile's gateway restarts with its own credentials, not the updater's
`hermes update` respawns each profile gateway through a detached restart
watcher that hands its own env to the gateway it starts. For a named
profile the watcher inherited the updater's os.environ, which already
holds the updater's profile .env. A profile with no TELEGRAM_BOT_TOKEN of
its own (an API-only profile) then started the root bot and took its
polling lock, and the default gateway's Telegram failed with "token
already in use".

The watcher env now follows the rule update_cmd_posix_pause._replay_env
already uses for the same respawn: the launcher's own named profile keeps
the launcher's env (an exported token may be its only credential); any
other home gets that home's own secrets via served_profile_child_env and
none of the launcher's. The host path is unchanged.

The env choice moves into hermes_cli/gateway_restart_env.py
(hermes_cli/gateway.py is over its line cap).

Fixes #135792.
2026-11-11 22:40:06 -08:00
Teknium
9788899694 fix(plugins): publish the path-check and YAML helpers reviews tell authors to use
Catalog reviews ask plugin authors to refuse credential paths with
agent.file_safety.get_read_block_error / raise_if_read_blocked and to read
YAML with hermes_yaml (core ships no PyYAML). `hermes plugins validate`
then warned on exactly those imports as "private core imports", so an
author who followed the review got a warning for doing so.

- plugin_api.json lists the four file_safety checks and
  hermes_yaml.safe_load/safe_dump; public-api.md regenerated.
- plugins/index.md gains a short section with the table and an example.
- boundary_lint baseline drops the 7 bundled-plugin crossings that are now
  public (no other line changes).
- Test: the guide's example validates clean, while a whole-module
  `import agent.file_safety` still warns. Red on main.
2026-11-11 22:17:18 -08:00
Teknium
9dc7e6a524 fix(ci): reject text files stored with CRLF line endings
.gitattributes asks git to store text with LF, but only a client that
honours it does: a GitHub web upload or an API commit lands bytes as sent.
plugin-catalog/board-insights.yaml arrived that way. Every fresh checkout
then showed it as modified, and the icon check (which needs a clean tree)
failed on every catalog PR until #154171 rewrote it.

- scripts/ci/check_line_endings.py reads `git ls-files --eol` and fails on
  any index blob that is crlf/mixed, except -text (binary) and eol=crlf
  (*.ps1) paths. `--fix` rewrites offenders with LF and stages them.
- Runs as a Repository guards step and as `scripts/check --only
  line-endings` (so the pre-push hook catches it locally too).
- `* text=auto` catch-all in .gitattributes, so text files outside the
  listed extensions are normalized at check-in too (renormalizing the
  whole tree with it changes nothing but the file below).
- Fixes the one remaining offender:
  contributors/emails/uperLu@users.noreply.github.com.

Co-authored-by: lancelotsh51sh <283335493+lancelotsh51sh@users.noreply.github.com>
2026-11-11 18:50:11 -08:00
Maciej Lisiewski
3bab836278 test(whatsapp): spawn bridge.js and pin every route but /auth-proof behind the bearer gate 2026-11-12 03:08:13 +01:00
Maciej Lisiewski
86c9bd9e53 test(whatsapp): passkey bridge test spawns with a session token; port-release probe refuses like a free port
bridge.js now refuses to serve without HERMES_WHATSAPP_BRIDGE_TOKEN, so the passkey
test (added on main) exited 1 before reaching the passkey path. The port-release
harness modelled a refused connect as a bare OSError; a refused connect is
ConnectionRefusedError/ClientConnectorError, and any other failure is now an
unproven holder that is never killed by port.
2026-11-12 03:08:12 +01:00
Teknium
57893add23 fix(whatsapp): challenge-first bridge auth on current main; cron senders read the token, bridge refuses without one
Builds on @fangliquanflq's #83432 (cherry-picked first commit; the remaining
eight commits were re-applied by hand because the adapter has since been
refactored into _probe_bridge_health / _reuse_running_bridge / _bridge_req /
_standalone_send). Port prompted by qwibitai/nanoclaw#4013, which closed the
same class (an unauthenticated loopback webhook) on their Discord bridge.

Why: the bridge binds 127.0.0.1 and checks the Host header, but loopback does
not identify the caller — any local process could GET /messages (read every
inbound) or POST /send (send as the user), and a process that bound the port
first and mirrored /health with the derivable scriptHash was adopted as the
bridge (#83395, #80096).

What:
- bridge.js: every route except GET /auth-proof requires
  `Authorization: Bearer <HERMES_WHATSAPP_BRIDGE_TOKEN>` (constant-time);
  /auth-proof answers HMAC(token, challenge); express.json() runs only after
  the gate; the bridge exits when spawned without a token; bridge_auth.js is
  folded into scriptHash so stale auth code is never adopted.
- adapter: per-session secret at platforms/whatsapp/session/.bridge-token
  (0600, created once under a cross-process lock), passed to the spawned
  bridge via env; _probe_bridge_health is challenge-first so an impostor
  never sees the bearer and is replaced; the long-lived aiohttp session
  carries the bearer as a default header, so every send/edit/media/typing/
  read/poll call is authenticated with no per-call-site change.
- _standalone_send (cron / `hermes send` out of process): READS the persisted
  token, never mints one (a bridge spawned without it would not know it) and
  reports "No WhatsApp bridge token" until the gateway has started once;
  pinned to 127.0.0.1 like the bridge's bind.
- docs: whatsapp.md "Bridge API authentication" + env-var reference row.

Live repro (real bridge.js + real impostor HTTP server, real aiohttp):
  origin/main: anon GET /messages 200, wrong bearer /health 200,
               impostor accepted by probe = true
  this branch: anon GET /messages 401, anon POST /send 401, wrong bearer 401,
               adapter probe real bridge ok=true / wrong token ok=false,
               impostor accepted = false, impostor saw bearer = false,
               impostor requests = [/auth-proof] only
Tests: 2 impostor invariants + adopted-with-bearer in test_whatsapp_stale_bridge
(red on origin/main adapter, green here); token lock + proof binding in
test_whatsapp_bridge_auth; standalone harness answers the challenge.
2026-11-12 03:08:11 +01:00
fangliquanflq
0494ea5a8a fix(whatsapp): authenticate local bridge API
(cherry picked from commit 2e0c5ba343849dba7217f5dd58b484ea89074123)
2026-11-12 03:08:11 +01:00
Maciej Lisiewski
b8ea6fe1ad fix(install): don't adopt the uv tarball's uid on root bootstrap
As root, tar restores the owner recorded in the archive, and astral's uv
release tarballs record uid 1001. A root install.sh / setup-hermes.sh
run therefore staged the uv binary root executes owned by whichever local
account holds uid 1001. Extract with -o (no-same-owner; the only spelling
busybox tar without long options accepts).

The Node tarball path the issue names now goes through pm.store's tarfile
data filter, which already drops archived owners.

Fixes #81525
2026-11-11 23:50:31 +01:00
Anthony Holten
8f12eb61fd fix(read_file): drop the SQLite extractor change; production never opens a live store
read_file fetches document bytes through the file backend (a `base64 <
path` subprocess) and extract_document_bytes runs _extract_sqlite on a
private temp copy, so the extractor never opens a live database. The
guarded header read cost more than it protected: it held _live_lock
across the open (a FIFO named *.db would stall every tracked open/close)
and folded missing-file, directory and permission errors into one
message. Restore tools/read_extract.py and drop its tests.

Also name DEFAULT_DB_PATH, _default_db_path() and session_db.db_path
among HX015's documented misses.
2026-11-11 17:20:00 +01:00
Anthony Holten
c50101e5f5 fix(state): route in-process state.db opens through connect_tracked
has_live_connection() and offline_file_access() decide when raw byte I/O
on a live database is safe (closing any raw fd cancels the process's
POSIX locks on the file; #100519). They only see connections opened
through connect_tracked, and several in-process readers used a bare
sqlite3.connect. The read_file SQLite extractor also open()/close()d the
file to check its magic bytes, which cancels the gateway writer's locks
when the agent reads its own state.db.

Route those opens through connect_tracked with tracking_path (same
URIs, timeouts and flags): gateway readiness, the lifecycle ledger's
integrity and journal-mode reads, the API server response store, the
spillover reference scan, install state, doctor, the repair damage
check, shared metrics, the worktree liveness reads cron's sweep runs in
the gateway, backup verification, the restore destination and epoch
reads, the downgrade guard, approvals suggest (whose hand-built URI also
skipped percent-encoding) and the journal-mode switch. The read_file
magic check goes through read_header_bytes_preopen. Offline opens
(snapshots, staging copies, the stdlib-only backup copier) take a
documented HX015 waiver.

Add HX015, "untracked sqlite3.connect on state.db", an advisory
heuristic rule until a replay shows it can block.

Fixes #149276
2026-11-11 17:20:00 +01:00
Ben Barclay
1bd13ebac8 feat(scope): the scope names the agent's owner and role; a turn carries its fence
A Scope now says who owns the agent and what the activity may do on it, and a TurnScope says
which claim the turn runs under:

- Scope gains keyword-only owner (Principal for a personal agent, Group for a shared one) and
  role ("owner" | "manager" | "member"). A personal agent is used only by its owner, so its only
  role is "owner"; a group agent's roles are "manager" and "member". can_administer is true for
  owners and managers. A hosted scope must name both; a local scope defaults to the local person
  as owner with role "owner", so every local caller is unchanged.
- TurnScope gains fence: Fence(epoch, generation), the owner epoch and runtime generation the
  admission claim stamped. bind_turn(session, turn, fence) requires it; claim_fence(row) reads it
  off a claimed session_admissions row. The authority's turn path, the owner-side cron run and
  the managed worker bind the real fence.
- Inside a hosted scope a bind must keep tenant, agent, actor, owner and role; changing any of
  them raises ScopeSwitchRefused.
- bind_profile_scope / scope_for_profile drop the unused turn= tuple: a turn is marked only with
  bind_turn, which has the fence.

Tests that executed a never-claimed admission row now claim it first, as the drain does
(tests/gateway/session_claims.py); hand-built cron rows carry the claim's columns.
2026-11-11 09:54:19 -05:00
Ben Barclay
b738747fe8 docs(code-health): HX016 grandfathers an existing setter call even when its function changes
The rule text promised migration when a function is next edited; the ratchet compares lines, so an
edit around an old call never required it. Say what it does, and pin it with a test.
2026-11-11 09:44:33 -05:00