Commit Graph
1131 Commits
Author SHA1 Message Date
teknium1 ed7eb5685a docs(vision): document vision.embed_target_bytes and vision.max_calls_per_image
User-visible knobs need a home: the Vision feature page explains why native embeds ride
the session and what each key does (subagent-only default cap, clamp range), the
configuration reference points at it next to auxiliary.vision so the two sections are
not confused, cli-config.yaml.example carries the commented block, and tools/AGENTS.md
names vision_tools_history_budget.py as the single owner of embed-cost policy.
2026-09-17 09:02:55 -07:00
teknium1 d6add16059 fix(auth): dead OAuth logins are reported once and leave rotation; hints point at hermes auth
A terminally rejected refresh token (invalid_grant / invalid_token /
refresh_token_reused) is the moment a login is lost. Three gaps remained
after #113197 (which added the WARNING for Codex/xAI/Nous):

- Anthropic: the token endpoint's HTTPError carried no classifiable code,
  so a dead Anthropic / Claude Code grant fell through to a transient
  'exhausted' bench at DEBUG and was replayed every hour. The endpoint
  error is now a structured AnthropicOAuthError (status + OAuth error
  code); _recover_failed_refresh logs one WARNING with the repair command
  and marks the row DEAD. A dead grant is not replayed at the fallback
  endpoint. The auxiliary Claude Code refresher (sibling path) warns the
  same way. Claude Code's own credentials file is never touched.
- Codex/xAI/Nous: _quarantine_sources drops only singleton-seeded rows, so
  an independent `hermes auth add` (manual:*) login survived unmarked and
  re-fired the WARNING on every later refresh attempt. The survivor is now
  marked DEAD (leaves rotation until a write-side re-auth clears it).
- Hints on live Hermes paths (anthropic 401 troubleshooting block, the
  no-credentials error) recommended an external CLI's login command,
  which cannot repair Hermes' own login; they now say
  `hermes auth add anthropic` / `hermes auth list anthropic`.

Docs: credential-pools.md documents the dead-login behaviour.
Part of #113023.
2026-09-17 09:02:26 -07:00
teknium1 3187d68b49 fix(kanban): goal_mode workers keep the live tool feed in their worker log
The dispatcher forced `-Q` on goal_mode cards because cli.py only ran the
kanban judge loop in the fully-quiet one-shot branch. `-Q` strips every tool
callback, so the dashboard's Worker log (and `hermes kanban log`) stayed
blank for the whole run while non-goal cards logged normally; users read
that as "the worker is doing nothing" (Discord report, Sep 2026).

Run the judge loop on the `-q` path too, driving follow-up turns through
cli.chat so each turn's tool activity lands on stdout (= the worker log),
and print each judge verdict there as well. The dispatcher spawns goal_mode
and one-shot workers with the identical argv; the mode travels only in
HERMES_KANBAN_GOAL_MODE. The `-Q` hook stays for manual quiet runs.

