The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(auxiliary): honor provider reasoning disable controls
fangliquanab3448e075d4
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex dfc9eb32403..19995dddfca 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -6492,6 +6492,10 @@ def _merge_aux_extra_body() -> Dict[str, Any]:"""Caller extra_body + profile body/reasoning + generic reasoning fallback + Nous tags."""merged_extra = dict(extra_body or {})+ caller_reasoning_fields = {+ key: value for key, value in merged_extra.items()+ if str(key).strip().lower() in _PROFILE_REASONING_KEYS and str(key).strip().lower() != "reasoning"+ }caller_disabled = isinstance(reasoning_config, dict) and reasoning_config.get("enabled") is Falseif caller_disabled:# The caller's thinking-off beats ``auxiliary.<task>.reasoning_effort`` (folded into@@ -6503,6 +6507,9 @@ def _merge_aux_extra_body(merged_extra.pop("reasoning", None)merged_extra.update(projection.body)merged_extra.update(projection.reasoning_extra)+ # Profiles supply route defaults, but an explicit vendor wire control in the task/call config+ # is already provider-specific and must not be replaced by that default.+ merged_extra.update(caller_reasoning_fields)if reasoning_config and isinstance(reasoning_config, dict) and not projection.handles_reasoning:if caller_disabled:merged_extra["reasoning"] = {"enabled": False}@@ -6570,6 +6577,10 @@ def _build_call_kwargs(# main transport applies (#89503); MoA aggregator/reference and aux calls 400'd without it (#112010).from agent.reasoning_effort import clamp_reasoning_configfrom agent.auxiliary_reasoning_floor import known_reasoning_floor+ if reasoning_config is None and isinstance(extra_body, dict):+ task_reasoning = extra_body.get("reasoning")+ if isinstance(task_reasoning, dict):+ reasoning_config = task_reasoningreasoning_config = clamp_reasoning_config(known_reasoning_floor(reasoning_config, provider_norm, effective_base, model, task))projection = _project_provider_profile(provider, provider_norm, model, effective_base, reasoning_config)diff --git a/tests/agent/test_auxiliary_client.py b/tests/agent/test_auxiliary_client.pyindex 690fc404207..6a73a74bd41 100644--- a/tests/agent/test_auxiliary_client.py+++ b/tests/agent/test_auxiliary_client.py@@ -2517,6 +2517,37 @@ class TestStaleBaseUrlWarning:class TestAuxiliaryTaskExtraBody:+ def test_task_reasoning_disable_uses_deepseek_thinking_wire(self, monkeypatch):+ """Task-level ``none`` must reach an always-toggle profile as its native disable shape."""+ import agent.auxiliary_client as aux++ monkeypatch.setattr(aux, "_get_auxiliary_task_config", lambda _task: {"reasoning_effort": "none"})++ kwargs = aux._build_call_kwargs(+ provider="deepseek",+ model="deepseek-v4-flash",+ messages=[{"role": "user", "content": "hello"}],+ extra_body=aux._get_task_extra_body("compression"),+ task="compression",+ )++ assert kwargs["extra_body"]["thinking"] == {"type": "disabled"}+ assert "reasoning" not in kwargs["extra_body"]++ def test_explicit_deepseek_thinking_disable_beats_profile_default(self):+ """An explicit vendor control is authoritative when no normalized config is present."""+ import agent.auxiliary_client as aux++ kwargs = aux._build_call_kwargs(+ provider="deepseek",+ model="deepseek-v4-flash",+ messages=[{"role": "user", "content": "hello"}],+ extra_body={"thinking": {"type": "disabled"}},+ task="compression",+ )++ assert kwargs["extra_body"]["thinking"] == {"type": "disabled"}+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