Review findings on the wake-turn notice skip.
A quota or billing failure keeps the fallback serving for a cooldown, so the
next turn the user sends makes no new switch: after a switch hidden on a wake
turn, the user's turn ran on the backup with no notice at all. The hidden notice
is now held; the next non-wake turn announces it before it runs if the fallback
is still serving, and drops it if the primary came back (the user never saw it
leave).
The turn-start "Primary model restored" line also fired on wake turns, so each
wake during an outage restored, re-failed and posted it again. It is now skipped
on wake turns and for a switch the user never saw. The restore line moves into
agent/fallback_notice.py beside the switch notice.
The test now drives real run_conversation turns against a loopback provider
(primary 402, backup streaming): two wakes, then a user turn, and a wake after
the cooldown. Both cases fail on main and on the previous head.
Since the fallback notice moved to the moment of the switch, every background
wake turn (a finished background process, a plugin's scheduled check) that
falls back posts it into the chat, and most of those turns then end silent.
One plugin posted it on 27 of 27 wakes during a primary outage (#137738).
Whether a turn is a wake is known when it starts (its persisted display kind),
so the notice is skipped there and logged instead. A turn the user sent still
gets it at the switch. A switch decided before a wake turn stays pending for
the next turn the user sees.
Holding the notice until the final reply is known (#137749's shape) would bring
back the at-the-end timing on every turn, which Teknium ruled against.
Refs #137738; supersedes #137749 by @KoNit-K.
A fallback switch was announced only after the fallback finished answering, so a
long turn ran on the backup model while every surface still showed the pick (a
two-hour task looked like it ran on Qwen and had run on Grok). The notice also
named only a category ("provider failure"), never the provider's error.
The switch now posts its notice at the switch, before the fallback model is
called, and quotes the provider's own error (the summary the error handler
already computes, redacted and capped at 200 chars). A switch decided before the
turn (primary credentials failed at build) is announced at turn start. The notice
stays display-only and still obeys display.suppress_warning_notifications.
The notice wording moves to agent/fallback_notice.py, which also takes
chat_completion_helpers.py back under its line cap.
The text_to_speech tool lets the model choose output_path, and the command
provider substituted it into the operator's shell template. Quoting covers
the template's own quote context, but a template that re-parses its
placeholders (sh -c '... {output_path}', or backticks) hands the value to a
second shell parse, where $(...) and backticks in the path ran.
The command now writes a Hermes-named file in its temp directory, which is
moved to the requested path afterwards, so no caller-chosen text reaches the
shell in any template shape.
Reported-by: directorboint-arch
_is_sensitive_url_param now strips _JSON_VALUE_SUFFIX_RE before the
affixed-key check, as _json_affixed_key_secret does, so ?api_key_value= and
?passwordValue= are masked on redact_url_credentials=True paths. Tests pin
the closed-list-only names (mysql_pwd, sshpass, client-key-data). Docstring
and memory-provider docs state the shared caller scope and the image-URL
behaviour.
Refs #119852
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
Provider tool arguments now skip the URL query mask: a memory tool may fetch the URL it
is given (openviking's viking_add_resource indexing a pre-signed S3 or SAS link), so
masking ?X-Amz-Signature=/?key=/?sig= broke it. Storage-only hand-offs keep urls=True.
The URL query pass also masks every name the JSON-field rule treats as a secret
(accessToken, x-api-key, auth_token, private_token, secret_key, passwd, ...), via the
same closed list and affixed-key policy, so the two passes agree.
Refs #119852
Memory-provider sync and telemetry export now opt into the strict URL pass via
redact_for_egress(urls=True), so a prefix-less ?api_key=<opaque> is no longer
archived verbatim. Chat delivery and delegation keep it off: there the agent
hands the user magic links / OAuth URLs that must stay usable.
Fixes#119852
A plugin directory that is a link to a git checkout elsewhere is classed
as self-cloned, so `hermes plugins update` printed "run `hermes plugins
adopt` first". `adopt` then refused with "resolves outside the plugins
directory": `_sanitize_plugin_name` resolves links on purpose, so that no
plugin verb updates or deletes files outside the plugins directory.
The guard stays. The update check now says where the checkout is and to
pull updates there, and every named verb (`adopt`, `update <name>`,
`remove`) that reaches the guard through `_require_installed_plugin` says
the same and that deleting the link removes the plugin, instead of the
bare path error.
The all-skipped guard only fired when the form had a required field, so a user
who skipped every field of an all-optional form (no defaults) sent "accept"
with empty content. Any fully skipped form without defaults now declines.
The elicitation section still described the yes/no approval prompt. It now
explains how fields are asked and checked, the fallback, and what the timeout
covers.
A plugin host's buffered answer is served from the gateway's own origin,
so passing Set-Cookie through let a hosted plugin set or overwrite the
dashboard's cookies. hosted_response (shared by the launch profile's
isolation: host mount and secondary profiles' hosts) now drops it and
warns once per (profile, plugin). No bundled plugin sets cookies.
Part of #140051 (item 1; the tracker stays open for items 2-5).
A dotfiles repo at $HOME made the whole home directory the containment
root, so an AGENTS.md in a download the agent unpacked could link to any
home file. Subdirectory hints had the same gap when the session's working
directory is $HOME or /. Such a root now narrows to the directory the file
was found in; the user's own files at the dotfiles root still load.
The startup context loader read .hermes.md, AGENTS.md, CLAUDE.md, .cursorrules and .cursor/rules/*.mdc without resolving symlinks or applying the read deny-list. Reuse the subdirectory-hint check from 5aca5406f0: the resolved target must stay inside the project root (git root, else cwd) and pass get_read_block_error, and the resolved target is what gets read. The /context manifest shares the finders, so it reports a skipped file as not loaded.
Finding 'Discord keeps the old thread': a Discord thread-born job stores the thread as chat_id and
Discord cannot nest threads, so the option does not help there; do not document it as working.
A continuable cron job (attach_to_session / cron.mirror_delivery) opens a
fresh thread per run only when its origin pins no thread: b693bee100bd's guard
keeps a job created inside a Telegram topic delivering back to that topic.
That stays the default. platforms.<p>.extra.cron_fresh_thread_per_run: true
now lets the fresh-thread branch override the origin topic for deliveries to
the job's own conversation; an explicit chat_id:thread_id target to another
chat is never overridden. A non-boolean value keeps the origin topic and warns.
Fixes#76548
The cron user guide described only the global cron.wrap_response. Add a
per-job subsection covering the CLI flags (--wrap-response,
--no-wrap-response, --inherit-wrap-response), the cronjob tool values
(on / off / inherit) and what the dashboard API accepts, and note in the
developer guide where the decision and the strict normaliser live.
The strict read now stops curator lock/unlock/pin, and the Desktop switch, from saving over a damaged record, yet the errors said "not writable" or blamed curation eligibility, and the docs and the background-guard refusal still sent users to curator unlock as the repair. Point them at repairing the JSON or moving the file aside.
Refs #147986
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
* fix(tts): keep a backslash-adjacent placeholder literal in command templates
A placeholder directly preceded by a backslash (\{name}) was still
substituted, so the template's backslash merged with the emitted escape
into a double backslash that un-escaped the value: with a tool-controlled
value like $(echo PWNED) the rendered 'echo "\{input_path}"' executed
the command substitution on /bin/sh (reproduced in #138361). Treat such
placeholders as literal, like {{name}} already is: fail closed rather
than splice escapes.
* fix(tts): refuse Hermes provider credentials in command env_passthrough
Provider-config env_passthrough names bypassed the GHSA-rhgp-j443-p4rf
credential filter that tools/env_passthrough enforces, letting operator
config smuggle hosted credentials (OPENAI_API_KEY, …) back into the
secret-scrubbed command child env. Route the allowlist through the shared
_accepted filter so the same policy holds on the tts/stt command path
(item 3 of #138361).
* fix(tts): refuse cmd.exe metacharacters in command-provider placeholders on Windows
Command providers run through `cmd /c` (shell=True). Unquoted placeholders went through
list2cmdline, which leaves & | ^ < > unquoted when the value has no space, and the
double-quoted context used POSIX backslash escaping that cmd ignores; %VAR% / !VAR!
expand before caret escaping, so no quoting is reliable. The model controls
{output_path} via text_to_speech, so a crafted path could splice a command. On
Windows the renderer now raises ValueError for values containing &|^<>%!" or line
breaks (fail closed); POSIX quoting is unchanged. STT maps the ValueError to its
error envelope; TTS already reports it as a configuration error.
Fixes#138361
* fix(tts): keep the backslash-literal rule POSIX-only
On Windows the backslash is the path separator, so `C:\voices\{voice}.onnx`
left {voice} unsubstituted. A `"` in the value is already refused there, so the
backslash splice the rule prevents cannot happen; substitute as main did.
Refs #138361
* fix(tts): pass double-quoted Windows placeholder values through unescaped
On Windows a "..." placeholder still got POSIX \\ / \$ / backtick escaping,
which cmd.exe and the MSVC argv parser read literally (a$b arrived as a\$b).
'"' is already refused there, so only a trailing backslash run is doubled to
keep the template's closing quote intact.
Tests: cover '<' and '\r' refusals, pin os_name on the literal-placeholder
test, gate the /bin/sh proof with platforms("posix"). Docs: env_passthrough
refuses Hermes provider keys.
Refs #138361
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
---------
Co-authored-by: liuhao1024 <sunsky.lau@gmail.com>
Co-authored-by: liuhao1024 <liuhao1024@users.noreply.github.com>
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
Greptile: Unsubscribe misses the inferred topic. Omitting --thread-id on
unsubscribe now resolves the same row subscribe would have written: root lane
first (legacy meaning), else the session's own thread, else the chat's only
threaded row.
Omitting --thread-id recorded the chat's root lane, so a task subscribed from
a Telegram DM topic pinged the DM root, which the operator was not watching,
and the subscription cursor still advanced as if it had been delivered.
Resolution (hermes_cli/kanban_notify_thread.py) when --thread-id is omitted:
1. the caller's own session thread when it subscribes its own chat from a
gateway session (the issue's "default to the dispatch context");
2. else the thread of this task's existing subscription to the same chat,
sorted so the pick is deterministic, with alternatives named;
3. else a stderr warning for a Telegram DM target that the ping lands in
the DM root.
An explicit --thread-id is recorded verbatim, as before.
Steps 2-3 are from #125669 by @finn763.
Fixes#87281
Every allowlist shape for "authenticated curl to api.github.com" leaked the
header to a second host through shell expansion ($IFS word-splitting, quoted
~/.curlrc writes, chained commands), so the user-prompt scan now flags an
Authorization curl to any host. GitHub calls in cron go through `gh api` or a
--script with terminal.env_passthrough; skill bodies keep the looser
assembled-prompt scan, so bundled GitHub skills are unaffected.
Fixes#74667
The memory page said the background review's saves "always" reach the
write_approval gate, but auxiliary.background_review.extra_tools can admit a
write tool (agent/background_review.py::_review_tool_whitelist). The skills
walkthrough also lacked the file-tool/terminal caveat the other two pages now
carry. Both nits from BearHuddleston's review of #155335, which merged before
they were addressed.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
The user guide promised every save waits for approval, but write_file/patch
and the terminal can still edit MEMORY.md/SKILL.md directly (#60440). Also
rewraps the salvaged docstring line to the file's width.
Fixes#117818
The Python SDK `{"result": value}` dedupe ran in the shared result
renderer, so plugins calling `ctx.call_mcp` lost `structuredContent`
and got newline-joined item text for list[int]/list[dict] tools, which
is not JSON. Only the registry handler (`native_images=True`, what the
agent loop dispatches) now collapses the wrapper; `ctx.call_mcp` gets
what main returned.
A per-item list now reaches the model as one JSON copy of the value
instead of rejoined block text, so `[1, "1"]` no longer reads as
"1\n1" and items containing newlines keep their boundaries. The str
case is unchanged (the text block itself).
FastMCP and the official Python SDK (MCPServer) cannot put a bare string,
number or list in structuredContent, so a `-> str` / `-> int` / `-> list`
tool answers with content = the bare value (FastMCP 3.x: one text block,
a list as one JSON block; MCPServer: one block per list item) and
structuredContent = {"result": value}. FastMCP marks the shape with
"x-fastmcp-wrap-result" in outputSchema (and, from 3.2, in _meta).
_content_dual_emits_structured (kimi-code#3234, narrowed in #115445 for
#115430) only recognised structuredContent serialised verbatim in a text
block, so the wrapper never matched and every such result reached the
model twice. That doubled the inline token cost, crossed the 50K
mcp_result_size_chars spill threshold at half the real size, wrote an
escaped second copy into the spill file's <mcp-result-metadata> block
(#90426), and spent the 200K per-turn budget twice as fast.
The check now unwraps the single-key {"result": ...} wrapper and applies
the same per-block equality to its value (block by block for a list).
Equality stays exact and type-stable (1 is not True). A wrapper whose
value differs from the text, or one with extra keys, keeps its
structuredContent (#115430). A bytes return (content '"abc"', structured
"abc") is compared as JSON too; a list[str] whose item holds a newline
keeps structuredContent, because the newline-joined text cannot show the
item boundary. The outputSchema / _meta marker is not consulted: it is
absent on FastMCP 3.0/3.1 _meta and on MCPServer, and it cannot replace
the equality check.
Salvaged from #124452 (production change as written there), with tests
for the FastMCP 3.x shapes, the _meta marker, multi-block and non-text
content, and the spill threshold / spill file through the real handler.
Fixes#124451
Co-authored-by: Julia <julia1988@users.noreply.github.com>
Co-authored-by: JoaoMarcos44 <87440198+JoaoMarcos44@users.noreply.github.com>
Co-authored-by: Victor Kyriazakos <victor@rocketfueldev.com>
Adds a shipped-profile example to the per-job timezone section (one
cron/jobs.json with a pinned America/New_York job and an unpinned local
morning brief, with the wall-clock times three installers get) and a
pointer from the profile-distribution authoring guide.
A name deny list cannot classify tools it has never seen: another plugin's
a2a_call or meet_join starts a remote agent task or a detached worker, and an
MCP tool can trigger server-initiated sampling, all outside the fork thread's
tool whitelist and auto-denied approvals. The fork allowlist is now built from
ownership instead: the tools whose live registration is the requesting
plugin's (newest active ledger entry per name), plus core tools marked
fork-safe in FORK_SAFE_CORE_TOOLS (empty). A name dispatch reroutes before the
registry (inline agent tools, legacy aliases, the Tool Search bridge) never
counts as the plugin's own. Naming any other tool returns None with the token
unspent, and the dispatch guard reads the allowlist again when the fork starts.
background_review extra_tools is operator-configured and goes back to its
previous behavior; the consent text says the fork uses the plugin's own tools.
delegate_task, message_agent, cronjob_manage and the Kanban moves that hand a task to a
dispatched worker run their loop outside the fork thread's dispatch guard: a delegate
child is built from the parent's toolsets and its worker enters through a copied context
that carries neither the thread-local whitelist nor the auto-deny approval callback.
fork_session now refuses a tools= list naming one (None, token unspent), the fork's
dispatch whitelist drops them however the job was built, and background_review
extra_tools ignores them with a warning.
A plugin with session-less background work (re-scoring its own data,
suggesting a cleanup) had to run its own timer. register_idle_task(name, fn,
*, interval_hours, min_idle_hours=2, first_run="defer") puts it on the skill
curator's scheduler instead:
- polled from every site that drives the curator (gateway housekeeping per
served profile, CLI/TUI startup maintenance, the hermes serve maintenance
tick) through one run_idle_jobs(): the curator, then the active profile's
plugin tasks;
- the curator's gates via agent/idle_schedule: the min-idle check, the
interval (floored to 1 h) whose first observation seeds last_run_at and
defers one interval (first_run="immediate" opts out), and the O_EXCL claim
file so a task never overlaps itself across threads or processes;
- state per (profile, plugin, task) in <plugin data dir>/idle-tasks/<name>.json
(last_run_at, run_count, paused, last_summary, last_status, last_error);
a manager polled outside its own home runs nothing;
- exceptions are logged and recorded, never raised into housekeeping;
- the registration is a PluginRegistration, so unload stops the polling;
- `hermes plugins idle-tasks [plugin] [--pause TASK | --resume TASK]`.
fn receives plain data (name, idle_for_seconds, last_run_at, run_count) and
reaches its ctx through its closure, so the payload also crosses the isolated
plugin host. No capability: the scheduler only calls the plugin's own
function; model calls inside it go through ctx.llm's existing gate.
plugins.py and gateway/run.py are over the file-size cap, so the mixin lives
in hermes_cli/plugins_idle_tasks.py and neither file grows.
Hermes' own background review (fork the live agent after a turn, run a
bounded multi-step prompt with a narrow tool list, cancel on the next live
turn) is now open to plugins as ctx.fork_session(token, prompt, *, tools=(),
max_iterations=8, input_budget=None, task=None, timeout=None), gated by the
new consent-only capability llm.session_fork.
Reused, not copied:
- Lease: post_llm_call's side_question_token backs a side question OR a fork
(side_question_lease.take_lease; same TTL, turn_moved_on, profile fence,
no token for unattended turns, one redemption per turn). The payload field
keeps its name for compatibility.
- Fork: build_cache_parity_fork(write_origin="plugin_fork:<id>") on a
context-bound thread in the captured turn context; same-model forks replay
the captured system prompt and tools[] byte-for-byte; routed forks get the
history digest. Persistence stays fully detached.
- Guardrails: the thread tool whitelist is the requested names (each must
already be in the session's tools[]); approvals auto-deny; the review's
input budget (a plugin can only lower it) and iteration cap (<= 16);
_BackgroundReviewRun admission so cancel_background_review_for_live_turn
interrupts plugin forks with the review under one bounded wait;
review_idle_queue deferral on the managed local runtime (enqueue takes a
dispatch callable; a newer fork of the same plugin supersedes the queued
one).
- Routing: task must be one of the plugin's register_auxiliary_task lanes,
resolved like auxiliary.background_review.
- Usage and hooks: release_cache_parity_fork bills the parent session as
plugin_fork:<id>; each fork loop request reports pre/post_auxiliary_call
(aux_task="plugin_fork", plugin_id) instead of pre/post_api_request.
Tool handlers inside the fork receive turn_origin="plugin_fork:<id>"
(live calls get no new kwarg), so a plugin can refuse calls from the live
agent. The handle exposes done/cancelled/outcome/result/actions/wait/cancel,
never the fork agent. Fails closed (None) without the capability, on a bad,
expired, spent or foreign token, a tool the session does not advertise, or
a task the plugin does not own.
post_llm_call gains a read-only review_signals mapping: the skill and memory
nudge counters, both intervals, whether each review trigger fired this turn
and whether a due trigger actually forks the background review (enabled in
config, not cron, not a subagent).
A plugin doing its own after-turn work (Collective Wisdom's share
suggestion) can then follow the cadence the user already tuned instead of
counting tool calls itself.
The hook fires before the review decision, so the finalizer now evaluates
the skill trigger once (agent/review_signals.py::skill_review_due) and hands
the same boolean to the hook and to the spawn; the memory trigger was
already decided at turn start. The mapping is a dict subclass that refuses
mutation (one instance reaches every callback) and stays a plain dict on the
plugin-host wire and through copy/pickle. Computed only when post_llm_call
has a subscriber.
A client that failed to start, or Ctrl+C in the launcher, skipped finish and left the new
worktree and branch behind. restore needs the full session id, so the example resolves the
short id the summary prints before it calls restore.
A module entry in plugin_api.json also publishes the module's imports (logging, os, sys,
Path). The list now names the three functions, and the docs example imports them by name.
Adds the subsection "`-w`: run the session in a fresh worktree" to the plugins page. It says when
a launcher calls `create`, `restore` and `finish`, that `create()`'s path is the `cwd` of
`session.create`, and why a plugin must not make the tree itself.
A new profile has no state.db, so opening it for every launch stopped the first chat.
A --resume or -c that matched nothing started a new chat without a word.
On Windows the install's launcher is hermes.exe, or hermes.cmd when no exe could be made.
hermes_command returned the extensionless path, which a child process cannot start when
only the batch file exists. It now returns hermes.exe, or the interpreter form.
The docs example printed resume lines it could not accept, and every launch shared one
session file. It now registers --resume and -c, resolves them to a session id, and uses
one temporary file per launch that may be empty.
The example read os.environ["HERMES_HOME"], which a Hermes started as a console script
on the default profile does not set. It now calls get_hermes_home(). The section says the
launcher command needs plugins.isolation: in_process. plugin_api.json lists hermes_command
and print_exit_summary by name, so the module's imports are not published with them.
Adds a section to the plugins guide for a plugin whose command starts its own chat frontend. It
names the three public imports, says what each returns and when to call it, and shows one short
launcher that uses all three.
`delegation.provider: deepseek` with a `providers.deepseek` proxy keeps the
bare slug, so the child loaded the raw `deepseek` pool: its unrecorded rows
passed the endpoint check and the startup lease bound the built-in's key to
the proxy (overriding the entry's key_env too). The child now takes
load_runtime_pool, the view main/aux/fallback resolution already uses.
A key-less entry off the built-in's host now goes keyless instead of
borrowing the built-in's key: log that once per entry with the opt-in
(`key_env: <BUILTIN>_API_KEY`), never the key, and document it with a
migration note.
Fixes#130410
Custom identity is now decided by configuration (custom_entry_for_identity, which uses the
runtime's own named-entry resolver), not by a `custom:` prefix. A bare `myep` (Desktop activate,
aux `main`, auxiliary.<task>.provider, fallback, /model, cron) gets the entry's origin-bound
view. A built-in id counts as the entry only on the entry's address.
The aux key peek and 401 recovery bind to the address actually called (the task base_url
override, or the failed request's client), not the entry's own address.
bind_unrecorded_rows never stamps a built-in's pool. A shared slug's unrecorded manual row
keeps the built-in's own address (recorded_address), so a providers.deepseek proxy entry no
longer redirects the built-in route, or its key, to the proxy.
Fixes#130410
entry_scoped_pool is now the one lookup every custom-entry pool reader takes
(main resolver, aux named-custom key + peek + recovery, delegate child,
primary restore, fallback/switch_model/cron attach via load_route_pool). It
keeps a row only if the entry re-seeds it from current config
(env:<key_env>, config:<name>, model_config) or its recorded base_url is on
the target origin; credential-less entries no longer get a built-in's seeded
rows on another host. Unstamped manual rows are bound to the entry's current
address on first use, the dashboard pool writer records base_url like
`hermes auth add`, and the Desktop move guard counts the entry's off-origin
pool rows as stored credentials (400 unless the payload sets a key or an
explicit blank).
Fixes#130410
The confirmation dialog, dashboard API row and /debug parity verdict that
landed with the consent gate (#94876) still said the public paste carries
full logs; after the allowlisted summary it never does.