hermes-agent/tests/acp
Teknium c6974043ef
refactor(acp): validate method_id against advertised provider in authenticate() (#13468)
* feat(models): hide OpenRouter models that don't advertise tool support

Port from Kilo-Org/kilocode#9068.

hermes-agent is tool-calling-first — every provider path assumes the
model can invoke tools. Models whose OpenRouter supported_parameters
doesn't include 'tools' (e.g. image-only or completion-only models)
cannot be driven by the agent loop and fail at the first tool call.

Filter them out of fetch_openrouter_models() so they never appear in
the model picker (`hermes model`, setup wizard, /model slash command).

Permissive when the field is missing — OpenRouter-compatible gateways
(Nous Portal, private mirrors, older snapshots) don't always populate
supported_parameters. Treat missing as 'unknown → allow' rather than
silently emptying the picker on those gateways. Only hide models
whose supported_parameters is an explicit list that omits tools.

Tests cover: tools present → kept, tools absent → dropped, field
missing → kept, malformed non-list → kept, non-dict item → kept,
empty list → dropped.

* refactor(acp): validate method_id against advertised provider in authenticate()

Previously authenticate() accepted any method_id whenever the server had
provider credentials configured. This was not a vulnerability under the
personal-assistant trust model (ACP is stdio-only, local-trust — anything
that can reach the transport is already code-execution-equivalent to the
user), but it was sloppy API hygiene: the advertised auth_methods list
from initialize() was effectively ignored.

Now authenticate() only returns AuthenticateResponse when method_id
matches the currently-advertised provider (case-insensitive). Mismatched
or missing method_id returns None, consistent with the no-credentials
case.

Raised by xeloxa via GHSA-g5pf-8w9m-h72x. Declined as a CVE
(ACP transport is stdio, local-trust model), but the correctness fix is
worth having on its own.
2026-04-21 03:39:55 -07:00
..
__init__.py feat: restore ACP server implementation from PR #949 (#1254) 2026-03-14 00:09:05 -07:00
test_auth.py feat: restore ACP server implementation from PR #949 (#1254) 2026-03-14 00:09:05 -07:00
test_entry.py fix(acp): complete session management surface for editor clients (salvage #3501) (#3675) 2026-03-28 23:45:53 -07:00
test_events.py fix(acp): improve zed integration 2026-04-17 13:29:26 -07:00
test_mcp_e2e.py fix(acp): improve zed integration 2026-04-17 13:29:26 -07:00
test_permissions.py feat: restore ACP server implementation from PR #949 (#1254) 2026-03-14 00:09:05 -07:00
test_ping_suppression.py fix(acp): silence 'Background task failed' noise on liveness-probe requests (#12855) 2026-04-20 00:10:27 -07:00
test_server.py refactor(acp): validate method_id against advertised provider in authenticate() (#13468) 2026-04-21 03:39:55 -07:00
test_session.py fix(acp): improve zed integration 2026-04-17 13:29:26 -07:00
test_tools.py fix(acp): improve zed integration 2026-04-17 13:29:26 -07:00