The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): preserve explicit Responses tool strictness
Andrew Johnson908fb96fb653
diff --git a/agent/codex_responses_adapter.py b/agent/codex_responses_adapter.pyindex 6b9e388c2b2..2dda4aba48d 100644--- a/agent/codex_responses_adapter.py+++ b/agent/codex_responses_adapter.py@@ -313,7 +313,8 @@ def _responses_tools(tools: Optional[List[Dict[str, Any]]] = None) -> Optional[Lfns = [item.get("function", {}) if isinstance(item, dict) else {} for item in tools or []]converted = [{- "type": "function", "name": fn["name"], "description": fn.get("description", ""), "strict": False,+ "type": "function", "name": fn["name"], "description": fn.get("description", ""),+ "strict": fn.get("strict") if isinstance(fn.get("strict"), bool) else False,"parameters": fn.get("parameters", {"type": "object", "properties": {}}),}for fn in fns if _nonblank(fn.get("name"))diff --git a/tests/agent/test_codex_responses_adapter.py b/tests/agent/test_codex_responses_adapter.pyindex d0cf7655d06..aaef5621369 100644--- a/tests/agent/test_codex_responses_adapter.py+++ b/tests/agent/test_codex_responses_adapter.py@@ -12,6 +12,7 @@ from agent.codex_responses_adapter import (_neutralize_harmony_tokens,_preflight_codex_api_kwargs,_preflight_codex_input_items,+ _responses_tools,)@@ -22,6 +23,28 @@ _HARMONY_SOURCE_SNIPPET = ()+def test_responses_tools_preserve_explicit_boolean_strictness():+ def tool(name, strict_marker=None):+ fn = {"name": name, "parameters": {"type": "object", "properties": {}}}+ if strict_marker is not None:+ fn["strict"] = strict_marker+ return {"type": "function", "function": fn}++ converted = _responses_tools([+ tool("default"),+ tool("strict", True),+ tool("non_strict", False),+ tool("invalid", "true"),+ ])++ assert [(item["name"], item["strict"]) for item in converted] == [+ ("default", False),+ ("strict", True),+ ("non_strict", False),+ ("invalid", False),+ ]++def test_chat_content_drops_images_from_assistant_role():content = [{"type": "text", "text": "generated image"},