Skip to content

The agent that grows with you

fix(reasoning): trim salvaged tests to two invariants; document escape + local-endpoint gate

teknium14b617afcc536
diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.py
index 1289e145ae9..7aac9c6bf8d 100644
--- a/tests/test_hermes_constants.py
+++ b/tests/test_hermes_constants.py
@@ -473,52 +473,23 @@ class TestResolvePerModelReasoningEffort:
result = resolve_per_model_reasoning_effort("claude-opus-4.5", overrides)
assert result == {"enabled": True, "effort": "high"}
- # --- Reverse lookup: prefixed key vs bare model string (#114073) ---
-
def test_prefixed_key_matches_bare_model(self):
- """A custom-provider prefixed key matches after the model string lost the prefix.
+ """A custom-provider prefixed key (``ollama-local/qwen3.6:27b``) applies to the bare runtime slug.
- Fallback entries and custom-provider resolution feed the bare slug
- (``qwen3.6:27b-q4_k_m``) while the documented key spelling keeps the
- ``provider/model`` form — the override must still apply.
+ Fallback entries and named custom providers feed ``agent.model`` without the provider
+ prefix while the documented key spelling keeps ``provider/model``; a key for a different
+ model must still miss.
"""
from hermes_constants import resolve_per_model_reasoning_effort
overrides = {"ollama-local/qwen3.6:27b-q4_k_m": "low"}
- result = resolve_per_model_reasoning_effort("qwen3.6:27b-q4_k_m", overrides)
- assert result == {"enabled": True, "effort": "low"}
-
- def test_prefixed_key_reverse_match_tolerates_dash_spelling(self):
- """The reverse lookup reuses dots↔dashes tolerance on the key's bare tail."""
- from hermes_constants import resolve_per_model_reasoning_effort
- overrides = {"my-relay/qwen3-6:27b": "low"}
- result = resolve_per_model_reasoning_effort("qwen3.6:27b", overrides)
- assert result == {"enabled": True, "effort": "low"}
-
- def test_prefixed_key_matches_provider_qualified_model(self):
- """A three-segment aggregator key matches the provider-qualified model string."""
- from hermes_constants import resolve_per_model_reasoning_effort
- overrides = {"openrouter/qwen/qwen3": "high"}
- result = resolve_per_model_reasoning_effort("qwen/qwen3", overrides)
- assert result == {"enabled": True, "effort": "high"}
-
- def test_unrelated_prefixed_key_does_not_match(self):
- """A prefixed key for a different model never matches."""
- from hermes_constants import resolve_per_model_reasoning_effort
- overrides = {"ollama-local/qwen3.6:27b": "low"}
+ assert resolve_per_model_reasoning_effort("qwen3.6:27b-q4_k_m", overrides) == {"enabled": True, "effort": "low"}
assert resolve_per_model_reasoning_effort("llama3.2:3b", overrides) is None
def test_direct_match_wins_over_reverse_lookup(self):
"""A direct/variant key match keeps priority over a prefixed reverse match."""
from hermes_constants import resolve_per_model_reasoning_effort
- overrides = {
- "qwen3.6:27b": "medium", # direct bare key
- "ollama-local/qwen3.6:27b": "low", # prefixed reverse candidate
- }
- result = resolve_per_model_reasoning_effort("qwen3.6:27b", overrides)
- assert result == {"enabled": True, "effort": "medium"}
-
-
-
+ overrides = {"qwen3.6:27b": "medium", "ollama-local/qwen3.6:27b": "low"}
+ assert resolve_per_model_reasoning_effort("qwen3.6:27b", overrides) == {"enabled": True, "effort": "medium"}
class TestResolveReasoningConfig:
@@ -572,23 +543,6 @@ class TestResolveReasoningConfig:
cfg = self._cfg(effort="medium", overrides={"gpt-5": "turbo-max"})
assert resolve_reasoning_config(cfg, "gpt-5") == {"enabled": True, "effort": "medium"}
- def test_prefixed_override_key_applies_to_bare_model(self):
- """Fallback-swap shape: bare model string + provider-qualified key → override wins (#114073).
-
- The fallback chain feeds ``agent.model`` as the bare slug while the
- user's key keeps the documented ``provider/model`` spelling; without
- the reverse lookup this silently fell back to the global effort.
- """
- from hermes_constants import resolve_reasoning_config
- cfg = self._cfg(
- effort="high",
- overrides={"ollama-local/qwen3.6:27b-q4_k_m": "low"},
- )
- assert resolve_reasoning_config(cfg, "qwen3.6:27b-q4_k_m") == {
- "enabled": True,
- "effort": "low",
- }
-
class TestReasoningOverridesDefaultConfig:
"""Tests for the agent.reasoning_overrides default config key (Task 2)."""
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index 3b79fac99c1..09b9d348312 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -1810,10 +1810,15 @@ agent:
The key matching is **spelling-tolerant** — any reasonable spelling will match:
- `claude-opus-4.5`, `claude-opus-4-5`, `claude-opus.4.5` (dots and dashes are interchangeable)
- `anthropic/claude-opus-4.5`, `openrouter/anthropic/claude-opus-4.5` (provider prefix optional)
+- A key prefixed with a named custom provider (`ollama-local/qwen3.6:27b-q4_k_m`) also applies when the request carries only the bare model id (`qwen3.6:27b-q4_k_m`), which is what fallback entries and `providers:` routes send
- Exact matches take precedence over variants
:::note
-There is no `hermes config set` support for `reasoning_overrides` keys — edit the YAML file directly. This is because model names often contain dots (e.g. `claude-opus-4.5`), which conflict with the CLI's dotted-key syntax.
+Model ids contain dots (`claude-opus-4.5`, `qwen3.6:27b`), which `hermes config set` treats as nesting separators. Escape them with a backslash to write the literal key — `hermes config set 'agent.reasoning_overrides.ollama-local/qwen3\.6:27b-q4_k_m' low` — or edit the YAML directly. See [Dots inside key names](/reference/cli-commands#dots-inside-key-names).
+:::
+
+:::note Local OpenAI-compatible endpoints
+Hermes only sends the `reasoning` request field to endpoints known to accept it (Nous Portal, OpenRouter reasoning-capable models, GitHub Models, LM Studio, Ollama Cloud) because arbitrary OpenAI-compatible servers reject unknown fields with HTTP 400. A plain local `base_url` (`http://localhost:11434/v1`, a vLLM or router endpoint) therefore receives neither `agent.reasoning_effort` nor a per-model override, and the server's own default budget applies. To pin the budget for such an endpoint, put the field your server documents under the custom provider's [`extra_body`](/integrations/providers#named-custom-providers), which is merged into every request routed there.
:::
**Resolution priority:**