The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(auxiliary): keep tool_calls finish when Codex aux response is incomplete
kshitijk4poor9a10fffabbf2
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.pyindex 61b25a810c3..bc1d4461771 100644--- a/agent/auxiliary_client.py+++ b/agent/auxiliary_client.py@@ -1155,8 +1155,11 @@ def _parse_codex_final_response(reason = str(_field(normalized_final.incomplete_details, "reason", "") or "").strip().lower()# Aux consumers speak Chat Completions: "length" activates their existing# partial-summary rejection/fallback, whereas Codex's "incomplete" does not.- # A final_answer phase cannot override the provider's incomplete status.- if finish_reason == "incomplete" or (status == "incomplete" and reason != "content_filter"):+ # A final_answer phase cannot override the provider's incomplete status, but completed+ # tool calls stay "tool_calls" so dispatchers (e.g. MCP sampling) still run them.+ if finish_reason != "tool_calls" and (+ finish_reason == "incomplete" or (status == "incomplete" and reason != "content_filter")+ ):finish_reason = "length"text_parts = [message.content] if message.content else []tool_calls_raw = message.tool_callsdiff --git a/tests/agent/test_auxiliary_codex_completion_status.py b/tests/agent/test_auxiliary_codex_completion_status.pyindex fdb545ea626..ab7b6974481 100644--- a/tests/agent/test_auxiliary_codex_completion_status.py+++ b/tests/agent/test_auxiliary_codex_completion_status.py@@ -87,6 +87,7 @@ _CODEX_REASONING_ONLY = SimpleNamespace(pytest.param("", "completed", [_message("COMMENTARY", phase="commentary")], None, None, "length", id="commentary-only"),pytest.param("", "completed", [_TOOL_CALL], None, None, "tool_calls", id="tool-call"),pytest.param("", "incomplete", [_message("PARTIAL")], "max_output_tokens", "PARTIAL", "length", id="token-cap"),+ pytest.param("", "incomplete", [_TOOL_CALL], "max_output_tokens", None, "tool_calls", id="token-cap-after-tool-call"),# Route-sensitive normalization: the issuer comes from the request's route classification.pytest.param("https://chatgpt.com/backend-api/codex", "completed", [_CODEX_REASONING_ONLY], None, None, "length",id="codex-reasoning-only"),