Commit Graph

1627 Commits

Author SHA1 Message Date
kshitijk4poor
57644ec000 fix(process): a family's stop path releases its group only once the group is empty
Same class as the router fix: nine stop paths released their group from the owner-death supervisor
as soon as the leader exited, but members that ignore TERM or outlive the leader keep the group
alive. Releasing it let those members survive a later kill -9 of this process.

Lightpanda, real-profile Chrome, embedded cua-driver, the TTS command provider, dashboard WhatsApp
pairing, the raft and WhatsApp bridges, verify's app server, agent-browser session groups, and
Browser Use harness daemons stopped by --reload now go through release_process_group_once_empty.

New test stops a raft bridge whose TERM-ignoring helper survives. It fails when raft releases
unconditionally, and the group stays covered with the fix. Test seams moved from the per-module
release_process_groups name to the shared helper.

Reported by Greptile on #137057 (thread on the router).
2026-10-29 16:58:09 +05:30
kshitijk4poor
6ff702ec0d chore(process): mark the agent/plugin detached spawns that are not owned children, with the reason
The detached-spawn check (scripts/check_detached_spawns.py, from the owned-child API) flags every
start_new_session outside spawn_owned. Five sites in this family are deliberately not owned. Each
now carries a `detached-spawn: ok — <why>` marker, so the check passes without a baseline entry:

- iron-proxy daemon: meant to outlive the CLI that started it; `hermes egress stop` ends it
  through the pidfile + nonce.
- google_meet bot: reached through files across turns and stopped by meet_leave (pid in
  .active.json).
- photon sidecar: exits on stdin EOF (PHOTON_SIDECAR_WATCH_STDIN). kill -9 probe with that exact
  watch block: 0 of 1 survived; the same probe with the watch off: 1 of 1 survived.
- ddgs search worker: awaited under a 30 s cap that kills its group. Blocked reading its request
  on a stdin pipe, it exits when the owner dies (kill -9 probe: 0 of 1 survived).
- secret_sources command helper: awaited under a hard timeout (default 3 s) that kills its group.

Comments only; no behaviour change.
2026-10-29 16:58:09 +05:30
kshitijk4poor
9c0641eb47 fix(raft): the raft bridge dies with the gateway that started it (orphans after kill -9: 1 -> 0)
`raft agent bridge` was a plain Popen child of the gateway. A SIGKILLed or OOM-killed gateway
reparented it to init, where it kept polling Raft and posting wakes to a channel endpoint nobody
serves, forever. The next gateway starts a second bridge beside it.

_spawn_bridge now starts it through process_identity.spawn_owned (its own group, handed to the
owner-death supervisor, recorded in the spawn ledger as "raft-bridge"), and _stop_bridge releases
the group once the bridge has exited (a bridge it failed to stop stays covered).

