The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): accept only a real bool provider-level answer_in_reasoning
kshitijk4poora1bccf3344bf
diff --git a/agent/reasoning_promotion.py b/agent/reasoning_promotion.pyindex 309ac62214a..ad5d8fd6c5e 100644--- a/agent/reasoning_promotion.py+++ b/agent/reasoning_promotion.py@@ -58,8 +58,8 @@ def answer_in_reasoning_capability(agent: Any) -> bool:entries = list(_entries_for_route(base_url, custom_providers, None))live = [e for e in entriesif custom_provider_slug(str(e.get("name") or ""), str(e.get("provider_key") or "")) in ids]- flags = {(e.get("capabilities") or {}).get(_ANSWER_IN_REASONING_CAPABILITY) for e in live or entries}- flags &= {True, False}+ flags = {v for e in live or entries+ if isinstance(v := (e.get("capabilities") or {}).get(_ANSWER_IN_REASONING_CAPABILITY), bool)}if flags:return flags == {True}diff --git a/tests/agent/test_empty_terminal_reasoning_surface.py b/tests/agent/test_empty_terminal_reasoning_surface.pyindex 6b55aa04436..8f19c0decc6 100644--- a/tests/agent/test_empty_terminal_reasoning_surface.py+++ b/tests/agent/test_empty_terminal_reasoning_surface.py@@ -34,6 +34,7 @@ _OPTED_IN_PROVIDERS = [{"name": "acme", "base_url": "https://llm.example.com/v1", "model": "acme/reasoner","capabilities": {"answer_in_reasoning": True}},{"name": "acme-plain", "base_url": "https://llm.example.com/v1"}, # same endpoint, no opt-in+ {"name": "acme-int", "base_url": "https://int.example.com/v1", "capabilities": {"answer_in_reasoning": 1}}, # not a bool]@@ -191,6 +192,7 @@ def test_length_cut_reasoning_is_not_promoted(tmp_path, monkeypatch):("custom", "https://llm.example.com/v1", "acme/after-model-switch", "private thoughts that must not be shown", 1),("custom", "https://fallback.example.com/v1", "acme/reasoner", "the visible answer", 2),(("custom", "custom:acme-plain"), "https://llm.example.com/v1", "acme/reasoner", "the visible answer", 2),+ ("custom:acme-int", "https://int.example.com/v1", "acme/reasoner", "the visible answer", 2),])def test_reasoning_promotion_requires_a_trusted_route(tmp_path, monkeypatch, provider, base_url, model, final, calls):"""Private reasoning on an untrusted route retries to the visible answer and never