v0.22.5 makes the control listener mandatory: the gateway refuses to start without it. On the
documented Docker layout (HERMES_HOME bind-mounted from the host) a Docker Desktop / virtiofs
mount answers EOPNOTSUPP, both for a new socket and for a stale socket inode an earlier container
left behind (it can be neither stat'ed nor removed from inside). The bind failed, start() returned
False, and the gateway shut down with "gateway session bootstrap control listener unavailable",
crash-looping under its restart backoff (#123761).
When binding in-home fails with EOPNOTSUPP/ENOTSUP, the server now listens on the same private
temp-dir socket + gateway.sock.path pointer an over-long home already uses, so every existing
protection applies unchanged: the 0700 hermes-gw-<hash> directory (squat-proof mkdtemp root when
the shared name is not private), the 0600 socket under a 0177 umask, the atomically published 0600
pointer, owner-identity cleanup, and the discovery client's pointer/peer-uid validation. Any other
errno still fails; EADDRINUSE (a live sibling) is never shadowed. The legacy client treats an
un-stat-able in-home path as absent instead of raising, and the start() warning no longer calls the
failure non-fatal.
Salvaged onto current main from #101337 by @jonpol01 (rebuilt on the private-directory,
squat-proof and atomic-pointer code that landed after it).
The gateway accepted on its fallback control socket and then created
gateway.sock.path with O_CREAT|O_TRUNC before writing it, so a client
polling for the starting owner (every CLI cold start) could read an empty
pointer and report 'Gateway inaccessible: invalid_control_pointer'
instead of waiting. Write a mkstemp sibling and os.replace it into place:
the pointer is now absent or complete, never empty.
The control socket's forwarded-subject gate and the history login label
each re-parsed authenticated_subject's auth:v1:[provider, issuer, user]
format. parse_authenticated_subject now sits beside
authenticated_subject and both callers use its checked result; the
issuer-less label restriction stays in _login_label.
Also pins the per-login owner check: a forwarded subject for login bob
is refused (and cannot claim) a Desktop row stamped basic:alice, and
alice still owns it.
Review finding on #140191 (Greptile)
Refs #134889 (session-writes-backend)
The forwarded subject now has a meaning authorize_history trusts, so a bare
peer-named label (admin, uid:501) could collide with another stored owner
representation — the invariant test_private_control_peer_mints_profile_bound_ticket
guards. Fail closed on anything but authenticated_subject's auth:v1:[provider,
issuer, user] form; the standalone forward only ever passes that.
(cherry picked from commit fdf6e0200565d7d94f0251718512f43d8e195ce0)
The owner-forward's ticket was minted over the peer UID, so a cold row owned
by a dashboard account (authorize_history compares the actor subject against
the stored owner) answered permission_denied even for the right logged-in
user. Let a verified same-user peer name the principal it acts for in the
session-ticket mint (fail-closed on anything malformed); the standalone
forward passes its authenticated subject through, and the native-transport
claim registration is unchanged.
(cherry picked from commit e3a5b0040c6119b24dbd1a33585c718d5a8c150d)
`hermes gateway restart` on a manual or client-started gateway printed
"Supervisor did not relaunch the gateway", exited 1, and left no gateway
running; cron and bots stayed down until some client auto-started one.
The session runtime protocol reports a manual or Desktop-spawned gateway as
`supervisor: "none"` (5a13562d66), but the control socket's local readers still
expect the launch value:
- gateway_declares_external_supervisor treated anything but "manual" as an
external supervisor, so restart SIGUSR1'd the gateway and waited for a
relaunch nobody would do.
- _drain_manual_gateway refused profile-data cleanup with "none gateway
still owns <home>".
- `hermes update`'s inventory recorded the gateway's supervisor as "none"
instead of classifying it.
The identify answer now also carries `launch_supervisor` (what
_detect_supervisor saw), and gateway.control_socket.launch_supervisor() gives
the three readers that value. The protocol `supervisor` field is unchanged for
client discovery. A gateway from before this change that answers only "none" is
unknown, never "manual": restart falls back to the --external-supervisor argv
check, cleanup keeps refusing, and the update inventory classifies the PID.
Refs #134889
17 conflicts, all from main's lint sweep (ruff UP007/UP017/UP022/UP028/UP031/UP037/UP041,
FURB188/FURB192); no other main commit touches a conflicted file. Resolution: the branch side
of each file plus main's exact autofix (ruff 0.15.10, main's ruff.strict.toml, --fix
--unsafe-fixes). ruff.strict.toml takes main's copy. The pool-retirement live fixture stays
deleted with the pooled backend this branch retires.
andrexibiza W1 (P0): a multiplexed gateway serving alpha + beta let a ticket minted for alpha
read beta's live sessions. `AuthorityConnection._sibling_for` copied the connection identity,
rewrote profile_id/instance_id to the sibling named by a `profile` param and carried the
operator capability over, so `session.list` / `session.resume` (and the submit/mutate/control
verbs on the same dispatch map) with `profile: 'beta'` answered from beta's authority. No beta
grant was ever presented. Reproduced on r6-base against a real `hermes gateway run`
multiplexer: alpha-bound and root-bound tickets both list and resume beta's session.
Root cause: the grant had no notion of profile reach; every ticket was implicitly host-wide.
Fix: the reach is now part of the grant. `TicketStore.mint(scope=...)` stamps `scope` =
'profile' (default) or 'host' (interactive purpose only). The control socket's closed
`session-ticket` params accept an optional `scope`, and run_api carries it into the connection
identity as `profile_scope`. `_sibling_for` routes to a sibling only under a host-scoped grant;
a profile-bound ticket naming any other profile gets `profile_mismatch`, the same answer an
unserved profile gets. No profile_id is rewritten for a profile-bound grant.
Legitimate cross-profile flows are kept, and each one asks for host scope explicitly:
- Desktop shared-primary socket (main routes every local profile onto the one host socket
with a `profile` param, #118246/#120005): `mintLocalGatewayTicket` and the Python ticket
bridge request `scope: 'host'` for the interactive purpose. native-http stays profile-bound;
its `?profile=` reads already mint for the routed home.
- The dashboard `/api/ws` sidecar (already behind the dashboard gate, operator=True, REST
`?profile=` host-wide) is stamped host scope.
- The CLI, Ink TUI, ACP, cron, Kanban, bot relay, A2A and worker store only ever select their
own profile, so the default profile-bound ticket covers them unchanged (own-profile
selectors still succeed).
Red/green: tests/gateway/test_ticket_profile_scope.py fails on r6-base (alpha ticket's
session.list profile=beta returns beta-private) and passes after. It covers
list/resume/submit/interrupt/mutate/create for alpha- and root-bound tickets, own-profile
success, unserved profile_mismatch, the host-scoped sibling route, and refusal of host scope
for non-interactive purposes. The Desktop vitest pins the `scope: 'host'` wire field on both
mint paths.
Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5460639040
Cross-profile hosted observation (HostedRoomOwnerRPC._watch) polled the
`history` producer operation every 0.25s, which returns the member session's
FULL transcript plus terminal receipts in one private control-socket line
capped at 512 KiB. Once a member conversation grew past the cap the server
answered the unstructured `response too large`, owner_request folded every
unknown reason into `runtime_draining`, the watcher thread exited with its
callbacks retained, and the driver's explicit history recovery hit the same
cap: a completed, durably stored turn could never be observed.
- New `results` hosted-producer operation (in _OPERATIONS, so attested at the
source owner like every other verb): terminal receipts only, never the
transcript, optionally narrowed to the admission ids whose callbacks the
watcher holds, each text clipped just past the driver's persisted
MAX_TERMINAL_TEXT_BYTES bound (so its truncation and notice are unchanged),
newest first under a 384 KiB budget.
- The watcher polls `results` for its pending admission ids; delivery stays
exactly-once (callbacks are popped under the lock by whichever read sees
the receipt first).
- HostedRoomOwnerRPC.history falls back to the bounded receipt rows when the
full history response is too large, so driver recovery
(_find_terminal_receipt matches only receipt rows) still settles.
- The control socket's oversize envelope is structured
({"ok": false, "error": "response_too_large", "code": ..., "limit": N,
"protocol", "id"}) and owner_request maps it to
RuntimeStoreError('response_too_large') instead of runtime_draining.
No caller string-matched the old text.
Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6067585232
Homes whose direct socket path exceeds sun_path bind under the predictable
$TMPDIR|/tmp/hermes-gw-<sha16(home)>/. Any local user can pre-create that
name; start() then refused it as unsafe and returned False, and the
session bootstrap treats a missing control listener as fatal ("control
listener unavailable"), so another account could keep the gateway down.
Prefer $XDG_RUNTIME_DIR (only when it is an absolute, owner-only directory,
as the spec promises) so the name lives where nobody else can create it.
When the shared-temp name is taken by something not private, bind instead
under a fresh mkdtemp root in the same temp dir, keeping the
hermes-gw-<hash>/control.sock leaf that clients (Python discovery and the
Desktop resolver) authenticate through the owner-only pointer file; the
root is removed on stop.
(cherry picked from commit b30c9a0ac0272658f69330d2653e21b01864c6a9)
query_identify, gateway_client._session_ticket, the Ink gateway_bootstrap
script and session_hosted_transport.owner_request validated the socket
path with lstat and then connect()ed by path. connect() follows a symlink
swapped in after the check, so a writer to the home could stand up an
impostor listener and hand clients its own api_origin (the earlier probe
got {"api_origin": "http://127.0.0.1:6666"} back from query_identify).
None of them asked the kernel who was listening.
Add gateway_runtime_discovery.connect_private(): validate the path, connect,
then require SO_PEERCRED (Linux) / getpeereid (macOS) uid == getuid(),
raising DiscoveryError("unsafe_control_peer") otherwise. All four clients
dial through it. The server's peer-subject check reuses the same
socket_peer_uid() so the platform branches live in one place. Platforms
with neither API keep the path checks only, as documented on the helper.
(cherry picked from commit 69b768f6bc82728395964b74bed3ad7dd98a0544)
home_mode_unsafe accepts group-write when the owning group is the owner's
private group. With an access ACL the stat group bits are the ACL mask, so
`setfacl -m u:nobody:rwx` on a 0700 home reads as 0770 and was accepted
even though another account can now swap the control socket.
When group-write is set, check os.listxattr for system.posix_acl_access
and treat the home as unsafe if present. Only ENOTSUP/EOPNOTSUPP (no xattr
support, so no ACL possible) counts as "no ACL"; any other listxattr error
fails closed. Both the client discovery check and the server's peer-subject
check pass the path through.
(cherry picked from commit a5c39fe70c5128d45a66b3e28cf2c19cc7c74a7b)
Main wrote gateway.sock.path with write_text under umask 022 (mode 0644)
and a crash leaves it behind. The listener reopens it with
O_CREAT|O_TRUNC, whose mode argument only applies to a new file, so the
pointer stays 0644 and every client refuses discovery with
unsafe_control_pointer forever after an upgrade.
fchmod the descriptor to 0600 before writing so a restart repairs it.
(cherry picked from commit 59858c85aaad9dcf4249538112f1033fa364f3f5)
GatewayControlServer._posix_peer_subject refuses whenever
home.absolute() != home.resolve(), and the server kept the home exactly as
given. A gateway launched with a symlinked HERMES_HOME (or a symlinked
default ~/.hermes) therefore never produced a peer subject: discovery said
"ready" and every session-ticket request failed with "authenticated runtime
bootstrap unavailable". The PR promises a symlinked ~/.hermes keeps working.
Resolve the home once in __init__, the same canonical form clients already
dial (gateway_runtime._canonical_home). The symlink refusal still guards
against a home swapped to a symlink after start.
(cherry picked from commit 04b24405a6411b0c913098992bf845e51104c2f3)
`_query_windows_pipe` reads a synchronous pipe handle that has no settimeout,
so `_read_response_line`'s deadline is only checked between chunks: a peer
that accepts and never answers (a wedged gateway, or this gateway dialling its
own pipe from its own loop thread, #132547) blocks the caller forever. The
POSIX twin is already bounded by sock.settimeout and degrades to None.
Run the pipe exchange through the existing agent.deadline.run_bounded_sync so
every Windows caller of query_gateway_control (identify, pause, rescan, serve,
...) gets the same `timeout` bound and falls back to the scan layer on expiry.
A timed-out exchange abandons one daemon thread until the pipe read returns;
that is bounded by the number of stalled dials, not per-item hot loops.
Refs #132547.
Main's restored live named-pipe test found identify returning None against a live
GatewayControlServer: its Windows server is the PR's native overlapped pipe worker, and the
bare open() client got no answer. Route through query_runtime_control, which also verifies
the server's SID (update/cleanup/profile-identity consumers were silently falling back).
umask 002 with user-private groups (Ubuntu's default) makes an operator-created symlink target
0775; the group holds only the owner, so it cannot swap the socket. World-write and group-write
on a shared group are still refused.
- hermes -z submits finite+unattended: main's oneshot ran with HERMES_YOLO_MODE (nobody can
answer a prompt); the daemon mapped it to single-query deny, so execute_code/dangerous
commands were blocked. -q keeps approvals.single_query_mode. unattended is only admitted
with finite and binds for that turn alone.
- Control-socket discovery and the owner's peer check refuse group/other WRITE on the profile
home (the socket-swap vector) instead of any group/other bit: main leaves modes beyond a
directory link and HERMES_HOME_MODE to the operator, so a symlinked ~/.hermes (or 0750/0701)
could not reach the gateway at all. Sockets, pointer and fallback directory stay owner-only.
- test_approval redaction tests pin the launch-snapshot switch (order-dependent otherwise).
Merge #8: 2,771 commits from main (4b05f764fa). Ports main's moved code into the
unified runtime (run.py/run_turn.py splits, tui_gateway server, backup/restore
split), keeps the detached-daemon Desktop lifecycle, and adapts main's new tests
to the owner/authority contracts (canonical session deletes, retired-id
tombstones, zero-writer browsing, hermes_yaml, platforms() markers).
Under the host multiplexer every installed named profile came online because
its directory existed, and the only way to stop one profile's bots was to stop
the host, which stopped everyone's. Both are fleet-operator blockers.
`hermes -p X gateway stop` on a profile served by the host now parks it: it
writes `profiles/X/gateway.parked` first (so the 30s reconcile cannot re-add X
between the verb and the marker) and sends the new `unserve-profile` control
verb, which tears down X's adapters, reconnects and cron inside X's own scope
(the teardown `_unserve_profile` already used for deleted profiles). `start`
removes the marker and sends `serve-profile`, which runs the same add-path the
reconcile loop uses. `restart` cycles both without parking. The default
profile keeps today's whole-host meaning.
`profiles_to_serve()` skips parked profiles, so adapters, cron, ingress
membership and the served record follow from one chokepoint; roster callers
that mean "every installed profile" (plugin deps, Windows update, dashboard
listing and topology, migration inventory) pass `include_parked=True`.
Provisioning may pre-create the marker: an installed profile stays offline
until an operator starts it. Host boot logs one INFO per parked profile;
`gateway status` shows `parked (hermes -p X gateway start)`.
Tests: profiles_to_serve contract, control verbs through the runner
(round-trip and every refusal), CLI marker-before-socket ordering, reconcile
honouring the marker both ways, migration inventory retaining parked
profiles, two-home E2E through the real loaders.
The salvaged #119607 taught only the drain cap (launchd_service_label) to read
HERMES_LAUNCHD_LABEL. The gateway grandchild under the generated plist also
reads XPC_SERVICE_NAME=0 in is_gateway_supervisor_process (exit-75 restart
route) and control_socket._detect_supervisor (identify payload), so one
process was "launchd" to the drain cap and "manual" to the restart route.
One seam: gateway.restart.launchd_job_label applies the ai.hermes predicate to
XPC_SERVICE_NAME then HERMES_LAUNCHD_LABEL; the drain cap, the restart route,
the control socket and the wrapper's export all call it. launchd_service_label
and read_launchd_exit_timeout_s take `platform` as data so the mapping is
tested on Linux without patching sys.platform (AGENTS.md: don't fake the host
OS); the salvaged tests are trimmed to two invariants each and lose their
monkeypatch of sys.platform.
Not live-run: this host is Linux, launchd is code-path + wrapper-subprocess
proof only.
A plugin that finished loading after an adapter connected never got its platform
handlers (slash commands, button callbacks, inbound transforms) registered until a
gateway restart, silently. Three pieces, one seam shared by every surface:
1. Discovery listener: PluginManager.on_plugin_loaded(cb) fires from INSIDE
discover_and_load for the plugins a sweep newly loaded (diff of the loaded set),
with a per-plugin activation summary (hermes_cli/plugins_activation.py):
activated_now {gateway_commands, gateway_transforms, hooks, callbacks} vs
deferred {tools, prompt, mcp_servers}. Every mid-run load path now performs a real
discover_plugins(force=True): CLI install/enable (via the gateway), Desktop/TUI
plugins.manage install/toggle/update, dashboard REST install, tool-triggered
force re-discovery, the new `reload-plugins` control-socket verb. A non-forced
discover_plugins() short-circuits on _discovered, which is why reload.mcp after
a mid-run install used to reload the OLD server set.
2. Idempotent re-wire: BasePlatformAdapter.rewire_plugin_handlers() runs only
factories not yet wired on the live native client (keyed (plugin, qualname);
a force reload hands back new function objects). Telegram hoists late handlers
ahead of core's catch-all filters.COMMAND / CallbackQueryHandler (PTB dispatches
the first match per group) and re-wires on the transient-init rebuild; Slack
dedupes register_slack_action_handler per AsyncApp. The gateway runner
subscribes per served profile and re-wires on the loop.
3. Scope limit + honest messaging: handlers only. Tools/prompt stay deferred to
the next session (prompt-cache invariant), MCP servers to mcp.reload; the CLI
hint and plugins.manage results (activation, gateway_reloaded,
restart_required only when no gateway answered) say exactly that.
Resolved toward the branch: PM provisions uv/python (main's install.ps1 uv-shim
salvage + its test and workflow steps dropped), the shim re-exec stays retired,
package.json carries no electron-builder block (afterExtract identity stamp wired
into electron-builder.config.cjs instead; after-pack.mjs keeps signing only),
Desktop workspace-deps helpers stay retired. Main's scratch-dir bootstrap
(export_scratch_tmp_env) is taken and re-run after profile resolution.
The seventeen remaining literals are container-side paths, AF_UNIX socket-path-limit
candidates on darwin, detection needles, guard regexes and guidance text that tells the
model to avoid /tmp. Each carries an inline `no-tmp: ok — <why>` so the reason lives
next to the line; the baseline keeps only a fenced tree listing where a marker would render.
Reconcile plugin declarations and validation through PM's atomic generation publication; preserve external runtimes, target markers, and conflict refusal. Keep one source-update completion owner and port upstream lifecycle changes to the PM desktop/runtime paths.
`hermes profile delete` removes the profile directory and tears its runtime down, but the name is
also baked into durable identity the delete path never touches — `agent:<name>:*` routing keys,
`gateway_heartbeats.profile` and `delivery_obligations`. An inbound event on a chat keyed to the
dead name then enters the routing index, resolves a profile whose directory is gone, and logs
`Profile '<name>' does not exist` on every event for the life of the store (the #111926 flood,
reached from a *deleted* rather than a renamed profile). The delete side is now symmetric with the
rename rekey (`rekey_profile_state` / `rekey_profile_routing` / `migrate-profile-identity`), with
the same ownership rule:
- `SessionDB.purge_profile_state(name)` — the mirror of `rekey_profile_state`, in one
`_execute_write` transaction. Routing keys, heartbeat rows and the telegram topic rows the rekey
also owns are hard-deleted (a binding is matched by `profile_name` OR its `session_key`
namespace, because the rename rewrites both); `delivery_obligations` rows are terminalized
(`state='abandoned'`) rather than dropped, so pending delivery state is not lost silently.
- `SessionStore.purge_profile_routing(name)` — the mirror of `rekey_profile_routing`: drops the
in-memory entries and persists the drop. Mandatory, not belt-and-braces — the owning process
writes its in-memory copy back, so a durable delete made elsewhere is undone by its next save.
- A delete-only control verb `purge-profile-identity`, deliberately NOT inside
`_unserve_profile()`: that hook also unserves a rename's old name, whose identity the rekey still
has to migrate. `hermes profile delete` requires the owner's `{"ok": true}` answer and reports a
partial settlement (naming the retry) instead of a clean success.
- The retry is the new `hermes profile purge-identity <name>`. It refuses a name that is a live
profile again: the purge keys off the name alone, so `delete foo` (settlement pending) →
`create foo` → `purge-identity foo` would otherwise delete the NEW incarnation's identity. The
delete path tombstones the directory before it purges, so the guard never blocks the delete.
- `sessions` rows are not deleted by the purge: it settles identity, not history. What a delete
leaves of a profile's conversation record is `delete_profile`'s business — it removes the
profile's own home, `state.db` included.
Tests (`scripts/run_tests.sh`, red on base → green): `tests/hermes_state/test_purge_profile_state.py`,
`tests/gateway/test_purge_profile_routing.py`, `tests/gateway/test_profile_identity_purge.py`,
`tests/hermes_cli/test_profile_identity_purge_cmd.py` and `TestDeleteProfile` in
`tests/hermes_cli/test_profiles.py` — 95 passed, 0 failed across those five files.
Renaming a profile moved profiles/<old>/ to profiles/<new>/, so the row DATA
travelled with the directory, but the profile name is also baked into
keys/values the move left untouched: session keys (agent:<old>:* namespace),
sessions.profile_name (fail-closed owner ladder / Desktop sidebar scope /
@session: deep links), sessions.origin_json.profile,
gateway_heartbeats.profile, delivery_obligations (session_key +
adapter_profile), telegram_dm_topic_* profile_name bindings, and the
gateway_routing index. Left stale, every inbound event on a chat keyed to the
old name resolved to a profile that no longer exists — flooding errors.log
with "Profile <old> does not exist ... falling back to global HERMES_HOME"
every few seconds — and renamed sessions dropped out of the sidebar / broke
their deep links.
The routing index is held in memory by a live multiplexer and written back
periodically, so a CLI-side DB rewrite alone is clobbered. Fix in layers:
- SessionDB.rekey_profile_state: atomic durable rewrite of the state.db
tables, matching the agent:<name>: namespace by exact prefix (substr, not
LIKE — '_' is a legal profile-name character and a LIKE wildcard), rewriting
the profile inside routing/origin JSON, and REFUSING on a target collision
(routing rows or telegram bindings) instead of silently merging.
- SessionStore.rekey_profile_routing: rekey the in-memory routing index
(keys + origin.profile) then persist — the half a DB write cannot reach.
Raises on a target-key collision before mutating.
- Control verb migrate-profile-identity (params-carrying; the socket passes
params only to handlers that declare them, bare handlers unchanged) so a
live gateway rekeys its in-memory copy AND both durable stores (routing home
+ the renamed profile's own state.db).
- rename_profile calls the verb when a multiplexer is live and, if it fails,
does NOT fall back to a racing CLI-side write: it prints a warning telling
the operator to restart the gateway and retry. With no live gateway it
performs the durable rewrite itself (safe: nothing else holds the store
open).
Checkpoints keyed by the profile's workdir path are a known related gap,
tracked separately, not addressed here.
Tests: rekey_profile_state (all tables, routing/origin JSON, collisions,
idempotent, no-op), rekey_profile_routing (namespace + origin, no-op, no
overwrite), control verb param passing, and rename end-to-end for both the
live-gateway (delegates, refuses unsafe fallback) and no-gateway (durable
rewrite) paths.
Preserve upstream fixes without restoring retired dependency installers.
Run configured-feature checks in the selected build interpreter. Reuse a
supported base Python during bootstrap, and preserve durable backup media.
Refresh the dependency lock through PM. Keep the frozen historical import
surface unchanged. Adapt incoming native tests to the platform markers.
Verification: the incoming 86-file pass found two fixture mismatches;
both passed after correction. Targeted PM/update/compatibility checks,
Electron and renderer typechecks, and desktop tests passed.
Native Windows/macOS update journeys and the full suite remain unrun.
A `gateway.multiplex_profiles` gateway enumerated `profiles/` once at boot, so a profile
created afterwards (CLI, dashboard, Desktop, TUI) was never served until `hermes gateway
restart`; Desktop and the dashboard gave no reminder, so a new profile's bot simply never
connected.
The served set is now reconciled at runtime (`gateway/run_profile_reconcile.py`):
- `hermes_cli/profiles.py` create/delete ping the multiplexer over its control socket
(new `rescan-profiles` verb); a supervised watcher rescans every 30s as the safety net.
- A new profile gets its adapters under its own runtime scope from its config/.env
(`_start_one_profile_adapters`, same duplicate-credential guard as boot, now seeded
with the LIVE secondaries' claims), `served_profiles` in gateway_state.json is
updated, MCP discovery + log routing run for it. Other profiles' adapters are never
touched.
- A served profile whose config.yaml/.env changed is re-scanned so a token added after
create builds the adapter; already-live/queued platforms are skipped (no second poller).
- A deleted profile (tombstone) has its reconnects cancelled, adapters torn down,
pairing/busy bookkeeping and cached agents dropped, and this process's SQLite /
memory-store handles released so the deleter's rmtree succeeds.
- The in-process cron ticker takes a live enumerator so new profiles' jobs fire.
- PUT /api/messaging/platforms/<id>?profile=X returns `hot_served` when a live
multiplexer rebuilt X's adapters; Desktop/dashboard skip the restart banner then.
- `hermes profile create` confirms hot-serve; the restart reminder stays for a gateway
that did not pick the profile up (older build / signal failed).
Retain lock inodes on access failures, protect fallback socket directories, and fence old socket cleanup. Native Windows implementation uses a protected same-user DACL, local-only named pipes, caller/server SID verification and cancellable overlapped I/O. Native execution remains pending a Windows host; Linux final regression rerun is queued behind the campaign test lock.
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
Read text files with the encoding utf-8-sig so a BOM at the start of a
file does not cause a Unicode decode error (Windows editors add BOMs).
Reconstructed from ethie/pm commits 48a32b135b + 013219e814 onto the
current upstream/main base: only the utf-8 -> utf-8-sig transforms were
carried (370 exact line pairs across 205 files); pm-rename hunks that
rode in the original commit were left to the pm-store commit, and
utf8sig hunks entangled with content changes ride their owning commit.
Rebuilt on ethie/pm-clean off ac6c8028e0 (upstream/main).
Windows updates forced a choice between 'gateway survives' and 'update
proceeds': the pause machinery's only tools were the planned-stop marker
poll and the force-kill ladder, so a mid-turn gateway was tree-killed and
its active turn lost. Step 2 of the socket migration adds the
pause-for-update verb: the updater ASKS the gateway to drain in-flight
turns and exit cleanly — releasing every venv file handle on the way out
— through the same request_restart(via_service=True) drain path SIGUSR1
and service restarts already use.
- gateway/run.py: pause-for-update verb handler registered on the
existing control server; marshals onto the loop thread, ACKs with
{pausing, already_stopping, pid, drain_timeout}.
- gateway/control_socket.py: pause_gateway_for_update() client — None on
no-answer (older gateway / no socket), so every caller keeps the
legacy path when the verb is missing.
- update_cmd.py (_pause_windows_gateways_for_update): socket-first ask
per mapped profile gateway before the drain wait; positive ACKs extend
the wait to the gateway's own declared drain budget (+ teardown grace)
so a mid-turn gateway isn't force-killed at the end of a too-short
local default. Marker write + force-kill ladder retained verbatim as
the fallback.
Live E2E: real gateway process (isolated HERMES_HOME), real socket:
identify -> pause ACK {pausing: true} -> gateway drained and exited on
its own (rc=75, zero signals) -> dead-gateway re-ask returns None.
A step-1 gateway without the verb answers ok:false -> client None ->
legacy path (pinned by test).
- bind under umask 0o177 so the socket is never world-connectable, even
pre-chmod (review pt 3)
- verb handlers run in an executor: state-file reads stay off the
adapter event loop (pt 2)
- inventory dedupes one multiplex gateway answering identify for several
homes — one runtime record per pid, with regression test (pt 1)
- v1 wire contract (one request per connection) documented in the module
docstring (pt 5); /tmp-unwritable skip in the short-home test
Live-verified: perms 600 at bind, identify 4.3ms via executor path, 20
rapid queries healthy.