Live A/B (real `hermes kanban dispatch` + spawned worker against a scripted
loopback provider that answers a terminal tool call then text, judge always
"continue", --goal-max-turns 2): base log = 94 bytes, 0 tool-feed lines,
0 verdict lines; fix log = 1910 bytes, 4 tool-feed lines, 3 verdict lines;
both arms end blocked "exhausted 2/2 turns" (loop behaviour unchanged).
2026-09-17 08:55:01 -07:00
teknium1 9269b19e4f fix(cron): restart-safe worker imports the gateway's own checkout instead of relying on cwd
The external cron worker is spawned as `sys.executable -m cron.scheduler`. Its
entry module is `cron.scheduler`, not `hermes_cli.main`, so it never runs the
bootstrap that puts the checkout on the gateway's sys.path; it only imported
`cron` at all through the implicit `-m` cwd entry (cwd was already the repo
root). That implicit path breaks on real hosts: a venv whose editable install
maps a moved or deleted checkout (the finder in this repo's own venv points at a
worktree that no longer exists), or a host that sets PYTHONSAFEPATH so `-m`
ignores cwd. The worker then dies with "No module named 'cron'" before its
ownership ack and every fire records
"cron external worker exited before ownership acknowledgement (exit 1)" (#112729).

The shared subprocess sanitizer strips Hermes-owned PYTHONPATH entries because
user children must not see our tree; this child IS Hermes, so after the env is
built the worker gets an explicit PYTHONPATH: the checkout `cron/scheduler.py`
lives in first, then whatever PYTHONPATH the gateway itself was started with.
The cwd stays the same checkout. Kanban workers spawn `-m hermes_cli.main` and
already get the bootstrap, so this is the only affected entry point.

Live probe (worktree python from cwd=/tmp with PYTHONSAFEPATH=1, real
_launch_external_cron_worker + real Popen): before, the worker stderr tail is
"Error while finding module specification for 'cron.scheduler'
(ModuleNotFoundError: No module named 'cron')"; after, the worker imports
cron.scheduler, loads the payload and reaches the durable-ownership check.

The two review minors on the first pass (worker unlinks its own stderr capture;
comments no longer claim DEVNULL) already landed in f857a4ed99 and are covered
by that PR's tests.
2026-09-17 08:54:39 -07:00
teknium1 cdc4fc4c8f fix(kanban): only a handoff to a different profile lifts the active_pr guard
The handoff exemption treated ANY `assigned` event after the PR comment as a
handoff. A no-op same-profile assign (`hermes kanban assign <id> dev`,
dashboard PATCH /tasks/{id}, `reassign --reclaim`), an unassign
(`assignee: null`), and the dispatcher's own `kanban.default_assignee`
fill-in all record an `assigned` event without changing the owner — and each
lifted `active_pr` for the very implementer that opened the PR, re-spawning
it against its own PR. That is the duplicate-work protection #111910 says
must be preserved.

`assign_task` now records `from` in the payload and the guard counts an
`assigned` event as a handoff only when it moves the card to a different,
non-null profile and was not written by the default-assignee pass. Events
without `from` (pre-existing rows) are not trusted — fail closed.

Docs sentence qualified accordingly.
2026-09-17 08:52:53 -07:00
teknium1 2e805005ea fix(kanban): active_pr respawn guard no longer holds a card handed to a closer or back to its implementer
A ready card whose recent comment links a GitHub PR is held by the
``active_pr`` respawn guard for every assignee. That stopped exactly the
spawns the PR evidence calls for: an operator reassigning the card to a
closer/recovery profile, and a reviewer's changes-requested verdict
routing it back to the implementer to fix that PR — the card sat in
``ready`` as ``respawn_guarded=active_pr`` with zero workers (#111910).

``check_respawn_guard`` now lifts ``active_pr`` when a handoff event
(``assigned``, ``changes_requested``, ``review_reopened``) was recorded
strictly after the newest PR comment: the handoff names the profile that
must work on that PR, so it is not a duplicate implementation. Duplicate
protection is kept: no handoff (a crash/reclaim is not one) leaves the
opener guarded, a newer PR comment after the handoff guards again,
same-second ties stay guarded, and ``recent_success`` is untouched. The
review-lane exemption from a235d1917e stands unchanged.

Docs: the kanban respawn-guard section names both supported routes
(``request-review`` and ``assign``).
2026-09-17 08:52:53 -07:00
teknium1 3f1bf45adf docs(cron): permanent-error parks block the job; reconnecting notice is once per outage 2026-09-17 08:51:30 -07:00
teknium1 6924cc66fb fix(cron): run a job whose enabled_toolsets MCP server is only reconnecting, instead of blocking it
A cron job naming an MCP server in its enabled_toolsets was hard-blocked
(blocked_config, one-shot alert, no LLM call) whenever that server resolved
to zero tools — including the minute a router reboot or DNS blip left an
otherwise healthy server parked and self-probing. The preflight could not
tell "the network blinked" from "wrong name / other profile's server", and
the job lost a whole tick to a transient outage the MCP layer was already
recovering from on its own (#112871).

The MCP run task keeps that distinction: a server that connected once in
this process (_ever_connected) and is currently sessionless with a live
task is degraded/parked and will revive. tools.mcp_tool_discovery grows a
read-only mcp_server_reconnecting(name) predicate on that state (resolved
through the profile's own or adopted connection key, never connecting),
and _empty_requested_mcp_toolsets skips such servers with a WARNING that
names them — the job runs with whatever tools did resolve, as the reporter
asked. A server that never connected for this profile keeps the block,
which is the misconfiguration case #109050 built the check for. The
blocked reason now says "never connected for this profile" so the
remaining block reads as what it is.

Docs: the pre-dispatch validation section lists the MCP check and the
reconnecting exemption.
2026-09-17 08:51:30 -07:00
teknium1 0bd85d314c fix(skills): keep absorbed_into in the delete shape; decide every patch shape miss pre-effect
The per-action schema made the delete branch `additionalProperties: false`
with no `absorbed_into`, so a schema-validating or grammar-constrained
backend could no longer emit the curator's consolidation delete and
`_curator_consolidation_delete_guard` fail-closed every consolidation.
Advertise `absorbed_into` on the delete branch and cover the batch path
that forwards it to the guard.

Also fold the two remaining patch shape checks (missing new_string,
content mixed with old_string/new_string) into `_op_shape_error`, so a
batch rejects them before applying any sibling instead of creating op[0]
and rolling it back. Drop the stale `edit` vocabulary from skills.md:440
and the curator prompt, and move the schema-diet test helpers above the
`__main__` guard.
2026-09-17 08:47:01 -07:00
teknium1 75a0649a18 fix(skills): skill_manage advertises one shape per action; a misfiled text slot fails before any op applies
The operations[] item schema was one flat object with four coexisting text
slots (content / new_string / file_content / file_path). A 27B local model
that had just used write_file's file_content kept emitting it on create and
patch ops; the call validated against the advertised schema, the handler
failed on "content is required", and the whole batch rolled back — eight
identical retries until the tool-loop guardrail tripped (#112677).

- items is now an anyOf of self-contained per-action op objects (create,
  patch targeted, patch full-rewrite, write_file, remove_file, delete), each
  with additionalProperties: false. The wire shape of a correct call is
  unchanged (still a flat op with name/action/...), so transcripts, staging
  and replay are untouched; grammar-constrained backends can no longer emit
  another action's slot, and schema-validating providers reject it up front.
  Nested (non-top-level) anyOf survives every sanitizer (schema_sanitizer,
  Gemini legacy translator). Cost: parameters JSON 1352 -> 2414 bytes.
- _validate_batch_ops runs the per-op argument-shape check (_op_shape_error)
  before any op is applied, so a misfiled op[1] no longer applies op[0] and
  then rolls the batch back; the error carries the same misplaced-key hint.
- The hint is attached to argument-shape misses only: a patch whose real
  problem is an unmatched old_string is no longer told to "move that text to
  'content' (full rewrite)", the escape the patch error itself warns against.
- Shape tables (_REQUIRED_ARGS, text-slot maps, _misplaced_text_hint,
  _op_shape_error) move out of the facade into skill_manager_batch.py, the
  op-validation sibling; _patch_skill shares the old_string guidance text.
- Docs: skills.md Actions table states the one-slot-per-action contract.
2026-09-17 08:47:01 -07:00
teknium1 170d616ca6 fix(anthropic): merged user turns keep each turn as its own text block
_concat_content joined two string user contents into one "a\nb" string when
_merge_consecutive_roles collapsed adjacent user turns for the Anthropic
Messages wire. For a MoA aggregator on that wire, iteration 1 of a turn ends
[user(task), user(guidance)] and was sent as user("task\n<guidance>"), while
iteration 2 replays user("task") alone, so the prompt-cache prefix diverged
at the first user block and the #112358 collapse persisted there (the
first-pass fix in #113175 only covered the OpenAI-compatible wire).

Merged turns are now always a block list with each side's blocks intact (a
string becomes one text block), matching what the list+list and list+str
shapes already did. The task block is byte-identical to the standalone turn
later iterations replay, a cache_control marker on it stays put, and the
guidance follows as its own text block. Assistant merges are unaffected
(assistant content is already a block list).

Bedrock Converse and native Gemini already merge at block/part granularity,
so the docs' Anthropic/Converse/Gemini fold caveat is replaced with the
accurate statement and the byte-identical-extension claim no longer needs
the OpenAI-compatible scope.

Part of #112358
2026-09-17 08:46:05 -07:00
kshitijk4poor 723e3fb9ae docs(computer-use): screenshot eviction fires at the provider limit, not keep-3 2026-09-17 13:52:36 +05:30
teknium1 6271299190 docs(kanban): name the supported route for recovering a card held by active_pr
The ready-lane guards (recent_success, active_pr) stop duplicate
implementation; the review lane is exempt and request-review accepts a
ready card, so a reviewer/closer profile can be put on a card whose PR is
open without DB edits or comment stripping. Operators could see the hold
reason (#112244) but not the route. Part of #111910.
2026-09-16 17:49:17 -07:00
teknium1 f9745c1e3b docs(kanban): worker guidance is scoped to the owning worker
User docs say who receives the worker protocol (only the dispatcher-spawned
worker that owns the task) and the kanban AGENTS section names the helper
the guidance and stop-nudge injection sites use, so the next prompt-side
HERMES_KANBAN_TASK reader does not grow its own predicate. Other readers on
main pair the env read with is_dispatcher_owned_worker_context() and are
described as such rather than rerouted.
2026-09-16 17:48:48 -07:00
teknium1 d89a7db132 docs(web): a per-capability web key no longer counts as the shared selection
The web-search guide said autodetect runs only when no web selection —
including per-capability keys — was ever written. After #113046 the
no-ladder branch is keyed on the SHARED selection (web.backend / the
managed hermes tools row); a lone web.search_backend / web.extract_backend
names only its own capability and the other keeps its cascade. Say so,
because the old wording described the behaviour #113017 reports as a bug.
2026-09-16 17:43:40 -07:00
teknium1 5457c48df2 fix: bound the index-miss fallback and skip it under provider filters and index timeouts
Review of the fallback pass added in the previous commit found three ways it
could burn the search budget without ever being able to return anything:

- A provider filter (`--source nvidia`) selects like "all", so an index miss
  fanned out to skills.sh/ClawHub/LobeHub/well-known whose results carry no
  `extra.provider` and were then all cut by `_filter_results_by_provider` —
  four guaranteed-empty network calls and, with ClawHub slow, the whole 30 s
  budget. `_index_miss_fallback_sources` now takes the provider filter and
  returns [] when one is active.
- The fallback ran until the shared `overall_timeout` deadline, so any
  unfiltered miss (a typo) stalled CLI/TUI/dashboard for the callers' full 30 s
  whenever ClawHub (documented here as taking minutes) was slow, where the
  index alone answered instantly. The pass now gets its own budget,
  `min(remaining, _INDEX_MISS_FALLBACK_BUDGET=8 s)`.
- `if source_counts.get("hermes-index")` treated an index that TIMED OUT (key
  absent) as a miss, so the fallback fired with no budget left and `_fan_out`
  appended every fallback registry to `timed_out_ids` without calling it —
  the dashboard then blamed skills.sh/ClawHub/LobeHub falsely. Fallback now
  requires the index to have completed with zero results (`== 0`).

One invariant test per major, each red on the previous commit (the budget
test stalls 5 s there; the provider test makes registry calls there).
Docs paragraph updated to state the 8 s cap and the provider-filter carve-out.
2026-09-16 17:43:11 -07:00
teknium1andKoNit-K 13dcfc112b fix(skills): hub search falls back to the registries when the index has no match
`hermes skills search <q>`, the TUI gateway search and the dashboard
`/api/skills/hub/search` all returned zero results for a skill that is live
on skills.sh but not yet in the cached centralized index: with an available
index `_select_active_sources` drops every external registry, and nothing
re-asked them when the index came back empty.

`parallel_search_sources` — the one chokepoint every surface calls — now
re-queries the registries the index displaced (skills.sh, ClawHub, LobeHub,
well-known) when a non-empty query got no index match, inside the same
`overall_timeout` (a shared deadline, so the 30 s budget never doubles).
GitHub stays out of the fallback: a single miss (typo) would otherwise spend
an unauthenticated user's whole hourly GitHub budget. Browse (empty query),
index hits and explicit `--source` filters are unchanged.

The fan-out loop moved into `_fan_out` so both passes share the pool/timeout
handling instead of duplicating it.

Slimmer redo of #112509 (@KoNit-K), which put the fallback at the same
chokepoint but only for skills.sh and with a second copy of the pool code.
Fallback shape follows the reporter's Option A.

Fixes #112503

Co-authored-by: KoNit-K <124019182+KoNit-K@users.noreply.github.com>
2026-09-16 17:43:11 -07:00
teknium1 b86385cc1a docs: goal continuations and loop wakeups also stop quoting the message that set them
_synthetic_prompt_event drops source.message_id for every synthetic prompt
(heartbeat ticks, /goal continuations, /loop wakeups), not only heartbeats:
none of them is a reply to the message that registered the watch. The
heartbeat page said so; the goals and loops pages did not, so state the
behaviour change where those users read it.
2026-09-16 17:23:01 -07:00
680735174a fix(gateway): scheduled heartbeats end silently, emit no progress and quote no stale message
Slim follow-up on the #112160 pick (KoNit-K) that also lands the #113031 mechanism:

- gateway/response_filters.py::display_kind_for_event maps the poller-stamped
  `_heartbeat_session_id` provenance to the machinery display kind, so a bare
  NO_REPLY / [SILENT] on a scheduled heartbeat turn is honoured instead of being
  replaced with the "model returned only a silence marker" warning every interval.
  The event stays non-internal on purpose: authorization and the emergency stop
  still apply (test_idle_wake_coalesces_intervals_while_adapter_owns_turn).
  Ported from #112279 (earliest filer), collapsed onto the existing stamp instead
  of a second flag.
- gateway/run_goals.py::_synthetic_prompt_event drops the stored source's
  message_id: a synthetic prompt is not a reply to the message that registered
  the watch, and every consumer (progress, status, footer, final reply) fell back
  to it as the Telegram reply anchor — the stale quote in #112149. Telegram DM
  topics route anchorless via direct_messages_topic_id (designed path), so this
  replaces #112160's allow_source_message_id_fallback plumbing across
  platforms/base.py, run.py and run_turn.py (dropped hunks).
- gateway/platforms/base.py: no typing indicator for a heartbeat turn (re-applied
  from #112160 after taking main's file back).
- Tests: poller test asserts the provenance + anchorless source (red on base);
  test_gateway_silence_tokens gains the heartbeat-silence invariant (red on base).
  #112160's _thread_metadata_for_event test dropped with its mechanism.
- Docs: heartbeat page documents the quiet turn.

Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
Co-authored-by: MrAtkeens <99114477+MrAtkeens@users.noreply.github.com>
2026-09-16 17:23:01 -07:00
teknium1andea-s21 f41ad3bc0a fix(gateway,cron): key Matrix handoff/cron thread seeds the way Matrix replies are keyed
A Matrix `attach_to_session` cron delivery and a CLI→Matrix `/handoff` now land in their own
thread AND a human reply in that thread continues the seeded session (#112918).

The salvaged `MatrixAdapter.create_handoff_thread` (ea-s21, #108367) gives both seeders a
thread root. The second half of the bug is a key-shape mismatch: the handoff watcher and
`_seed_cron_thread_session` seeded `matrix🧵<room>:<root>` while the adapter keys every
in-thread reply on the ROOM's type (`matrix:group|dm:<room>:<root>`), so seed and reply never
met. Following the direction landed for Slack in 1f3f45e87b (#111896), the seeders now mirror
the adapter instead of the adapter moving onto a `thread` slot: rekeying inbound Matrix threads
would orphan every existing Matrix thread session and drop `is_group` in authz for in-thread
messages (`_GROUP_CHAT_TYPES` has no `thread`).

- gateway/run_startup.py: Matrix destinations key `dm`/`group` from the adapter's
  `get_chat_info` (`_handoff_home_is_dm`).
- cron/scheduler_delivery.py: `_THREAD_REPLY_CHAT_TYPE` — Slack and Matrix non-DM thread seeds
  use `group`. Slack channel cron threads had the same mismatch (adapter `build_source` keys
  `group`; the seed said `thread`); the two cron tests that pinned `thread` for Slack channels
  asserted the wrong shape and now assert the adapter's.
- Dropped from #108367: the `chat_type="thread"` inbound rekey (see above) and its tests;
  contributor tests trimmed to two invariants.
- Docs: Matrix listed among thread-capable handoff/cron platforms.

Live probe (in-process, real MatrixAdapter + real handoff destination + real cron seeder):
before  create_handoff_thread -> None; handoff key matrix:thread:… ≠ inbound matrix:group:…;
        cron seed matrix:thread:… ≠ inbound
after   create_handoff_thread -> '$seed'; handoff == inbound == cron seed (room and DM cases)

Co-authored-by: ea-s21 <190767603+ea-s21@users.noreply.github.com>
2026-09-16 17:18:44 -07:00
teknium1 026551488f docs(moa): scope the byte-stable aggregator prefix claim to OpenAI-compatible wires
Review follow-up for #112358: the Anthropic Messages / Converse / native
Gemini converters merge adjacent user turns, so on those wires the
guidance is still folded into user(task) on iteration 1 and the prefix
diverges at the task block; the docs claimed a byte-identical extension
for every request. Also name the trade-off in the attach docstring (two
adjacent user turns on the OpenAI-compatible wire) and stop calling the
reference cost "per iteration" — with the default fanout references run
once per user turn.
2026-09-16 17:18:10 -07:00
teknium1 f3e62619c7 fix(moa): keep the aggregator prefix byte-stable across tool-loop iterations
Attach the per-turn reference guidance as its own trailing user message
instead of merging it into a trailing user turn. Iteration 1 of every user
turn ends on user(task), so the merged user(task + guidance) byte-differed
from the user(task) that iteration 2+ replayed: the provider prefix cache
collapsed to the system prompt + tool schemas on the second call of every
turn (#112358 — cachedTokens pinned at the system prompt while uncached
input grew 14k -> 214k on a Nous/OpenAI aggregator).

peel_reference_guidance shrinks to the one attach shape (plain string, or
its cache-decorated single text part) so a breakpoint never lands on the
guidance. Converters that require strict alternation (Anthropic Messages,
Converse, native Gemini) already merge adjacent same-role turns.

Live wire probe (loopback server, two user turns x two iterations, real
MoA facade -> call_llm(nous)): before, request i+1 diverged from request i
at messages[1] (user task) on the second iteration of each turn; after,
every request's messages[:-1] is a byte prefix of the next. The same probe
shows the aggregator already carries the main loop's sticky session_id +
tags on the nous provider, so the routing hypothesis is not a Hermes gap.
2026-09-16 17:18:10 -07:00
teknium1 095de7ffd0 fix(prompt_builder): keep blocking a distribution-owned SOUL.md on a scanner hit
The user_authored=True exemption assumed nothing but the user can put a SOUL.md
into HERMES_HOME. That is false: `hermes profile install <git-url>` and
`hermes profile update` (hermes_cli/profile_distribution.py, DEFAULT_DIST_OWNED)
copy a third party's SOUL.md into the profile home with no scan and no approval
gate, so an injection phrase that main BLOCKED would load into the system prompt
with only a log line.

load_soul_md now reads the home's distribution.yaml via the existing
read_manifest() and only passes user_authored=True when there is no manifest or
its explicit `distribution_owned` list omits SOUL.md (a manifest without the list
owns the whole payload); an unparseable manifest fails closed. Invariant test
plants the phrase, checks it loads bare and blocks once write_manifest() marks
the home as a distribution. Docs/docstring drop the false "no repository checkout
can plant it" claim, scope the approval gate to file-tool writes, and state the
distribution caveat.
2026-09-16 17:17:47 -07:00
teknium1 7bb4336811 fix(prompt_builder): load the user's own SOUL.md on a scanner hit instead of blocking it
A SOUL.md in HERMES_HOME that *documents* the canonical injection phrase as
security guidance ("...content telling you to ignore previous instructions...")
was replaced wholesale by a [BLOCKED: SOUL.md ...] marker, so the agent ran
with no identity/constitution and only a one-line agent.log warning said so.

SOUL.md is the user's own file: agent writes to it always go through the
protected-instruction approval gate (tools/file_tools_write_guards.py) and no
repository checkout can plant it, so it sits in the same trust class as
config.yaml — not a cloned repo's AGENTS.md. `_scan_context_content` gains a
`user_authored` mode that still scans, logs the matched pattern(s) at WARNING
and loads the content; only `load_soul_md` uses it. Project-dir context files
(.hermes.md, AGENTS.md and the other project-dir files), subdirectory hints,
memory and tool-result scanning are unchanged and keep blocking. No threat
pattern is narrowed: the reported-speech form cannot be separated from real
attacks by regex ("I want you to ignore all previous instructions" is a
canonical payload).

The /context manifest reports such a file as `flagged` (loaded, ⚠ "review the
file") so the warning is visible on CLI, TUI, gateway and Desktop rather than
buried in the log.

Fixes #112570
2026-09-16 17:17:47 -07:00
6de6e6da99 fix(anthropic): model-scoped 429 cooldowns live in a pool sibling; restore path no longer NameErrors
Follow-up to the salvaged #111787 commit (@KoNit-K), same mechanism as #75578 (@adikpb).

What:
- Move the per-model cooldown logic out of the 2.7k-line credential_pool.py facade into
  agent/credential_pool_model_cooldowns.py (mixin + module helpers), keeping only the
  select/has_available/next_available_at hooks and the mark_exhausted_and_rotate branch in the facade.
- The model cooldown uses the same TTL policy as a credential-wide 429 (_exhausted_ttl: provider
  reset_at wins, a sole credential keeps its 60s bench) instead of a flat 1h, so a single-credential
  user is never benched LONGER for the failed model than before.
- Drop the `quota_scope == "account"` check: nothing in the tree produces that key.
- Also keep billing_unverified 429s credential-wide, matching the credential-wide branch.
- _rebind_primary_credential_pool read `rt` that was not in its scope (NameError on every
  post-fallback restore); pass primary_model from the caller instead.
- resolve_anthropic_token(model=...) gates only model-aware callers; model-less diagnostics
  (usage display, model discovery) keep the key as before.
- _anthropic_token_or_raise names the cooled model instead of claiming no credentials exist.
- Simplify the salvaged call sites (unconditional select(model=)/resolve_anthropic_token(model=)),
  widen test stubs that lacked the new kwargs, trim the tests to two invariants on a real temp store.
- Docs: credential-pools.md documents per-model Anthropic 429 cooldowns.

Why: a generic Anthropic 429 is a per-model rate limit; benching the whole credential took every
other Claude model offline while the env/borrowed token path handed the same benched key straight
back (#111769, #61451).

Co-authored-by: KoNit-K <124019182+KoNit-K@users.noreply.github.com>
Co-authored-by: adikpb <67222969+adikpb@users.noreply.github.com>
2026-09-16 17:16:06 -07:00
teknium1andhanamizuki 0a425ddb07 test(cron): trim the failure-marker tests to two invariants; document [CRON_FAILURE]
Keep the positive (first-line marker fails the run) and negative (quoted marker stays
successful) invariants from #112431; drop the no_agent control and the prompt-text
presence check, which only re-read the constant and the hint string.

Add the user-facing description of the marker next to [SILENT] in the cron docs so the
control token is discoverable without reading the prompt hint.

Co-authored-by: hanamizuki <claude@hanamizuki.tw>
2026-09-16 17:11:51 -07:00
teknium1 c8f0f6b136 fix(moa): name the billed aggregator in the gateway /model block and qualify the advise-once copy
Review follow-up for #112359:
- gateway `_format_session_info` (the /model info block) printed only
  `Model: <preset> / Provider: moa`, so the messaging surfaces still hid
  who pays; append the same "Acting model (billed for the run)" line the
  CLI switch summary prints.
- `_provider_mismatch_notice` compared providers case-sensitively and
  treated the routing pseudo-provider `auto` as a billing seat, printing a
  misleading "not to OpenAI" / "not to auto" line; lower-case both sides
  and skip `auto`.
- "references only advise once per user turn" is only true for the
  default `fanout: user_turn`; say "by default" on the inventory row, the
  `hermes moa list` header, the Desktop pill/description (en/zh/zh-hant)
  and the docs line.
2026-09-16 17:11:01 -07:00
teknium1andKoNit-K 587c7d9631 fix(moa): show who pays on every MoA surface and trim the salvage to two invariants
Follow-up to the cherry-picked #112368 so the whole class lands in one PR:

- `hermes model` inventory row (also the gateway picker): the virtual `moa`
  row's warning now says the aggregator is the acting model billed for the
  run and references only advise once per user turn (ported from #112362).
- In-session `/model` switch onto a MoA preset prints
  `Acting model (billed for the run): <provider>:<model>` under the Provider
  line — the preset name alone hides who pays (issue suggestion 3; reuses the
  same aggregator lookup the picker rows already do).
- Desktop: the MoA section blurb moves behind a `moaDescription` i18n key
  (en/zh/zh-hant; the other locales inherit English via `defineLocale`) instead
  of hardcoded component text, following #112362's shape.
- Tests trimmed to two CLI invariants (notice fires on provider mismatch /
  stays silent when providers match or the main provider is unknown) and one
  Desktop assertion on the aggregator row pill.
- Docs: `website/docs/user-guide/features/mixture-of-agents.md` gains a
  "Who pays for a MoA run" callout and documents the mismatch notice.

WHY: a Codex-subscription user put the aggregator on another provider and
had the entire tool loop billed there (#112359). The aggregator is the acting
model on every step, so each surface that shows a preset must say so.

Co-authored-by: KoNit-K <124019182+KoNit-K@users.noreply.github.com>
2026-09-16 17:11:01 -07:00
teknium1 8beeb661c9 fix(plugins): report an identically failing hook callback once, not on every call
A plugin callback whose signature names a parameter the hook never sends
(on_pre_tool(tool_data) where core provides tool_name/args) raises the same
TypeError on every tool call; core logged a WARNING each time — ~1700 lines an
hour in the report, burying the freeze signature it was trying to find
(finding (c) of #111922). The mis-declared signature is the plugin's bug; the
per-call repeat is ours.

invoke_hook now reports one WARNING per distinct (hook, callback, error) and
names the fields the hook actually provides so the author can fix the
signature; identical repeats are logged at DEBUG. A callback failing in a new
way still warns.

Part of #111922
2026-09-16 17:08:25 -07:00
c810640a8a fix(agent): a MoA preset in the fallback chain activates the preset, not the aggregator alone
`try_activate_fallback` and the init-time fallback walk in `agent_init._routed_client_kwargs`
handed `provider: moa` entries to `resolve_provider_client`, whose MoA chokepoint unwraps the
preset to the aggregator's real HTTP client. Both then installed that client under the virtual
identity: the runtime path kept `model=<preset>`/`provider=moa` on an `api.x.ai` client (the
preset name went out as the model id → 404, #112525) and every `provider == "moa"` guard and
key — stale timeout, cache_ttl, pricing, credential pool, and the client-rebuild branches in
`_replace_primary_openai_client` / `_create_openai_client` — saw "moa" for a native client, so
the next credential rotation or dead-connection cleanup swapped the MoA facade in anyway
(#112623). The init-time path had the mirror image: `model=<aggregator slug>`, the aggregator's
base_url/api_key in `_client_kwargs`, facade client.

WHY bind the facade instead of rewriting the identity to the aggregator: `provider: moa,
model: <preset>` means "run this preset" at every other entry point (config, `/model
<preset> --provider moa`, picker, gateway `/moa`), and the chokepoint unwrap exists for aux
tasks that skip the fan-out by design. A fallback entry is the acting model, so it gets the same
semantics and the same four pins as `agent_init` / `switch_model` / `restore_primary_runtime`
(`api_mode=chat_completions`, `base_url=moa://local`, empty client kwargs, facade client).
With identity and client consistent, the existing `provider == "moa"` guards are correct as
written and no re-keying on client identity is needed. The chokepoint call stays as the
preflight: an unresolvable preset or an aggregator without credentials still skips the entry
with the "provider not configured" warning.

`moa_loop.bind_moa_runtime` is the single binder used by init, switch and both fallback paths
so the pins cannot drift again.

Co-authored-by: KoNit-K <124019182+KoNit-K@users.noreply.github.com>
Co-authored-by: Zheqing Zeng <26277217+zengzheqing@users.noreply.github.com>
Co-authored-by: fangliquan <fangliquan@qq.com>
2026-09-16 17:07:21 -07:00
teknium1 8d11af8497 docs(api-server): scope the concurrent-run cap to the routes that enforce it
The doc claimed the cap covers 'every endpoint that starts' a run, but
POST /api/jobs/{id}/run and /api/cron/fire start agent runs through the
cron scheduler, outside _run_agent, and are neither counted nor
429-guarded. Name the covered routes and say cron-triggered runs are
governed by cron's own limits so operators don't rely on a cap that
isn't applied there.
2026-09-16 17:05:32 -07:00
John Paul Soliva 9934972e21 fix(api-server): the session-chat routes spend the concurrent-run budget without respecting it
POST /api/sessions/{id}/chat and its /stream variant run their turn through _run_agent, so each
one already counts toward gateway.api_server.max_concurrent_runs. Neither ever called
_concurrency_limited_response, so the two routes could never be refused while their turns pushed
every other caller — /v1/chat/completions, /v1/responses, /v1/runs — into HTTP 429. A gateway at
its cap therefore refused the endpoints that check it and admitted the ones that do not.

Cross-machine agent DMs land on exactly these routes (hermes peer dm posts the turn to
/api/sessions/{id}/chat), so on a fleet gateway N simultaneous DMs started N full agent turns
regardless of the configured cap, each one an agent in its own executor thread.

Both routes now take the same guard the other run-starting routes take, before the session is
prepared. One table asserts the contract for the whole class: every route that starts a turn
answers 429 with Retry-After at the cap and starts no turn, and is admitted under it.

Docs: the cap's scope in the API server guide named only the OpenAI-compatible and Runs
endpoints, which is what the code did.
2026-09-16 17:05:32 -07:00
teknium1andkokhlo dd2141b928 fix: cap only generic sample tokens, one step, last; bump plugin-guard to v4
Follow-up to the cherry-picked #112146 (@KoNit-K):

- Move the __main__ demotion to the end of _filter_findings behind a
  severity == "critical" guard and a MAIN_GUARD_DEMOTIONS table (the
  DOC_PROSE_DEMOTIONS idiom), so it is a one-step cap that can never
  re-raise a finding an earlier remap already lowered.
- Treat ValueError from ast.parse (NUL bytes, undecodable text) like a
  SyntaxError: no cap, the file is runtime code (fail closed).
- Bump PLUGIN_SCANNER_VERSION to plugin-guard-v4: the verdict semantics
  for a plugin shape changed, and the version is what install output
  and recorded provenance show.
- Trim to two invariant tests: the reporter's repro shape (token inside
  the guard -> caution + confirmable/--force, same token above the guard
  -> dangerous, --force refused) and narrowness (destructive payload and
  a provider-shaped sk- key inside the guard, plus an unparseable file,
  all stay critical -> dangerous).
- Docs: one paragraph on the __main__ cap next to the test-tree cap.

Co-authored-by: kokhlo <konstantin.khlopkov93@gmail.com>
2026-09-16 17:01:30 -07:00
teknium1 c815d91282 fix(mcp): count an adopted shared connection as live in the config reconcile
reconcile_mcp_servers_with_config built `known` from connections whose
owner == the current scope only. Under a multiplexed gateway a profile
that ADOPTED another profile's shared live connection (key owned by A,
B listed in _server_tool_scopes) therefore never saw that server as
live, and the every-tick reconcile introduced by this PR re-entered
discover_mcp_tools() — taking the cross-process discovery lock — and
logged INFO "reconciled … added=['x']" every 60 s forever although
nothing was added. On main this only fired on a config edit.

Build `known` with the same resolution _select_new_servers uses
(_resolve_server_key(name, scope, current=False) checked against
_servers / _server_connecting / _lazy_server_configs), so the reconcile
and discovery agree on what is live and "added" names only what
discovery will actually attempt. Probe (scope B, ('A','x') live and
shared with B, config {x}): 3 discovery calls over 3 ticks before, 0 after.

Docs: mention in the gateway paragraph that a server whose first
connect failed is retried on the 30 s→600 s cooldown schedule without
/reload-mcp or a restart.
2026-09-16 17:01:11 -07:00
teknium1 c39752c014 docs(curator): state that bundled and disabled skills never reach the LLM pass
The consolidation section still said the pass could "archive via the
terminal tool" (it has no terminal) and did not say which skills it is
offered. Document that prune_builtins only affects the deterministic
archival walk and that bundled + skills.disabled names are excluded from
the LLM candidate list, matching the code change in this PR.
2026-09-16 16:58:22 -07:00
teknium1 bfa56a3be8 docs(delegation): a frozen child is abandoned with a timeout entry on every runtime
The stale monitor no longer just stops refreshing parent activity for the
gateway watchdog; it ends the wait with status=timeout (450s idle / 1200s
in-tool of frozen activity), including one-shot runs without a configured cap.
2026-09-16 16:56:46 -07:00
teknium1 0631710ae4 fix(disk-cleanup): protect every per-profile user tree and trim tests to two invariants
Extends the salvaged #112860 entry (`workspace`) to the whole class: `plans` and
`home` are bootstrapped alongside `workspace` by `hermes_cli/profiles.py::_PROFILE_DIRS`
and listed as user data in `profile_distribution.py::USER_OWNED_EXCLUDE`, so a
`test_*`/`tmp_*` file inside any of them is a user's file, never scratch.

Trims the contributor's five tests to two invariants: the end-to-end
post_tool_call -> on_session_end path (workspace file survives, a root-level
`tmp_scratch.py` control is still removed) and the empty-dir sweep leaving a
directory under `workspace/` alone. Documents the protected trees in the plugin
README and the built-in-plugins page.

Dropped: test_workspace_project_tree_never_tracked, test_quick_keeps_workspace_test_file,
test_root_level_test_file_still_auto_deleted (folded into the E2E test as its control).

Part of #112859.
2026-09-16 16:54:19 -07:00
teknium1 864e9dccfc fix(browser): real-profile snapshot names the locked auth databases and the reason
On macOS/Linux a running Chrome lets `Cookies` back up but holds `Login Data`,
`Login Data For Account` and `Web Data` with a hot write lock, so their SQLite
online backup misses the five-second deadline. The launch failed closed with a
bare "3 database(s) unavailable" count, and the docs still promised that macOS
and Linux "can copy the profile while the browser is running" (#111647).

- `_copy_auth_file` returns the failure reason (None on success) instead of a
  bool; the backup deadline is the named constant `_AUTH_BACKUP_DEADLINE_S` and
  raises `_AUTH_DB_LOCKED`, so the caller can tell "browser holds a write lock"
  from "file is not a database".
- `_mirror_profile_auth` returns `{db name: reason}`; the new
  `_unavailable_auth_dbs_error` renders "chrome is running and holds the
  profile's Login Data, Login Data For Account, Web Data with a write lock …
  Fully quit chrome and retry" when every failure is the deadline, and the
  per-database SQLite error otherwise. No raw-copy fallback is added: the
  no-fallback stance from 58d6d5223a (WAL consistency) is unchanged.
- Docs: the Real-profile note no longer says macOS/Linux copy live; it states
  which databases need the browser quit and what the error looks like. The
  `real_profile_autoclose` comment stops claiming copy-while-running works on
  POSIX.
2026-09-16 16:53:40 -07:00
teknium1 de2ddeec85 docs(image-gen): describe the single managed row and its FAL + Krea + Portal model picker 2026-09-16 16:42:47 -07:00
teknium1 260da4ef62 fix: catalog installs no longer block on caution; admission runs the same scanner
Symptom: a third of catalog entries (23 of 71 pinned trees scanned today) could not be
installed from the Desktop. The install path runs plugin_guard on every clone and a
caution verdict needs a confirmation; the CLI prompts, the Desktop/dashboard path
passes no decision callback, so caution became "Security scan blocked".

Root cause: admission (hermes plugins validate + catalog CI) never ran the scanner, so a
pin could be approved by a human and still trip the installer.

Fix, both halves:
- validate_plugin_dir gains a "security scan" check: dangerous fails the entry, caution
  is reported as warnings so the reviewer reads the findings before merging the pin.
  pinned-source-validate in plugin-catalog-ci.yml therefore runs the identical scanner.
- _install_plugin_core accepts reviewed_pin=<catalog sha>; when the checked-out revision
  equals it, caution is accepted without a prompt. dangerous still blocks (a signature
  added after review is what the backstop is for). Raw-URL installs, --ref overrides
  and a checkout at any other revision keep the current behaviour.

Live: dashboard_install_plugin('weather') on origin/main -> BLOCKED caution; after -> ok.
2026-09-16 15:47:44 -07:00
teknium1 bd46352705 feat: catalog card image slot is 2:1; version pill reads as a pill
repo social banners are 2:1, so that shape fills the slot without a crop;
the recommended size is in the README/docs. Desktop AgentPluginRow gains
catalog_version to match the generated contract.
2026-09-16 14:18:39 -07:00
teknium1 034313e7cd feat: plugin catalog entries carry an optional version label and card image
The 40-hex sha stays the release, but nobody reads one. Entries may now add
`version: "1.4.0"` (free-form, <=32 chars, never parsed) and `image:` (an https
URL on raw.githubusercontent.com / github.com / *.githubusercontent.com).

Why GitHub-only: the Desktop catalog browser deliberately never fetches from
third-party hosts, and a raw URL pinned to the entry commit is as immutable as
the sha it decorates.

Readers updated together: PluginCatalogEntry + entry_from_mapping (drop with a
warning, entry survives), validate_plugin_catalog.py (admission error), the
site extractor (drop, never fatal), the /docs/plugins card (banner + version
pill + "1.4.0 @ abcd1234" pin), the CLI table/info (pin_label), the TUI-gateway
plugin row (catalog_version -> Desktop "Update to 1.4.0"), and the Desktop
catalog detail header (image).
2026-09-16 14:18:39 -07:00
brooklyn! 4e9d3c713a feat(desktop): browse catalogs as cards with a saved list option 2026-09-16 13:55:13 -05:00
brooklyn! 8b551a1ab3 docs(catalog): restore native browsing and install guidance 2026-09-16 13:55:13 -05:00
teknium1 9b8cc18364 Revert "docs(catalog): explain shared feeds and Desktop install links"
This reverts commit aea0580eb7.
2026-09-16 09:25:14 -07:00
teknium1 9d67c7c29a Revert "fix(desktop): show skill install progress and completion in the shared dialog"
This reverts commit 25be09822d.
2026-09-16 09:25:14 -07:00
brooklyn! 25be09822d fix(desktop): show skill install progress and completion in the shared dialog 2026-09-16 04:33:07 -05:00
brooklyn! aea0580eb7 docs(catalog): explain shared feeds and Desktop install links 2026-09-16 04:33:07 -05:00
brooklyn! fb56a7e06d docs(desktop): the wake-word ear and speaker live in the mic's fan
The desktop guide and the wake-word page told users to click an ear in the
composer row; it now fans out of the microphone on hover. The folded voice
menu, not the ear, carries the silent-mic hint.
2026-09-16 02:56:57 -05:00
teknium1 6e6550e181 docs(kanban): document worker_output on crashed / protocol_violation events 2026-09-15 22:47:03 -07:00