Review finding on this PR: the tool layer ran every video backend's sources
through the FAL helper, which also downscales to the managed FAL gateway's
3.5 MB budget. xAI, OpenRouter and DeepInfra have no such cap, so a large
data: URL the caller already supplied (or a big local file) was silently
re-encoded smaller (2048x2048 PNG -> 1536x1536 JPEG) for them.
Split the guarded path-to-data: conversion from the budget fit. The tool
layer always does the former; it applies the latter only when the active
provider declares `max_inline_image_chars` in capabilities(). FAL declares
the managed gateway's budget; the others send images at full size.
Eight bundled plugins already build their User-Agent header with
hermes_user_agent: six model providers, the Slack adapter and the
Perplexity web provider. Each was a baselined private import. The name is
now on the published plugin list, with a section in the plugin guide, and
those eight baseline rows go.
The xAI plugins need the same name before tools/xai_http.py can be split:
its hermes_xai_user_agent returns the string
hermes_user_agent("Hermes-Agent") returns.
Plugins that call a rate-limited HTTP API need to read the Retry-After
header. Discord, Signal and Slack already import Hermes's parser as
baselined private crossings, and the Microsoft Graph client needs it to
move into the teams_pipeline plugin.
- plugin_api.json lists the one name; public-api.md is regenerated.
- plugins/index.md gains a short section with the contract and an example.
- boundary_lint baseline drops the three crossings that are now public
(Discord, Signal, Slack). No other line changes; a full --update would
also drop two unrelated stale rows, so it was not used.
- Test: a plugin importing the parser validates with no private-import
warning, while another name from agent.retry_utils still warns. Red on
main.
ToolRegistry._toolset_checks, its four upkeep sites and _snapshot_state are
gone. The snapshot already overlaid every live entry's check_fn on that map, so
the map could only contribute an entry for a toolset that no longer has a
check_fn member. Such a toolset holds a tool without check_fn and is therefore
always available, and its only reader (banner.py, presence of check_fn on an
unavailable toolset) never sees it. get_toolset_requirements now derives
check_fn from the live entries (last one wins, as before); the
model_tools.TOOLSET_REQUIREMENTS dict at import is byte-identical before and
after (probe).
model_tools.TOOL_TO_TOOLSET_MAP had one reader, batch_runner, which used only
its keys; it now uses get_all_tool_names() and gets the same 73-name set. The
doctor printed TOOLSET_REQUIREMENTS[tid]["name"], which is always tid; it
prints tid. Doc references and the doctor's model_tools stubs follow.
tools/ holds model tools. These three files register none: they send a
message to a platform for `hermes send` and for cron delivery, through
gateway adapters and gateway config. They move to the gateway package:
tools/send_message_tool.py -> gateway/outbound/send.py
tools/send_message_senders.py -> gateway/outbound/senders.py
tools/send_message_targets.py -> gateway/outbound/targets.py
Twelve test files move with them to tests/gateway/outbound/. Every importer
changes its import line in place. Nothing stays at the old paths: none of
the three names is on the plugin API list, the shipped-release list or the
old-updater list.
Behaviour is unchanged. The logger name stays tools.send_message_tool in
the three files and in the QQ Bot sender that shares it, so the lines stay
under `hermes logs --component tools`. The boundary-lint baseline changes
12 keys and no count, because its keys carry the module path of the
underscore names five bundled plugins import.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py.
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/skills_hub_github.py: unused imports subprocess, windows_hide_flags
- tools/skills_hub_github.py::GitHubSource._parse_frontmatter_quick (tests now call
skills_hub_models._parse_frontmatter directly)
- tools/skills_hub_clawhub.py::ClawHubSource._query_terms/_dedupe_results/_search_score
- tools/skills_hub_skillssh.py::SkillsShSource._strip_html
- tools/skills_hub_official.py::OptionalSkillSource._parse_frontmatter
- tools/skill_lock.py::locked_skill_dirs
- tools/blueprints.py::create_blueprint_job, export_blueprint, _schedule_to_string
(and their tests in tests/tools/test_blueprints.py)
Also:
- creating-skills.md no longer promises exporting a cron job back to a SKILL.md
(no code implements it)
- TestBlueprintBridge in tests/cron/test_suggestions.py asserts the job spec carries
`deliver`, the coverage test_bridges_to_create_job had
- TestParseFrontmatterQuick is renamed TestParseFrontmatter
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/environments/vercel_sandbox.py: _exception_chain, _extract_status_code,
_RETRY_BACKOFF_STEP, _MIN_SANDBOX_TIMEOUT, _MIN_RUNNING_WAIT,
_RUNNING_WAIT_POLL_INTERVAL, _STOP_TIMEOUT, _STOP_POLL_INTERVAL,
_SNAPSHOT_STORE_NAME
- tools/environments/sandbox_scope.py: CredentialRef (docstring in
agent/terminal_env_provider.py and the terminal-environment-plugin guide no
longer name it)
- tools/environments/streams.py: supports_streams() (the provider attribute of
the same name stays)
- completion_reason "failed_start": its producer left in cd818a4d054; drop the
lookups in process_registry_notifications._REASON_STATUS (and its
"Failed to Start" branch), cli_process_dock._STATUS_BY_REASON,
ui-tui processRoster REASON_STATUS, and the field comments
- tools/terminal_hints.py: _EXIT_CODE_HINTS[137] (exit 137 always carries a
SIGKILL exit note, which gates annotate_failure off)
- ProcessRegistry._config_value: unread `fallback` parameter
A worker read of prompt_cache_generation went through the required-write
journal: an RPC failure left the journal failed and blocked later writes.
The owner now stamps its durable generation onto the clock inside the
usage.main receipt that already carries it; no extra worker read.
- Every clock storage read (restore, prompt_cache_generation) is best-effort:
sqlite3.Error/OSError/WorkerPersistenceError log at DEBUG and the window
reports unknown (storage_unavailable); a successful reply is never lost.
- RuntimeSessionStore.prompt_cache_generation reads the owner's durable count
(session.cache_generation receipt op), so a managed worker's fresh write is
not reported compacted.
- The agentless /context read compares the saved clock with the row's
persisted model + model_config provider/base_url, and the breakdown cache
key includes them: a session.mutate model switch reports unknown.
The clock modelled every route as "expires = last touch + tier", which is wrong for OpenAI
GPT-5.6+: a read refreshes coverage to at least 30 minutes after it and never restarts a
12h write. It also treated documented minimums as expiries and lost or revived saved state.
- Coverage deadlines per tier with per-route refresh rules: Anthropic family restarts the tier
on read; OpenAI keeps max(existing, read + 30m) and a 12h deadline stays at write + 12h.
- Windows carry guaranteed_until (earliest deadline, so mixed tiers in one response are only as
warm as the shorter) and estimated_until (OpenAI: last touch + 24h retention ceiling; pre-5.6
in_memory 1h). cache_certainly_warm / cache_certainly_cold are the two consumer helpers.
/context: warm until / may still be warm until / expired / unknown.
- Events bind to the session's durable context generation (rows a compaction or prune archived,
SessionDB.prompt_cache_generation), kept as saved on restore; a resumed agent restores and
validates the saved event before folding its first response.
- Route identity is provider + normalize_route_base_url (scheme, host, port, path) + model.
- Agentless session.context_breakdown reads the saved clock (stored_cache_window).
- Codex app-server activity is recorded as an explicit unknown (it sets its own cache options).
- MoA records the resolved aggregator route and the payload the MoA client sent.
- effective_cache_ttl applies the route ceiling on the measured-provider path too.
Every consumer that needs "when does this session's cached prompt expire?" now reads one
answer, agent/prompt_cache_clock.py:cache_window(), instead of re-deriving it from _cache_ttl.
- Per successful attempt the clock records the tier actually on the wire (cache_control ttl,
prompt_cache_options.ttl, prompt_cache_retention, read from the sent payload), the send time,
and the tier the response proved: Anthropic cache_creation.ephemeral_5m/1h_input_tokens,
OpenAI Responses cache_write_tokens_details.ttl_30m/12h_tokens. normalize_usage keeps that
split as CanonicalUsage.cache_write_by_ttl instead of dropping it.
- Per-route rules are a dict of small handlers: native Anthropic proves via the split;
OpenRouter Claude is declared (live-probed to honour 1h); routes with a ceiling are clamped;
other Anthropic-wire gateways assume 5m; OpenAI GPT-5.6+ proves via ttl_30m/12h or declares
the documented 30m minimum; pre-5.6 assumes ~30m (5m on in_memory); implicit caches are
unknown. expires = latest read-or-write send time + the written tier. A route switch,
fallback, session rotation or compaction makes it unknown.
- Route TTL ceiling is data: ProviderProfile.prompt_cache_max_ttl (Nous ships "5m", because
the Portal's upstream drops 1h after ~7 min and bills 5m), overridden per provider by config
prompt_caching.route_ttl_ceilings. effective_cache_ttl uses the same helper, so Hermes stops
asking Nous for 1h. A custom endpoint at the Portal host gets the Nous ceiling.
- Persisted as nullable sessions.prompt_cache_clock (JSON) through the existing token batch;
restored lazily on resume, falling back to the newest assistant row (assumed).
- Codex app-server: read cacheWriteInputTokens instead of hard-coding cache_write_tokens=0.
- /context shows "Prompt cache: warm until HH:MM (…; 1h, proven)", "expired … ago" or
"unknown (…)". The surface is absorbed from #142387 (render/duration helpers, the
SessionContextBreakdownResult.prompt_cache contract and translations), reworked onto the clock.
Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Squashed onto main (#151819). The session.usage conflict with #141859 keeps the
branch side: _usage_nous_fields already reads the Nous fields inside the
session profile scope.
main's #141859 test now stubs both Portal reads: a session off a Nous route reads
with the stored token only (stored_token_account_info).
agent.account_usage keeps the names that moved to agent.account_usage_nous (and
BP_FULL): plugin_api.json publishes the whole module, and catalog plugins import
build_credits_view and build_nous_credits_snapshot from it.
declared_login_command read the login command from the plugin's setup_status(), and for the Claude subscription plugin that runs `claude auth status` (0.4 to 1.8 s, up to its 20 s timeout). The hint is built inline on the gateway's event loop (_hmwa_agent_error_reply), on every resolution while the plugin primary is signed out, and in nonretryable_copy and the cron copy even when their template names no command. On main the hint was the constant `hermes model`.
ProviderProfile gains login_args, the CLI's own sign-in as an argv tail after the resolved binary (`("auth", "login")`). The hint is that binary, found by the same PATH lookup the launch uses, plus login_args; a profile that declares none keeps `hermes model`. The two copy builders only look the hint up when their template uses it.
Reported-by: kshitijk4poor
`gateway.ping` is answered by the socket before dispatch, and a few
store-wide session reads and the foreign-history import do reach the older
handler; the page said every frame reached the authority and that no
session method ever fell back.
The attached-client page listed a hand-picked "Method catalog (selected)"
that included methods the shared gateway's /api/ws socket refuses
(session.title, session.usage, session.activate, session.compress,
session.branch, session.close, session.status). Nothing told a client
author that `x-canonical-methods` (53 names) is the set of methods with a
hermes-gateway-v1 wire model of their own, not the set the gateway serves
(it serves 114), or that some methods only reach an older handler.
`scripts/gen_serve_handler_ledger.py` already derives, per method, how
/api/ws answers it. It now also writes that split into the page between
markers, and its `--check` and test fail when the page is stale. The page
explains the authority-first dispatch, the older-handler rule, and what
`x-canonical-methods` means, and the live-session paragraph names the
methods to use on the shared gateway.
The salvaged check only refused a bump when gateway.lock's JSON record
named a live pid. ProfileOwnership.reserve() takes the flock before it
writes the record, and a recorded pid cannot be checked across PID
namespaces (#123081), so a real owner could still be fenced out. The
flock (runtime_lock_held_elsewhere) now decides; a record naming this
pid in this PID namespace is our own reservation (gateway, served
secondary, offline-dashboard maintenance), which a flock probe from
this process would otherwise read as foreign. In-memory/URI stores
have no profile home and are skipped.
Tests hold the lock with a real ProfileOwnership in a child process and
cover a holder whose record is unpublished.
Fixes#142330
begin_runtime_epoch()'s own docstring said the caller MUST hold the
profile ownership lock, but nothing checked it: any process that could
open the store could bump the epoch, and the epoch is the fence every
write is checked against. The owner captures it ONCE at boot, so a
stray bump left the live gateway permanently behind the fence - every
write on that store failed with stale_epoch until the gateway
restarted, and /reset did not recover it. An ordinary agent turn could
reach it: a script that opens the store and calls it.
The bump is a takeover, so it may only happen when no live owner holds
the profile: the check refuses it while the profile's gateway.lock
names a live foreign holder. The caller that HOLDS the lock is always
allowed (the lock is exclusive, so no foreign holder can exist while it
is held), and a store nobody owns is free to be taken over - that is
what the bump means.
tickets --serve answers purpose interactive with the WebSocket ticket Desktop's local connection asks for (session-ticket, scope host, the store's 30 s TTL), so an SSH client's one socket selects every profile the gateway serves. The probe lists the purpose. A profile on such a request is invalid_request. The ticket attach returns is unchanged.
A --serve request line may name another profile the same gateway serves ("profile"), and --serve
also mints native-profile-create and native-profile-registry: the grants Desktop's local
connection uses for ?profile= routes and for profile create/rename/delete, asked of the same
control socket. Without "profile" a request is answered exactly as before. --probe lists the new
purposes and reports windows_service_session. The gateway is unchanged.
A line nested too deeply for the JSON decoder raised RecursionError, which the reply path did not catch: the command exited 1 with a traceback and answered neither that line nor the next. Treat it as invalid_request, and read stdin with a 64 KiB line limit: a longer line is dropped as it is read and gets one invalid_request reply.
`--probe --json` prints the protocol version and the ticket purposes and touches no
gateway. `--serve --json` finds the running gateway as `attach` does (never starts one),
prints a hello line with its endpoint, then answers each stdin request line with one
single-use native-http ticket until stdin closes.
The mint is the one `attach` already uses, moved into `mint_ticket` so both commands
share its error mapping. Adds the client contract page for SSH clients.
The warning and the docs offered `hermes gateway install` as a remedy. Registered through the UAC
hand-off, the install can start the gateway elevated (#152218), which trades gateway_other_session
for gateway_elevated. Recommend only starting Hermes from a normal (non-administrator) window on
that machine's desktop, as CLIENT_ELEVATED_REMEDY already does.
`hermes gateway attach --json` now always carries
`start_context.windows_service_session`: true when the caller runs
elevated in Windows session 0 (an administrator OpenSSH login), false
everywhere else. A gateway started from such a login refuses the user's
desktop apps with gateway_other_session, so `attach --start` prints a
one-line stderr warning there. It still starts the gateway and exits
with the same code.
Greptile: Dashboard wrapping changes fail / Invalid inputs are accepted /
The input type excludes reset / The oversized store keeps growing.
wrap_response joins _DASHBOARD_UPDATABLE_FIELDS; CronJobCreate uses StrictBool;
cronjob() annotates bool | str; the catch_up and wrap_response tri-state
normalizers move to cron/jobs_tristate.py so cron/jobs.py is 3 lines under its
origin/main size.
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.
* fix(plugins): pin liveness endpoint URL to loopback, harden manifest liveness parsing
A manifest's liveness.endpoint_path was concatenated verbatim onto the
loopback URL read from the app's runtime server.json and re-parsed by the
probe, so a crafted tail like '@attacker.example/' rewrote the URL authority
and the initialize request carried the runtime file's bearer token to a
manifest-chosen host.
Now the declaration parser only admits a plain path charset (no '@', '?',
'#', whitespace, scheme, or '..' segments), the resolver re-parses the fully
composed URL and requires it to stay on a loopback host with the same port
and no userinfo, and _mcp_initialize re-verifies scheme/host/port before the
socket opens so the transport-facing endpoint() path is covered too.
Adjacent hardening in the same surface: liveness.path must be a rooted
filesystem path in both parse surfaces, server.json key overrides must be
simple key names, malformed pids (bool, >int32) degrade instead of crashing
os.kill, a non-mapping 'fields' value raises ValueError inside the fail-closed
contract instead of TypeError, and a manifest whose liveness fails validation
renders 'unknown' on the catalog card instead of 'present'.
* test(plugins): satisfy ruff PLR0402 in salvaged liveness test
Follow-up to the salvaged #125745 commit after rebasing onto main.
Refs #125744
* test(plugins): build hostile-endpoint fixture with a valid AppLocation tuple
AppDef.locations is tuple[AppLocation, ...]; the fixture passed a bare
string, which only worked because endpoint() never reads locations.
Refs #125744
---------
Co-authored-by: beardthelion <beardthelion@users.noreply.github.com>
A plugin-injected turn that waits for the session's background review and
plugin forks stopped waiting only when a person's message was queued behind
it. A message accepted as a steer (steer mode or /steer) or as an
interrupt-mode redirect goes straight into the running turn and is never
queued, so the turn kept waiting, up to the full 120 s, before it
superseded the background work.
Every accepted steer and redirect passes through _fold_into_running_turn;
it now ends the session's plugin wait the same way a queued message does,
and the background work is cancelled as for any person's turn. Another
plugin's message still does not end the wait.
A plugin-injected turn waits up to 120 s for the session's running
background review and plugin forks before it starts. A person's message
that arrived while it waited queued behind that wait, so the person's
turn started up to 120 s late; a gateway shutdown sat out the same wait
past its drain budget.
The wait now ends at once when a person's input is queued for the
session behind the injected turn (checked on every admission's arrival,
and once when the wait begins), or when the gateway drains or the
profile retires. The background work is then cancelled the same way a
person's turn cancels it, and the FIFO order is unchanged: the injected
turn runs, then the person's.
The plugin LLM access guide states the rule and the shutdown behavior.
A message a plugin injects started a turn that superseded the session's
running background review and plugin forks at once, the same as a turn a
person started: the user's own self-learning review ended with no result.
A turn the gateway runs for a plugin's FIFO admission now waits up to 120 s
for the review and the launched forks already running on that session, then
cancels whatever is still running. An interrupt of the session agent ends
the wait early. A person's turn is unchanged and supersedes them at once.
Running the turn alongside the review instead is not an option: they share
the session id, so their usage would be counted twice.
The plugin LLM access guide says plugins should not rely on an injected
turn to cancel background work.
The self-updater gate rejects any plugin script that both fetches from
GitHub and writes or renames files. rom-studio (#153798) trips it on
kit/kit.ts, which downloads the third-party poryscript 3.6.1 compiler
from its own release, checks a fixed sha256 and unpacks it into
kit/.cache. It never fetches or replaces rom-studio's own files, so the
pin stays the only update path (README rule 3).
Teknium ruled to allow it. A maintainer now lists such a file in
scripts/ci/catalog_self_updater_allowlist.json by repo, pinned sha, path
and the file's sha256: a re-pin, an edit to that file or a second
fetching file is gated again. The list lives under scripts/ci/, which an
entry PR may not touch (catalog_changed_entries.py), so a submitter
cannot add themselves. Rule 3 in both rule blocks names the exception.
A provider plugin was imported once per process, and the forced plugin sweep
skips model providers, so an update never reached a running gateway. A plugin
importing part of its package on first use then ran one new file against
siblings loaded from the old tree (cannot import name ...), while the update
surfaces said nothing needed a restart.
The forced sweep now re-scans the profile's provider plugins; one whose tree
changed (catalog pin, else file mtimes) is dropped whole (package, submodules,
its profiles) and imported again. hermes plugins update reports activation like
install/enable, the gateway auto-apply tick reloads in-process, and a model
provider's activation summary says it was reloaded or why it failed.
Fixes#153300
Catalog listings were being used to promote individual tokens (a listed
plugin's maker posting its contract address on X), and memecoin boards,
coin launchpads and airdrop farmers passed review on clean code alone
because no rule covered what a plugin is for. Rule 20 declines plugins
built around one non-mainstream coin, token or NFT collection and plugins
used to promote their maker's own token, while keeping stablecoins,
payments, multi-coin wallets and markets, tickers, safety checks and
Bitcoin/Ethereum/Solana-level assets welcome. Mirrored into the
catalog-submission guide (rules mirror test).
Idle-task workers were detached threads that always wrote the task's
state when the plugin's function returned, so a run still going when the
gateway stopped (or the multiplexer restarted in the same process) wrote
profile state after housekeeping had stopped.
Gateway housekeeping now polls idle tasks under a stop fence tied to its
stop event. Once housekeeping stops, no run starts under it; when the loop
exits it waits a bounded time (inside the housekeeping drain budget) for
its runs and returns. A run that ends after the stop records nothing: the
task's state stays as it was before the run, so the task runs again on a
later poll, and the run still releases its claim. Closing the fence waits
for a record in progress, so none lands after the stop. Plugin code cannot
be stopped; the idle-task contract now says so and states the guarantee.
Hosts without a stop (CLI/TUI startup, the serve maintenance tick) are
unchanged.
The idle-job run claim (curator and plugin idle tasks) recorded only the
owner's pid and was reclaimed only after an hour, so a gateway that crashed
or was killed mid-run kept the task suppressed for an hour after restart.
The claim now records the owner's pid, process start time and machine
(boot id + PID 1 start). A claim whose owner is gone, or whose pid now
belongs to a process with another start time, is taken over at the next
poll; a live owner's claim is never taken, however old. A claim whose owner
cannot be checked (a bare pid from an older Hermes, another machine, no
readable start time) keeps the hour rule. Takeovers and releases unlink the
lock under a cross-process guard file, so two claimants of a dead claim
never both win and a release never removes a claim another process took.
Both APIs may still change shape, so the plugin guide now says so and tells a
plugin how to stay portable: keep the fork handle in one small function that
returns plain data, and treat fork_session as optional. It returns None when
the request is refused, and under plugins.isolation: host it raises
PluginHostUnsupported, since the handle tracks a thread of the live session
agent inside the Hermes process.
The guide also states the idle-task contract: fn runs on its own thread and
the host does not wait for it, so a run should keep its own time limit, work
in small checkpointed batches and be safe to repeat.
Plugin idle tasks ran synchronously on the thread that polled them. On the
gateway that is the housekeeping thread: it also stamps the runtime
heartbeat and runs the cron delivery drain, the misfire catch-up, the plugin
update check and state.db maintenance. An idle task that made model calls for
minutes stalled all of them, and after two minutes gateway status reported
the live gateway as wedged.
Each due task now starts on its own thread, carrying the poller's profile
home and secret scope, and the poll returns at once. The run claim still
keeps one run at a time across pollers and processes, and a run of this
process is never doubled even when it outlasts the claim's stale age. The
worker records the run and releases the claim when the task returns or
raises. The curator's own pass is unchanged.
Tool Search defers every plugin tool by default, so the session's tools[] carry the
tool_search / tool_describe / tool_call bridges instead of the tool, and a fork naming
its own tool was refused tools_not_in_session.
A requested tool is now in the session when its captured tools[] advertise it, or when
those tools[] carry tool_call and the name is in the session's deferred catalog (the
classification the session's own tool_call unwrap uses). For a deferred tool, core
appends one line to the prompt: call it through tool_call, with the tool's parameters.
tools[] stay the session's, byte for byte. Inside the fork tool_call is only a carrier:
the dispatch guard sees its unwrapped target, so a tool_call to an unrequested, foreign,
core or connector tool is denied, and tool_search / tool_describe stay refused.
handle.actions lists the carried tool.
Fork ownership came from the plugin registration ledger by exact name, but
the dispatcher serves some names before the tool registry: connector names
(connectors__<connector>__<tool>), the session's memory-provider tools, its
context-engine tools, agent-level tools, legacy aliases and the Tool Search
bridge. A plugin that registered such a name had it admitted to its fork
while the call reached a connector, memory provider or context engine.
pre_registry_route() in agent/inline_tool_executors.py now answers which
seam serves a name before the registry, using the dispatcher's own checks;
the sequential and concurrent paths read the memory-provider and
context-engine membership through the same helpers. The fork allowlist
admits a name only when that predicate returns None and the plugin owns
the live registration: at request time against the lease's session agent
(token unspent on refusal), and when the fork starts against both the
session agent and the fork that dispatches.
_launch registered the job and marked it launched before building and starting
the worker, outside any exception handling. When spawn_context_thread or
Thread.start raised, the exception crossed fork_session's no-raise boundary,
the handle stayed running, the job stayed in the parent's registry and its
request exit was never published, so every later live turn spent the full
cancellation deadline waiting on a run that could never acknowledge. The
launcher now unregisters the job under the registry lock, publishes its
request exit and settles the handle error:spawn; fork_session returns that
settled handle.
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.
The next-turn cancel and timeout interrupt the fork and the handle settles when its
worker exits, so a provider call that ignores the interrupt keeps the handle open.
refused:parent_gone joins moa, agent_provider and runtime_changed in the outcome list.
A plugin task could inherit_from any core auxiliary block and resolve to its provider,
model, endpoint and key, so a plugin without allow_task_override could still spend
through an operator-configured built-in route (background_review, curator, ...) by
naming its own inheriting task. Read-time resolution now carries a core base's route
fields (provider, model, base_url, api_key, api_mode, key env, reasoning_effort,
extra_body, fallback_chain) only when the owning plugin holds allow_task_override,
including through a chain of plugin tasks rooted in a core block; non-route policy
such as timeout still inherits. inherit_from accepts the picker tasks plus an explicit
list (background_review, curator) instead of every current and future core block.
Only launched forks were registered on the parent, so the next turn's interrupt missed a
fork still queued for machine idle (the idle dispatcher launched it later) and one between
_launch's cancel check and its registration. Every fork is now registered on its parent
from the moment it is deferred or launched; the interrupt fences all of them, settling a
never-launched fork as cancelled, releasing its idle-queue slot and publishing its request
exit. _launch checks and registers under the same lock, and the interrupt records the turn
it fenced, so a fork of that turn reaching registration afterwards is refused.
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.
register_auxiliary_task only accepted picker tasks (main_provider_setup._AUX_TASKS) or
plugin-registered keys as an inherit_from base, so inherit_from="background_review" was
silently dropped and a plugin fork's task= lane ran on the session model instead of
following auxiliary.background_review. Any dict block under DEFAULT_CONFIG["auxiliary"] is
now a valid base, resolved at read time like the others.
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.