Skip to content

The agent that grows with you

fix(aux): suppress task reasoning after caller disables it

KoNit-K01a0d9acc874
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index 9fbd2e881d0..2d7fa1dab5b 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -6417,6 +6417,11 @@ 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"}
+ elif reasoning_config and isinstance(reasoning_config, dict) and reasoning_config.get("enabled") is False:
+ # A reasoning-aware profile has already projected disabled reasoning to its own wire
+ # (for example, ``reasoning_effort=none``). Task-level extra_body must not reintroduce
+ # generic OpenAI reasoning alongside that profile-specific control.
+ merged_extra.pop("reasoning", None)
# 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).
diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.py
index 5a5f52cef82..83af361b087 100644
--- a/tests/agent/test_auxiliary_client.py
+++ b/tests/agent/test_auxiliary_client.py
@@ -2500,6 +2500,31 @@ class TestStaleBaseUrlWarning:
class TestAuxiliaryTaskExtraBody:
+ def test_disabled_caller_reasoning_suppresses_task_reasoning_for_profile_wire(self, monkeypatch):
+ """A profile-owned ``reasoning_effort=none`` must not ship with task reasoning."""
+ import agent.auxiliary_client as aux
+
+ projection = aux._ProfileProjection({}, {}, {"reasoning_effort": "none"}, True)
+ monkeypatch.setattr(aux, "_project_provider_profile", lambda *_args: projection)
+ monkeypatch.setattr(
+ aux,
+ "_get_auxiliary_task_config",
+ lambda _task: {"reasoning_effort": "low", "extra_body": {"metadata": {"task": "title"}}},
+ )
+
+ kwargs = aux._build_call_kwargs(
+ provider="custom",
+ model="test-model",
+ messages=[{"role": "user", "content": "hello"}],
+ extra_body=aux._get_task_extra_body("title_generation"),
+ reasoning_config={"enabled": False},
+ task="title_generation",
+ )
+
+ assert kwargs["reasoning_effort"] == "none"
+ assert "reasoning" not in kwargs["extra_body"]
+ assert kwargs["extra_body"]["metadata"] == {"task": "title"}
+
@pytest.mark.parametrize("task", ["session_search", "moa_reference", "moa_aggregator"])
def test_generic_reasoning_fallback_clamps_ultra_for_auxiliary_and_moa_calls(self, task, monkeypatch):
"""The OpenAI-compatible fallback must never put Hermes-only ``ultra`` on the wire."""