Skip to content

The agent that grows with you

fix(aux): clamp extra_body.reasoning effort too so auxiliary.<task>.reasoning_effort ultra never reaches the wire

teknium15435ac8cc4da
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index d483e3f4dd7..05744ed5611 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -6159,6 +6159,12 @@ def _merge_aux_extra_body(
else:
# ``reasoning_config`` is already clamped to the OpenAI-compat wire by _build_call_kwargs.
merged_extra["reasoning"] = {"enabled": True, "effort": reasoning_config.get("effort") or "medium"}
+ # Caller/task ``extra_body.reasoning`` (``auxiliary.<task>.reasoning_effort`` folds in here via
+ # _get_task_extra_body) takes the same wire clamp: Hermes-only ``ultra`` never reaches the
+ # OpenAI-compat wire from any aux task (#112010).
+ if isinstance(merged_extra.get("reasoning"), dict):
+ from agent.reasoning_effort import clamp_reasoning_config
+ merged_extra["reasoning"] = clamp_reasoning_config(merged_extra["reasoning"])
# Portal tags + sticky session_id fallback when the profile didn't supply them; session_id
# keeps aux calls on the main turn's upstream instance (cache warmth) — tags alone are not
# enough on /v1/messages.
diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.py
index cba10878d19..1d6beb1506a 100644
--- a/tests/agent/test_auxiliary_client.py
+++ b/tests/agent/test_auxiliary_client.py
@@ -2519,6 +2519,26 @@ class TestAuxiliaryTaskExtraBody:
assert kwargs["extra_body"]["reasoning"] == {"enabled": True, "effort": "max"}
+ def test_task_extra_body_reasoning_effort_ultra_is_clamped(self, monkeypatch):
+ """``auxiliary.<task>.reasoning_effort: ultra`` folds into ``extra_body.reasoning`` (the path
+ compression/title/vision/... use, with no reasoning_config) and must take the same clamp."""
+ import agent.auxiliary_client as aux
+ from agent.auxiliary_client import _build_call_kwargs, _get_task_extra_body
+
+ monkeypatch.setattr(aux, "_get_auxiliary_task_config", lambda task: {"reasoning_effort": "ultra"})
+ monkeypatch.setattr(aux, "_project_provider_profile", lambda *_args: aux._ProfileProjection({}, {}, {}, False))
+
+ kwargs = _build_call_kwargs(
+ provider="custom",
+ model="test-model",
+ messages=[{"role": "user", "content": "hello"}],
+ extra_body=_get_task_extra_body("session_search"),
+ reasoning_config=None,
+ task="session_search",
+ )
+
+ assert kwargs["extra_body"]["reasoning"] == {"enabled": True, "effort": "max"}
+
def test_profile_projection_receives_wire_clamped_effort(self, monkeypatch):
"""Profiles clamp only against their own narrower sets (or a catalog that may be cold), so
``ultra`` must already be a wire level when the projection sees it — the MoA aggregator on