Measured on Linux, real adapter _spawn_bridge with a stand-in `raft` CLI, owner SIGKILLed,
6 s settle: origin/main 1 of 1 survived; this commit 0 of 2 descendants (bridge + supervisor).
New kill -9 / live-owner case and a _stop_bridge release test; reverting spawn_owned to the
main-era Popen turns the kill -9 case red. test_raft_adapter's multiplex test now patches the
adapter's spawn_owned seam.
2026-10-29 16:58:09 +05:30
kshitijk4poor
73804ca2f9 fix(whatsapp): the Node bridge dies with the gateway that started it (orphans after kill -9: 1 -> 0)
The bridge is spawned detached (start_new_session, via windows_detach_popen_kwargs) so a container
stop reaches it directly (#127047). Detached also meant a SIGKILLed or OOM-killed gateway left it
running forever: still holding the port and the logged-in WhatsApp session, serving a /messages
queue nobody polls. The next gateway's connect() only recovers it if the bridge reports the same
session, script hash and read-receipt config; otherwise it kills it through the pidfile or port path,
or with a foreign profile on that port refuses to start.

The bridge now starts through process_identity.spawn_owned (_spawn_bridge_process): it still
leads its own session, and its group goes to the per-process owner-death supervisor, so it dies the
moment the gateway dies, however it dies. disconnect() releases the group once the bridge has exited.
A bridge it failed to stop stays covered. Windows keeps its detach flags (windows_detach_flags)
and its taskkill tree kill unchanged. The pidfile / port reaping for bridges left by older versions
stays: it covers bridges this process never owned.

Measured on Linux, real node bridge stand-in, owner SIGKILLed, 6 s settle:
origin/main 1 of 1 bridge survived; this commit 0 of 2 descendants (bridge + supervisor).
tests/hermes_cli/test_owned_agent_subprocs.py: a real kill -9 owner and a live control owner
through _spawn_bridge_process (child + same-group grandchild gone in 15 s, the live owner's tree
untouched), plus disconnect() releasing the group. Reverting spawn_owned to the main-era Popen turns
the kill -9 case red. Existing connect / stale-bridge tests now patch the adapter's spawn_owned
seam instead of the global subprocess.Popen, which also starts the supervisor.
2026-10-29 16:58:09 +05:30
kshitijk4poor
1d90557426 refactor: the Discord approval card retires through the views' shared embed stamp
`ExecApprovalView.retire` repeated `_HermesView._expire_embed`: grey
the first embed, stamp the footer, edit the message. The only
differences were that retire removed the controls (`view=None`) and
logged a failed edit.

`_expire_embed` now takes `keep_controls` (default True, so the other
views' timeouts look the same as before), and retire calls it with
False. A failed stamp is now logged at debug instead of silently dropped, for
every view that stamps through it (approval, slash confirm, update,
clarify; the model and choice pickers have their own timeout edit).

Raised by review of #145948. The copied block came from 39b2158afc
(Gille, 2026-10-27, #145948).
2026-10-29 09:45:17 +05:30
kshitijk4poor
62c89c1894 refactor: the Discord approval card's timeout notice goes through edit_message
The gateway's timeout notice looked up the Discord-only
`expire_exec_approval` on the adapter's type by name and called it to
strip the card's buttons. That method duplicated `edit_message`'s
channel lookup, formatting and truncation.

Since #145948, every Discord approval card with a request id registers
a settle observer. A card whose request had already ended is retired
right after it is sent. On timeout, the observer's `retire("timeout")`
removes the buttons, so the notice only needs to replace the text.

`_edit_card` now always uses `edit_message`, and
`DiscordAdapter.expire_exec_approval` is gone. A timed-out card
therefore gets one button-removing edit instead of two, and core no
longer probes for a platform method by name.

`edit_message` is the streaming editor: content over the platform's
limit is truncated in place behind a dangling "(1/N)" marker, and the
adapter keeps a saturated-preview entry for it until a final edit that a
card never gets. After the timeout the card's text is the only record of
the command, so the body now gives the command whatever room the
adapter's per-chat limit leaves, measured in the platform's own units
(`max_message_length_for_chat` with `message_len_fn_for_chat`, so
Telegram's UTF-16 count is honoured). `_ea_fit`'s own copy of the
prefix bisection becomes `fit_prefix` in `gateway/platforms/base.py`, a
suffix-adding wrapper over the existing `_custom_unit_to_cp`, shared by
both. A run of three or more backticks in the
command would close the card's fence and let Discord's formatter rewrite
a table after it into a longer bullet list, so such runs are split with
zero-width spaces. The body is built inside `_edit_card`'s guard, so a
failure there still falls back to sending the notice.

The lifecycle test that races the timeout notice against `retire` now
drives the notice through `edit_message`; both orders still end with
the notice text and no controls. A new test drives the real
path, `_post_timeout_notice` → `_edit_card` → Discord's `edit_message`,
with a 5,000-char command, a heredoc holding fenced Markdown tables and
a run of seven backticks: one in-place edit that fills the message
exactly, only the card's own fence, no "(1/" marker, no preview entry,
no new message. Another fills a UTF-16-counting adapter with ASCII and
with emoji, and one whose limit lookup raises still gets the notice as a
new message. Removed the two tests of the deleted method; the two notice tests' fake adapters gain
`max_message_length_for_chat` and `message_len_fn_for_chat`.

Raised by review of #145948. `expire_exec_approval` and the probe came
from 4f86e97791 (Gille, 2026-10-27, #145948).
2026-10-29 09:45:17 +05:30
Teknium
67bce8c25d fix(slack): strip mention labels before emphasis parsing in rich_text
A labelled mention such as <#C1|dev_ops_alerts> or <!subteam^S1|@eng_team_x>
was split by the italic regex on its underscores before the leaf mention
split ran, so Slack showed the token literally with a stray italic run.
The label is dropped from the element anyway, so drop it up front.
2026-10-28 19:38:41 -07:00
Muneeb Anjum
a0f9c92bd7 fix(slack): render mentions as rich_text elements in rich_blocks
rich_text does not interpret mrkdwn, so <@U…>, <#C…>, <!subteam^S…> and
<!here|channel|everyone> tokens inside lists, quotes and table cells were
emitted as text and rendered literally. Split them into user/channel/
usergroup/broadcast elements at the emphasis leaf so surrounding bold/
italic/strike spans survive.

Fixes #133315. Squashed from #133323 (095821f, 53c8268, fcf7c97, 9fd0327).
2026-10-28 19:38:41 -07:00
Victor Kyriazakos
31d5f1d44d feat(whatsapp): log delivery and read status of sent messages to gateway.log
Baileys reports the delivery status of messages Hermes sends
(`messages.update` with `update.status` in 1:1 chats, a per-recipient
`message-receipt.update` in groups), but the bridge only handled poll
updates there, so operators could not see whether a reply was delivered
or read.

The bridge now queues a `delivery_status` event for status changes of its
own sends (tracked IDs only, so messages typed on the linked phone are
never reported). The adapter logs one gateway.log line per change and
never dispatches it as an inbound message.
2026-10-28 19:34:11 -07:00
Teknium
f3acd8ff33 fix(whatsapp): run the bridge reaps off the gateway event loop
The reaps now wait out a SIGTERM grace (up to 6s each) with time.sleep, and
connect() called them inline on the loop every platform shares, freezing
Telegram/Discord/etc. while a slow WhatsApp bridge exited. Run them via
asyncio.to_thread. The psutil-fallback test reads /proc of every process,
which names files under the real Hermes home on a box running Hermes, so
it opts out of the home write guard.
2026-10-28 19:21:20 -07:00
Teknium
7b90783f76 fix(whatsapp): keep main's TIME-WAIT-aware port_is_free for the respawn wait
Replaying the branch onto main linearly resurrected port_accepts_listen, the
duplicate helper the branch dropped when it merged main (#140186 already
gives port_is_free the bridge's SO_REUSEADDR semantics). Restore the merged
tree: one helper, one contract.
2026-10-28 19:21:20 -07:00
unsupportedpastels
fb45657d55 fix(whatsapp): don't treat the old bridge's TIME_WAIT as a busy port
The port-free wait used a plain bind probe, which Linux refuses while the
previous bridge's closed connections sit in TIME_WAIT (up to 60s). node's
listen sets SO_REUSEADDR and succeeds then, so a normal restart failed with
whatsapp_bridge_port_busy after 10s and waited for the reconnect backoff.
Probe with SO_REUSEADDR on POSIX so only a live listener blocks the spawn.
2026-10-28 19:21:20 -07:00
Victor Kyriazakos
29b44be139 fix(whatsapp): wait for the old bridge to release its port before respawning
connect() SIGTERMed the previous bridge, slept a blind 1s and spawned the
new one regardless. A bridge that was slow to exit (or ignored SIGTERM)
still held 127.0.0.1:<port>, so the new bridge died on EADDRINUSE and the
reconnect loop retried the same race forever.

- _kill_port_process / _kill_stale_bridge_by_pidfile wait out a SIGTERM
  grace, then SIGKILL survivors after re-checking identity (a PID recycled
  inside the window is never signalled).
- connect() replaces the blind sleep with a bounded bind-probe wait for the
  port and fails with a named retryable whatsapp_bridge_port_busy instead
  of spawning onto a busy port. A holder that is not our bridge is still
  never killed.
- Listener discovery falls back to psutil when neither lsof nor ss is
  installed; without it the scan was silently empty and nothing was reaped.
- A bridge that dies during the post-spawn health wait no longer leaves a
  dead-PID bridge.pid; disconnect() waits for a force-killed bridge to exit.
- bridge.js handles the listen error and exits with a clear EADDRINUSE
  message instead of an unhandled stack trace.
2026-10-28 19:21:20 -07:00
kshitijk4poor
aecf04f3d8 fix: an answered Discord approval whose click edit fails still retires its card
When a click records the answer but Discord rejects the interaction
edit, the view was stopped but the card kept its pending embed and
dead buttons. The settle observer skips cards whose click owns the
edit, because `_backend_settled` was already set.

Now a failed edit after a recorded answer clears `_backend_settled` and
retires the card through its message: buttons removed, "already
resolved" footer. The retire runs under the same lock as the
observer's, so only one of them edits. The edit error is still raised,
as before. A failed edit on a no-op click (nothing recorded) is
unchanged.

Tests:
- The edit-failure case of test_click_stops_view_even_if_interaction_edit_fails
  now asserts the card is retired.
- A new test fires the observer during the failing edit (the usual
  order, since the waiter wakes before Discord answers). The observer
  skips, and the click's own retire stamps the card.

Both fail on the previous commit. The new test also fails with only
the retire call removed.

Reported by Greptile on #145948.
2026-10-28 15:28:40 +05:30
kshitijk4poor
e0e3349ed3 refactor: move the Discord exec-approval view into a sibling module
adapter.py was already far past the 2,000-line limit, and this stack
grew it from 7,414 to 7,512 lines. AGENTS.md lets a unit that is
already over the limit only shrink. The file's FILE_LINES allowance
covers an earlier platform-table move, not the approval code.

ExecApprovalView now lives in adapter_exec_approval_view.py. Its body
moved verbatim: build_exec_approval_view(discord, base, unauthorized=...)
returns the class, and _define_discord_view_classes assigns it to the
same module global as before. The one change inside the body: the
failed-lookup log now carries its traceback (exc_info=True), which the
health check requires of a catch-all in a new file. A builder is needed because discord.py
can be installed lazily after the adapter is imported, and the other
views are defined the same way. adapter.py ends at 7,374 lines, 40 below
main.
2026-10-28 15:28:40 +05:30
kshitijk4poor
50f57a131f fix: a stale Discord approval click leaves the card to the request's observer
Item 1 of the review is only partly fixed by the stale-click commit
before this one. Clearing `_backend_settled` lets the settle observer
retire the card, but the click still edited the same card with
"Approval expired — command was not run" through its own interaction
response. Nothing serializes that edit with the observer's. If the
click's edit lands last, it hides the real outcome and reattaches the
disabled controls. Discord serializes the interaction payload before
awaiting the response, so a later embed change can't repair it.

When a click on a card with a request id resolves nothing, that request
has already settled through another path. Since the earlier commits, its
observer is always registered (it is registered before the send, and a
request gone before that already retires the card). So the click now
only answers the clicker privately ("no longer pending") and leaves the
card edit to the observer.

A click whose lookup raises recorded nothing, and its request may still
be pending. It used to stamp the card "expired — not run" and disable it
for good, and that edit could race the observer too. Now it re-opens the
card for a retry, tells only the clicker ("Couldn't record your choice.
Click again, or answer with /approve or /deny." — a new string in every
locale), and leaves the final edit to the observer. A card without a
request id has no observer, so its no-op click keeps the old "expired"
edit.

Tests:
- The stale-click regression now asserts that the click never edits the
  card. It fails on the previous commit.
- A new test drives a failed lookup on a really pending request with its
  observer attached: the card stays live, and a later text answer
  retires it with the real outcome.
- A third test pins the expired edit on a card with no request id.
2026-10-28 15:28:40 +05:30
kshitijk4poor
8654f1a684 fix: answered Discord prompts release their view
Raising the `discord_prompt_timeout` cap to the platform-safe maximum
makes a gap much larger. Slash-confirm, update and clarify views never
called `stop()` when answered; only exec approvals did. discord.py keeps
an unfinished view registered after the answering edit, and its timeout
task sleeps until expiry with no upper bound.

So every answered prompt stayed registered for the whole configured
timeout, now up to a year. When the timeout finally fired, the base
`on_timeout` stamped "Prompt expired — no action taken" over "Approved
by X". The overwrite already happened on main within 900 s; the higher
cap only delays it.

`_finalize_embed` (slash confirm, update, exec approval) and the clarify
`_finish` now stop the view in a `finally`, after the answering edit, so
an edit failure still releases it. The exec view's own `finally: stop()`
is now covered by `_finalize_embed` and goes away.

New parity test: an authorized answer on each of the three views (and
the clarify "Other" hand-off) leaves the view finished. All four cases
fail on the previous commit. Exec cards stay covered by
test_discord_approval_lifecycle.
2026-10-28 15:28:40 +05:30
kshitijk4poor
b5caaf7b44 fix: a Discord approval card that settles mid-send shows how it ended
The card registered its settle observer only after `channel.send`
returned. If the request ended during the send (wait timed out, /stop,
session closed, withdrawn), the registration found no entry and the card
retired with the default reason "resolved". The card then said "This
approval has already been resolved" for a command that never ran.

Build the view first and register the observer before sending. A reason
that arrives while the card is still in flight is held on the view
(`pending_retire`) and applied as soon as the card exists. Only a
request that was already gone before the card was built still has an
unknown outcome. That card now says "⌛ This approval is no longer
pending (it timed out or was answered elsewhere)", a new outcome-neutral
string, translated in every locale. It no longer claims either
"resolved" or "not run".

Building the view outside `_build` also removes the `view_holder` list
that only existed to get the view back out. The view never depended on
the channel.

The test now covers the three orderings (after, during, before the send)
and asserts the footer. Two of them fail on the previous commit.
2026-10-28 15:28:40 +05:30
kshitijk4poor
cfed2ca71f refactor: pass the approval request id explicitly, not through platform metadata
The runner tunnelled the approval request id to Discord as a private
`_approval_request_id` key inside the platform metadata dict. That dict
goes to every adapter that renders approval buttons. The relay adapter
forwards it verbatim, so the private key reached the external connector
in every approval prompt frame.

Add an optional `request_id` to `send_exec_approval` and to
`ExecApprovalPrompt`, have the runner pass `approval_data["request_id"]`,
and have Discord read `prompt.request_id`. The metadata passed to the
adapters is back to the thread routing it carried before the PR (`None`
in a plain chat). The always-true `"timeout_s" in approval_data` guard
goes with it.

Native-button adapters render through `_send_exec_approval_prompt`,
whose signature is unchanged. The only `send_exec_approval` override,
`LocalSessionAdapter`, takes `**kwargs`, as does every test double, so
no other adapter or double changes.
2026-10-28 15:28:40 +05:30
赵桂雄
ac50e08b54 fix: preserve resolved Discord observer after stale click
A stale button click that resolves zero gateway approvals must not mark the backend settled and suppress the already queued resolved observer. Cover the external-answer to stale-click race through the real component gate.
2026-10-28 15:28:40 +05:30
Gille
39b2158afc fix: preserve configured Discord timeouts and retire approval views 2026-10-28 15:28:40 +05:30
Gille
4f86e97791 fix: align Discord approval buttons with request timeout 2026-10-28 15:28:40 +05:30
unsupportedpastels
58892b93e8 refactor(feishu): drop redundant authorization-check guard on card clicks
_is_sender_authorized already returns None when no check is registered, which the click path treats as a denial. No Feishu test double relies on the extra getattr.
2026-10-27 16:37:20 -04:00
unsupportedpastels
48b090c5e5 fix(feishu): match approval clicks against every operator id in Feishu lists
With Feishu admins or FEISHU_ALLOWED_USERS set, an approval or update-prompt click was compared by open_id only, while message intake accepts open_id, tenant user_id and union_id. A user listed by tenant user_id could message the bot but not answer its cards. The click now matches any of the ids the card callback carries (open_id, user_id, union_id), on both the callback thread and the loop-side re-check.
2026-10-27 16:37:20 -04:00
unsupportedpastels
de4fb05ec0 fix(feishu): authorize approval card clicks through the gateway allowlist
With no Feishu admins and an empty FEISHU_ALLOWED_USERS (the setup default), any chat member could answer an exec-approval or update-prompt card. The clicker now has to pass the same gateway authorization inbound messages use (pairing store, GATEWAY_ALLOWED_USERS, allow-all flags); the click is refused when that check denies or is not registered. A configured Feishu admin/allowlist still decides on its own.
2026-10-27 16:37:20 -04:00
Teknium
76f2fdb794 fix(cache): a rotated key, token or same-size edit is never served stale from a file cache
Every cache keyed on a file's stat signature had the bug the config caches had: a same-size
in-place rewrite in one coarse timestamp tick keeps mtime, ctime, size and inode, so the older
parse was served for the rest of the process. Move the helper to utils.file_cache_version
(file_signature + content digest while the file is under 2 s old; always_digest for signatures
compared much later, where the racy digest going empty would read as a change) and key every
cache that can hold a secret, token, pairing/allowlist, route or config on it:

- auth.py: global auth-store memo, Nous auth-status memo (was mtime only)
- gateway/pairing.py approved-users cache (a revocation kept access)
- run_profile_reconcile: served-profile signature (always_digest: a false change reconnects
  adapters) and the hook-consent signature
- webhook dynamic routes (route HMAC secrets), Feishu comment pairing/rules cache (mtime only)
- MCP OAuth tokens-file reload check (mtime only; always_digest: a reload tears the session down)
- config parse-failure record (always_digest), named-custom-provider memo, model aliases,
  gateway.standalone memo, profile model read, MoA preset, agent raw config,
  tui_gateway raw config cache, onboarding due stamp, free-tier inventory stamp,
  provider model-list credential fingerprint, git safe.directory key, skills prompt
  manifest

config_cache_version takes its stat through config_version, so its errors and seams are unchanged.
Left alone: the tool-definition cache key and the platform manifest stamp (a safe worker must
never open config.yaml or a plugin file; the MoA preset cache is skipped in one instead) and the
CLI MCP watcher seed (pinned to file_signature by a main test).
2026-10-27 12:57:09 -07:00
unsupportedpastels
1ae3c55e4b test(a2a): cover token-mode Host, malformed Host and missing Content-Type
Add tests that a token-authenticated listener still serves a foreign Host, that malformed Host values fail closed, and that a no-token POST without a Content-Type is refused. Give the no-token Host rule its own README bullet and document every 403 refusal message.
2026-10-26 23:21:53 -04:00
unsupportedpastels
544edcf794 fix(a2a): serve loopback literals and the A2A_PUBLIC_URL host in the no-token Host check
The no-token Host check accepted only localhost, 127.0.0.1 and ::1, so other loopback literals and a local reverse proxy forwarding the configured A2A_PUBLIC_URL host were refused. Accept any loopback literal and the A2A_PUBLIC_URL host, name both in the 403 message and docs, and document the Content-Type refusal.
2026-10-26 23:21:53 -04:00
John Paul Soliva
53d28d9b85 fix(a2a): accept the absolute form localhost. in the no-token Host check
Keeps the loopback-name check consistent with the hermes proxy one: a
trailing dot names the same host, while a rebound name stays refused
with or without it.

(cherry picked from commit 5d1c94588affb445638426653e2230132c741ec6)
2026-10-26 23:21:53 -04:00
John Paul Soliva
3846641765 fix(a2a): refuse a non-loopback Host in no-token mode
Without a token the listener trusts whatever reaches 127.0.0.1. A page on a hostname
that re-resolves to 127.0.0.1 is same-origin to it and could read /health (the
served-agent list), the Agent Card and /metrics. parse_request now refuses such a
Host with 403 before any route runs; a malformed Host fails closed. Token mode is
unchanged.

Fixes #126203

(cherry picked from commit 7d71a6082e325eee0880ea82542cce7db2459517)
2026-10-26 23:21:53 -04:00
John Paul Soliva
881eb6c252 fix(a2a): refuse browser-originated POSTs in no-token mode
Without a token the A2A listener identifies callers by the loopback
socket alone, which a web page open in the operator's browser can also
reach. In that mode, refuse a POST that carries an Origin header, a
Sec-Fetch-Site other than none/same-origin, or a non-JSON Content-Type
(the body types a page can send without a CORS preflight). Token mode
is unchanged.

(cherry picked from commit cfb36d3c5f30fc205c5d0ef122e43dd482bcfc91)
2026-10-26 23:21:53 -04:00
calvinnwq
9c1a75e56f fix(gateway): Discord's config allow_from also governs guild channels
Under multiplex, authorization reads each profile's own secret scope, so the
DISCORD_ALLOWED_USERS the YAML bridge copies from discord.allow_from into os.environ is never
seen. The fallback to the adapter's extra then read group_allow_from for 'group' sources:
Telegram's group-only list, which Discord does not have. An allowlisted user's guild-channel
messages were dropped and their button clicks refused, while threads and DMs worked.

Discord declares allow_from_covers_groups, so its groups read allow_from. Adapters with a
separate group list (Telegram) are unchanged; a test pins that a Telegram DM-only allow_from
still does not admit the user in a group.
2026-10-26 13:04:38 +05:30
calvinnwq
2712a096db fix(discord): a button click in a thread gets the thread's authorization verdict
#133213 confirms a snapshot-admitted clicker with the gateway's live check, but labelled every
guild click 'group' and passed no thread id. Message intake labels the same channel 'thread',
so a user the gateway admits in a thread could be refused on its approval card ("This bot is
private..."), and a thread_id profile route never matched the click. Label the click like
intake does: a discord.Thread is 'thread' with its id as thread_id.
2026-10-26 13:04:38 +05:30
kshitijk4poor
ab3e4affd6 fix(config): meet the code-health ratchet and keep pm's runtime tree off the YAML stack
CI on the salvage was red on the code-health ratchet (over-cap facades grew; two blind excepts)
and on the pm observer fixture, whose isolated source tree carries pm/ + hermes_cli/ but no utils.

- config_backend imports become module-level in the facades (it imports only stdlib); gateway,
  auth and telegram take config_exists through the hermes_cli.config import they already have.
- Pure helpers move to topical siblings, offsetting the growth: _csv_or_list_to_set ->
  gateway/run_common.py, the dotted config-path pair -> hermes_cli/backup_restore.py, the
  voice/timezone/web-backend checks -> hermes_cli/config_value_checks.py, _load_config_dict ->
  hermes_cli/profile_memory_config.py (both callers are memory-provider code).
- _load_config_dict catches YAMLError/OSError/UnicodeError instead of Exception.
- _load_config_cache_hit probes readability with config_backend.probe_config_readable (a 1-byte
  read through the backend's open) instead of a full parse plus a blind except.
- pm/plugins_state.read_home_selection checks config_exists before importing the YAML stack, so
  a home with no config never needs utils.
- developer-guide/config-backend.md describes this build (file backend only).

Same approach as @benbarclay's 74421be709 in #122509, which does not cherry-pick onto current main.
2026-10-25 18:54:09 -07:00
Ben Barclay
871900df63 feat(config): route every user config.yaml read and write through a ConfigBackend seam
Add hermes_cli/config_backend.py (config-config design §4.1, D10/D11): a
ConfigBackend protocol, the FileBackend (today's behaviour), selection by
HERMES_CONFIG_BACKEND only (default file; 'remote' and unknown values fail
closed with ConfigBackendUnavailable), and path-level helpers
(read_config_doc, read_config_doc_readonly, config_version, config_exists,
write_config_key, write_config_document, supports_file_tooling).

Migrate every direct reader/stat/exists/bypass writer of a user config.yaml
to the helpers (config.py loaders + caches, config_effective, env_loader,
gateway, TUI, CLI watchers, cron, tools, profiles, logging, time). File
tooling (config edit, backups, xAI migration rewrite, raw dashboard editor)
checks supports_file_tooling() first; migrations skip write-back without it.

Add scripts/check_config_yaml_readers.py (CI lint next to the writers gate)
that rejects a direct read of a config path outside the backend.
2026-10-25 18:54:09 -07:00
Teknium
68e4c2b31a fix(startup): build version-bearing User-Agents when a request is built, not at import
Every CLI start imports all provider plugins (hermes_cli.config lists their env vars), and
fireworks/gmi/xai/router/kimi/opencode plus auth_constants, models, model_catalog,
auxiliary_client, gemini_native_adapter, web_server_messaging, slack, yuanbao and perplexity
built a `<product>/<release>` string at module level. In a source checkout the release comes
from the 7-call git provenance walk (`git tag --merged HEAD` alone is ~0.35 s in a large
clone), so `hermes sessions list` paid it for headers it never sends.

Provider profiles take a LazyHeaders mapping (resolved on first read by the client builders,
which already copy with dict()); core modules call version_info.hermes_user_agent() where the
request is built. Header values are unchanged.
2026-10-25 17:50:59 -07:00
Maciej Lisiewski
05b83f632f Merge pull request #143719 from NousResearch/bulk-update-js
chore(deps): bump npm dependencies to latest minor/patch releases
2026-10-25 12:54:29 +01:00
Teknium
43cc33ec6f fix: address review — Feishu plain .ogg stays a file, Ogg duration walks pages
- Feishu routed .ogg/.opus to an "audio" (voice) message by extension even
  for send_document / is_voice=False; Opus is now an audio message only when
  the caller requested one.
- Discord _ogg_opus_duration walks page headers by segment table instead of
  rfind("OggS"), which could match packet data and misread the granule.
- Tests: successful transcode path (bytes, duration, temp removed), OggS run
  inside packet data, Feishu plain .ogg/.opus and the voice-intent control.
2026-10-23 17:40:07 -07:00
Teknium
183cd6cc35 fix(gateway): keep plain audio MEDIA out of WhatsApp/BlueBubbles voice notes
Same class as the Discord and Feishu fixes: these adapters' send_voice
ignored is_voice, so a plain audio MEDIA file (music, a sound effect)
became a voice note. The WhatsApp bridge always sends "audio" as ptt
(transcoded to Opus), WhatsApp Cloud converted every local mp3 into an
Opus voice bubble, and BlueBubbles flagged every file isAudioMessage.

is_voice=False now goes as a named document (WhatsApp bridge), as the
original audio/mpeg (WhatsApp Cloud), or as a plain attachment
(BlueBubbles). Voice intent and the no-flag auto-TTS path are unchanged.
2026-10-23 17:40:07 -07:00
Teknium
e2fe88cf7a fix(discord): send plain audio as an attachment, voice messages only as Ogg/Opus
The media dispatch routes every audio MEDIA file to send_voice with is_voice,
but the Discord adapter swallowed the flag and uploaded every file as a native
voice message named voice-message.ogg (audio/ogg), whatever the bytes were.
A sound-effect mp3 or a wav arrived as a voice note that does not play, with a
duration guessed from the byte size (mutagen is not a dependency).

is_voice=False now goes out as a regular attachment under its real name.
Voice intent ([[audio_as_voice]], auto-TTS) sends real Ogg/Opus: non-Opus
input is transcoded with ffmpeg, without ffmpeg the original goes out as an
attachment, and duration_secs is read from the Ogg granule position.
2026-10-23 17:40:07 -07:00
Teknium
95505c60e9 docs(tools): lead every tool description with its key capability
The deferred tool_search catalog shows each tool's first sentence clipped to
60 chars, so lines like 'image_generate: Generate high-quality images from
text prompts, or edit /…' hid that it edits with reference images on the
user's configured model. An agent skipped it and called FAL directly with a
hardcoded model.

- catalog line cap 60 -> 80 (CATALOG_SUMMARY_MAX_CHARS); every built-in
  tool's first sentence now fits and leads with what it does
- image_generate/video_generate say they use the configured model;
  image_generate says to use it rather than direct API calls/scripts
- web_search/web_extract/browser_exec name when to use each other
- drop a duplicated cronjob sentence and filler in skill_view/video_generate
- regenerate tests/fixtures/prompt_surface
2026-10-23 16:04:50 -07:00
Maciej Lisiewski
48217bc858 chore(deps): bump spectrum-ts to 12.10.1 (plugins/platforms/photon/sidecar)
spectrum-ts: 12.7.0 -> 12.10.1 (pins edited: 1; also: {'@opentelemetry/resources': "['2.10.0']->['2.12.0']", '@opentelemetry/sdk-trace': "['2.10.0']->['2.12.0']", '@opentelemetry/sdk-trace-base': "['2.10.0']->['2.12.0']", '@spectrum-ts/core': "['12.7.0']->['12.10.1']", '@spectrum-ts/imessage': "['12.7.0']->['12.10.1']", '@spectrum-ts/slack': "['12.7.0']->['12.10.1']", '@spectrum-ts/telegram': "['12.7.0']->['12.10.1']", '@spectrum-ts/terminal': "['12.7.0']->['12.10.1']", '@spectrum-ts/whatsapp-business': "['12.7.0']->['12.10.1']", 'es-module-lexer': "['2.3.2']->['3.0.3']", 'import-in-the-middle': "['3.3.3']->['3.5.2']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
9b53c4d2fb chore(deps): bump protobufjs to 8.8.0 (plugins/platforms/photon/sidecar)
protobufjs: 8.7.1 -> 8.8.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
069f15795e chore(deps): bump @opentelemetry/otlp-transformer to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/otlp-transformer: 0.218.0 -> 0.223.0 (pins edited: 1; also: {'@opentelemetry/resources': "['2.7.1']->['2.12.0']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
c88d3a492c chore(deps): bump @opentelemetry/otlp-exporter-base to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/otlp-exporter-base: 0.218.0 -> 0.223.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
85938b8b63 chore(deps): bump @opentelemetry/exporter-trace-otlp-http to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/exporter-trace-otlp-http: 0.218.0 -> 0.223.0 (pins edited: 1; also: {'@opentelemetry/resources': "['2.7.1']->['2.12.0']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
bf02f6133d chore(deps): bump @opentelemetry/exporter-logs-otlp-http to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/exporter-logs-otlp-http: 0.218.0 -> 0.223.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
a42905d0e7 chore(deps): bump @opentelemetry/core to 2.12.0 (plugins/platforms/photon/sidecar)
@opentelemetry/core: 2.10.0 -> 2.12.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
d0b2d6bb71 chore(deps): bump indirect npm dependencies within existing ranges (photon)
- @bufbuild/protobuf: 2.14.0 -> 2.16.0
- @opentelemetry/context-async-hooks: 2.10.0 -> 2.12.0
- @opentelemetry/sdk-metrics: 2.10.0 -> 2.12.0
- @photon-ai/advanced-imessage: 2.1.0 -> 2.2.0
- @photon-ai/otel: 3.7.0 -> 3.8.1
- cjs-module-lexer: 2.2.1 -> 2.3.0
- lru-cache: 11.5.2 -> 11.5.3
- marked: 18.0.11 -> 18.1.0
- zod: 4.5.4 -> 4.6.5
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
154748800b chore(deps): bump google-auth-oauthlib to 1.5.0
google-auth-oauthlib: 1.3.1 -> 1.5.0 (pins edited: 1; also: {})
2026-10-23 09:23:34 +02:00