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.
On a multiplexed gateway, a routed profile's direct FAL image or video job
went out signed with the launch profile's FAL_KEY, so it was billed to the
launch profile's FAL account. Hermes' own check (fal_key_is_configured) reads
the routed profile's scope and says "configured", but the submit then used
the module-level fal_client.submit: one process-wide SyncClient() that reads
os.environ (the launch profile's .env, loaded at gateway start) on first use
and keeps that key for the life of the process.
Both direct sites now submit through tools.fal_common.direct_fal_client(),
which builds fal_client.SyncClient(key=...) from the same key the check reads
(new tool_backend_helpers.fal_key(), shared with fal_key_is_configured). One
client per key, reused, as the managed client already is. Unscoped
single-profile runs read the same key as before: get_secret falls through to
os.environ there.
The unscoped submit shapes came from 95dc9aaa75 (rewbs, 2026-03-26, #3287,
image) and d04b3c193e (alt-glitch, 2026-05-27, #33259, video). They became a
cross-profile leak once routed profiles started sharing one process.
Part of #151791 step 9-pre (tracker #152308): explicit per-profile SDK keys.
Modal, Vercel token mode and HF upload are separate follow-up slices.
The regression test called the resolver helper directly, so dropping the new
local_source_spelling calls in _materialize_video or _confine_source_images
left it green. It now drives both call sites on real files; each red when its
call is reverted. Docstring no longer calls the local backend a no-op.
Widen #62126's resolver retry to its siblings and share one match key with read_file.
video_analyze on the local backend and image/video generation (whose providers open
local paths themselves) skipped the resolver, so a screenshot path retyped with a plain
space still missed there. filename_match_key (NFC, every Unicode space -> U+0020, curly
single quotes -> ') replaces read_file's private table, so both tools agree on what
"the same name" means. Tests trimmed to two invariants on a decodable PNG (main's
resolver now rejects the undecodable fixture).
The media resolver behind vision_analyze, video_analyze and image-generation
reference images kept its own host fast path: with a non-local backend it
host-read any file under the profile's media caches, and with
terminal.backend: local it host-read any path at all (a hosted scope refuses
that backend for tools, but the resolver never asked).
In a hosted scope the resolver never treats the backend as local and has no
host-read target, so every path is exec-read inside the bound agent's own
sandbox (or fails closed when there is none). The profile's media caches are
the profile's, not the agent's; a hosted inbound attachment reaches the
agent through its sandbox. Image generation's source confinement uses the
same predicate, so its references are confined in a hosted scope too.
A call such as search_files without `pattern` ran anyway and returned matches, and a
typo'd or invented argument was dropped with no signal, so the model assumed an option
had taken effect. One check now sits in front of every tool Hermes ships
(registry dispatch and the agent's inline executors; model_tools.py is untouched):
- a missing `required` argument is refused before the handler runs, naming the field
(with its allowed values when the schema enumerates them) and the valid parameters;
- an argument the schema does not declare still reaches the handler exactly as sent;
the result gains a `_warning` naming it. Nothing is stripped.
Slim redo of #142503. What differs from it, and why:
- scope is built-in tools only. MCP and plugin tools, and schemas that are open or
union-shaped at the root, pass through untouched: a third-party `properties` list is
not a promise about what the handler accepts.
- nothing is stripped, so handlers that read an undeclared key and execution middleware
that rewrites arguments keep main's contract.
- legacy call shapes and tool-owned guidance are declared by each tool at registration
(`compat_args`, `self_checked_args`) instead of a central table: skill_manage and memory
flat shapes, delegate_task's single-task shape, patch's V4A mode, terminal(code=...),
video_generate(video_url=...), and the handlers whose own missing-argument message says
more than a generic refusal can.
- the dynamic schema is only built when the registered one reports a finding.
Co-authored-by: Elisa Martinez Abad <elisam@nvidia.com>
Co-authored-by: James Nolan <jnolan@nvidia.com>
The deferred tool_search catalog shows each tool's first sentence clipped to
60 chars, so lines like 'image_generate: Generate high-quality images from
text prompts, or edit /…' hid that it edits with reference images on the
user's configured model. An agent skipped it and called FAL directly with a
hardcoded model.
- catalog line cap 60 -> 80 (CATALOG_SUMMARY_MAX_CHARS); every built-in
tool's first sentence now fits and leads with what it does
- image_generate/video_generate say they use the configured model;
image_generate says to use it rather than direct API calls/scripts
- web_search/web_extract/browser_exec name when to use each other
- drop a duplicated cronjob sentence and filler in skill_view/video_generate
- regenerate tests/fixtures/prompt_surface
Greptile P2s on #143768: an oversized palette PNG with a transparent index was
re-encoded as JPEG (P mode has no A band), and re-saving a JPEG dropped its EXIF
orientation so phone photos reached FAL sideways. Bake the orientation into the
pixels before re-encoding and treat info['transparency'] as alpha.
On the local terminal backend _confine_source_images is a no-op, so a raw
host path in image_url / reference_image_urls reached FAL (direct and the
managed Nous gateway) verbatim and failed with file_download_error, even
though the schema advertises absolute local paths.
The FAL edit request now resolves sources through the guarded
resolve_local_source_to_data_url (credential-read guard, image sniff) and
downscales inlined images to stay under the managed gateway's ~4.5 MB
body limit (probed: 4.0 MB base64 accepted, 4.5 MB -> HTTP 413).
Plugin providers keep their own host reads.
Salvages the intent of #53921 through the guarded resolver.
Co-authored-by: liuhao1024 <11816344+liuhao1024@users.noreply.github.com>
The Singularity/Apptainer backend (tools/environments/singularity.py) now ships
as the official 'singularity' plugin in NousResearch/hermes-official-plugins,
registered through the terminal-environment provider seam under the same
backend name and config keys (terminal.backend: singularity,
terminal.singularity_image / TERMINAL_SINGULARITY_IMAGE, terminal.container_*).
- 'singularity' leaves BUILTIN_BACKEND_NAMES so the plugin can register it;
every hardcoded classification set drops it (the provider declares
is_remote/is_container/supports_streams instead).
- LEFT_CORE gains a singularity row: homes whose terminal.backend (or .env
TERMINAL_ENV) is singularity get the catalog plugin once, on hermes update
or agent/gateway start. An unknown-backend error for 'singularity' names
the install command (new row field terminal_backend).
- A plugin backend receives its per-task '<backend>_image' override; batch
runs register one for the active backend.
- BaseEnvironment's sudo-probe knob is renamed _passwordless_sudo_probe_supported:
plugin backends set it, and the old spelling trips the install scanner.
- Core's scratch-dir disk warning and process-exit sweep were Singularity-only
and move to the plugin; the singularity setup row, dashboard probe/row and
config defaults/bridges go too. Docs point at the plugin.
fal_client's SyncRequestHandle.get() drains iter_events() at its default
interval=0.1, i.e. a status GET every ~0.3-0.5 s including RTT. Through the
Nous tool gateway (200 requests per fixed one-minute window) a single 12 s
image cost 42 requests (~208 req/min), so a second concurrent job — or the
same user's video job — trips RATE_LIMIT_EXCEEDED on submit, status and
result calls.
Add tools.fal_common.wait_fal_queue_result(): drain iter_events() at
FAL_QUEUE_POLL_SECONDS (2 s), then call get(), whose first status check now
sees Completed and goes straight to the result GET. Public SDK API only, no
monkeypatching. The image tool's interrupt-aware _wait_fal_result and both
FAL video waits (generation + SeedVR upscale) use it.
Live, one gpt-image-2.5 flare image via the gateway: 42 -> 9 requests,
12.1 s -> 12.5 s wall clock.
Test fakes that modelled the handle with only get() gain an empty
iter_events(); two touched test files also get encoding="utf-8" on their
config write_text (windows-footguns).
managed_image_partner inlined the dispatcher's strip-or-None reading of
image_gen.provider/model; managed_route now normalises raw values itself,
so both callers pass config values straight through and cannot drift.
_managed_model_plugin's docstring points at managed_route instead of
restating the rule, and NOUS_MANAGED_PROVIDER is a top-level import (no
cycle). A Krea style reference that disappears between is_file() and open()
now returns invalid_image_url instead of raising. Test comment corrected:
only managed-model routing ignores legacy use_gateway.
The routing rule (direct vendor -> none; Krea id -> Krea; Portal id -> Portal
only under an explicit `nous`, else FAL) lived in _managed_model_plugin and
was copied into managed_image_partner, where it read the provider through
_selected_provider: lowercased and legacy use_gateway: true counted as
`nous`. The dispatcher does neither, so e.g. use_gateway + a Portal id was
labelled "Nous Portal" while generating on FAL. Both now call
tools.image_generation_managed.managed_route() with the stored values read
the same way. Dispatch behaviour is unchanged.
The salvaged handler forwarded creativity/intensity/complexity/movement to
whichever route ran, declared or not. A model that copies slider values
from earlier turns after the backend changed would hand them to a
third-party generate() without **kwargs, which raises TypeError and fails
a plain text-to-image call that works today. Both plugin routes now keep
only the names in the provider's capabilities()["creative_controls"].
Tests: the dispatch test now declares one control and asserts the
undeclared one is dropped; the two schema tests become one relationship
test (the schema renders exactly what the Krea plugin declares, FAL renders
none) instead of pinning the enum and bounds.
* refactor(plugins): remove the Sep 2026 decomposition compat layer on schedule
The PLUGIN-COMPAT layer (2776813df3 + d63e380324 + 0a5164cebe) kept pre-#102117 import paths
alive for external plugins until 2026-09-14. That window closed two weeks ago; since then the loader
has already been skipping plugins that use the old paths. This removes the layer itself:
- 328 appended `PLUGIN-COMPAT` blocks (lazy `__getattr__` pointer tables, re-exported third-party
names, restored dead definitions) and the three re-export stub modules
(gateway/startup_watchdog, hermes_cli/observability/relay_runtime, tools/environments/modal_utils)
- COMPAT_MANIFEST.md, compat_manifest.json, scripts/check_compat_pointers.py and its lint step
- the reporting surfaces: CLI banner notice, `hermes plugins compat`, the `hermes doctor` section,
the post-update notice, the Desktop one-time dialog, the loader's pre-import skip and the
`plugins.allow_deprecated_imports` escape hatch
An external plugin that still imports an old path now fails to load with its ImportError as the
reason in `hermes plugins list`, the same path as any broken plugin.
hermes_cli/plugin_compat.py stays as three inert stubs (compat_report, removal_in_effect,
summary_lines): an already-running pre-removal `hermes update` lazy-imports them after the checkout
swap (tests/compat/old_updater_surface.json).
In-tree fallout, both already dead: hermes_cli/setup.py::_check_espeak_ng (no callers; its
`shutil` came from a compat block) and gateway/config.py::SessionResetPolicy ("retained solely for
the scheduled plugin-compat window"). Two test_run_agent patches targeted the removed
`run_agent.handle_function_call` pointer; they now patch `model_tools.handle_function_call`, the
seam production reads, like every sibling test in that file.
* chore: retrigger CI (zero-job startup_failure phantom)
* test: drop resolution allowlist rows for the two deleted which() sites
hermes_cli/setup.py::_check_espeak_ng (dead) and tools/skillevaluator_scan.py::scanner_available
(a restored definition inside a PLUGIN-COMPAT block) no longer exist; the stale-row gate requires
their allowlist entries go with them.
`_submit_fal_request` (image) and `_submit_fal_video_request` (video plugin)
translated every managed-gateway 4xx into "This model may not yet be enabled
on the Nous Portal's FAL proxy — set FAL_KEY or pick a different model". For
HTTP 429 that remediation is wrong: the gateway body is RATE_LIMIT_EXCEEDED
with a retryAfter, the model is enabled, and agents reading the message
switched models or gave up. On one real install this fired 260 times in a
week (17% of image_generate calls).
Both surfaces now submit through one shared helper
(tools/fal_common.py::submit_managed_fal_with_rate_limit_retry): a 429 whose
Retry-After (header, else body error.retryAfter) fits a 30s cap is waited out
in interrupt-aware 0.5s slices and resubmitted once under a fresh
x-idempotency-key; a second 429, or an unknown/too-long Retry-After, raises
a ValueError that names the rate limit and tells the agent to retry later
rather than switch models. 429 can no longer reach the "may not yet be
enabled" text.
`image_gen.provider: nous` fronts three gateways; the stored model id now says which
one serves a request (tools/image_generation_managed.py): FAL catalog ids → FAL gateway,
Krea plugin ids → Krea gateway, anything else → the Nous Portal image plugin. Before,
a Portal model id under the managed selection fell through to FAL, which warned about
an unknown model and billed a FLUX default instead.
The same module builds the managed row's union catalog with each model listed once
(FAL wins identical/cross-id duplicates; Krea 2 appears natively, never as the FAL or
Portal copy), so the picker and the runtime agree on one mapping.
Adds fal-ai/kling-image/v3/text-to-image ($0.028/img, native 2K default,
8 aspect ratios) with its image-to-image edit endpoint. The i2i schema
takes a SINGULAR `image_url` string instead of the usual `image_urls`
list, so the catalog gains an `edit_image_param` knob that
_build_fal_edit_payload honors (first source image only); the
edit-contract test now validates whichever image key the entry declares.
check_vision_requirements (and five siblings: browser_vision, image/video
generation, x_search, browser_vault) wrapped their whole probe in
`except Exception: return False`. The registry then logged "returned False",
indistinguishable from an unconfigured backend, and the only diagnostic for a
crashed resolver was gone (#87950: named custom provider lookup failing in a
long-lived multi-profile process, reported as vision tools silently vanishing).
The registry owns the verdict: _run_check_fn_uncached and _check_fn_cached both
catch, log with traceback, and return False. Let the exception reach them.
Behaviour for the model is unchanged (tool hidden either way); agent.log now
says why.
Under gateway.multiplex_profiles a secondary profile's turn ran with the LAUNCH
profile's working directory, command allowlist, redact_secrets switch, credential
file mounts, browser engine/headed flags, LSP service, auxiliary-provider health
marks and MCP stderr log, and several TERMINAL_ENV consumers read the process env
instead of the routed profile's terminal scope. A standalone `hermes -p X gateway
run` never behaved that way.
- tools/terminal_scope.py: resolve the terminal.cwd placeholder inside the
profile scope with the same rule gateway/run.py applies at import (local ->
$HOME, sandbox default otherwise) so the system prompt, context files and the
terminal of a routed turn start where the profile's standalone gateway would.
- tools/image_source.py, credential_files.py, image_generation_tool.py,
skills_tool.py, delegate_tool_progress.py, agent/tool_executor.py: read
TERMINAL_ENV / TERMINAL_CWD through the terminal scope.
- tools/approval.py (+ approval_floors.py): one permanent allowlist per routed
profile home; the unscoped module set stays for single-profile processes.
- agent/redact.py: `_redact_enabled()` resolves security.redact_secrets for the
routed profile (scope .env, then config); launch snapshot kept when unscoped.
- tools/credential_files.py, agent/auxiliary_health.py, agent/lsp/__init__.py,
tools/browser_tool_cloud.py, tools/mcp_tool_config.py,
tools/tool_result_storage.py: key process caches by profile home (or bypass
the slot under an override).
Tests: tests/tools/test_multiplex_turn_parity.py (4, red on base).
Docs: multi-profile-gateways.md isolation table.
Image and video callers were each formatting the same four-field dict into
the same sentence. Return the rendered tail from _managed_fal_billing_error
so the wording lives in one place; output is byte-identical.
Avoid retrying idempotent managed FAL submissions because the retry can mask the initial billing failure. Surface structured Nous billing diagnostics consistently for image and video paths, with hermetic regression coverage.
(cherry picked from commit 289ce039e9a522dc8016ae4a512214c05d0a8bc0)
The Sep 2026 decomposition (PR #102117) makes internal import paths a non-API: names now live in
the focused modules that define them. This commit is the ONLY thing keeping the old paths alive,
so external plugins have time to update. It is deliberately a single, unsquashed commit:
git revert <this sha>
removes every shim, stub and manifest at once on the announced date. Nothing in-tree may depend on
these pointers: scripts/check_compat_pointers.py (wired into lint.yml) fails CI if it does.
What it adds (see COMPAT_MANIFEST.md, compat_manifest.json):
- 332 facade modules get one delimited `PLUGIN-COMPAT` block appended at the end of the file
- 1,172 moved names resolved lazily via a module `__getattr__` (PEP 562) — never a top-level import,
so no import cycles; facades that already had `__getattr__` get a chained one
- 592 third-party/stdlib names the old modules used to expose, with their original import statements
- 266 public definitions that had been deleted as unused, restored byte-for-byte from the pre-decomposition
tree (+40 private helpers and 16 imports pulled in only because a restored definition needs them)
- 3 deleted modules recreated as re-export stubs (gateway/startup_watchdog, hermes_cli/observability/
relay_runtime, tools/environments/modal_utils)
- private names (`_x`) get no pointer: they were never API (3,792 skipped)
Verified: all 335 touched modules import under a fresh HERMES_HOME and every manifest name resolves;
the lint reports zero in-tree uses; ruff clean; targeted suites unchanged.
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.