diff --git a/run_agent.py b/run_agent.py index ae5c3b5deb..5170178b70 100644 --- a/run_agent.py +++ b/run_agent.py @@ -1323,16 +1323,6 @@ class AIAgent: call_id = f"call_{uuid.uuid4().hex[:12]}" call_id = call_id.strip() - response_item_id = tc.get("response_item_id") - if not isinstance(response_item_id, str) or not response_item_id.strip(): - response_item_id = tc.get("responses_item_id") - if not isinstance(response_item_id, str) or not response_item_id.strip(): - response_item_id = embedded_response_item_id - response_item_id = self._derive_responses_function_call_id( - call_id, - response_item_id if isinstance(response_item_id, str) else None, - ) - arguments = fn.get("arguments", "{}") if isinstance(arguments, dict): arguments = json.dumps(arguments, ensure_ascii=False) @@ -1342,7 +1332,6 @@ class AIAgent: items.append({ "type": "function_call", - "id": response_item_id, "call_id": call_id, "name": fn_name, "arguments": arguments, diff --git a/tests/test_run_agent_codex_responses.py b/tests/test_run_agent_codex_responses.py index d4fd75ebf7..7121cc5720 100644 --- a/tests/test_run_agent_codex_responses.py +++ b/tests/test_run_agent_codex_responses.py @@ -300,7 +300,7 @@ def test_run_conversation_codex_tool_round_trip(monkeypatch): assert any(msg.get("role") == "tool" and msg.get("tool_call_id") == "call_1" for msg in result["messages"]) -def test_chat_messages_to_responses_input_uses_fc_id_for_function_call(monkeypatch): +def test_chat_messages_to_responses_input_uses_call_id_for_function_call(monkeypatch): agent = _build_agent(monkeypatch) items = agent._chat_messages_to_responses_input( [ @@ -324,7 +324,7 @@ def test_chat_messages_to_responses_input_uses_fc_id_for_function_call(monkeypat function_output = next(item for item in items if item.get("type") == "function_call_output") assert function_call["call_id"] == "call_abc123" - assert function_call["id"] == "fc_abc123" + assert "id" not in function_call assert function_output["call_id"] == "call_abc123" @@ -352,11 +352,11 @@ def test_chat_messages_to_responses_input_accepts_call_pipe_fc_ids(monkeypatch): function_output = next(item for item in items if item.get("type") == "function_call_output") assert function_call["call_id"] == "call_pair123" - assert function_call["id"] == "fc_pair123" + assert "id" not in function_call assert function_output["call_id"] == "call_pair123" -def test_run_conversation_codex_replay_payload_keeps_call_id_and_fc_id(monkeypatch): +def test_run_conversation_codex_replay_payload_keeps_call_id(monkeypatch): agent = _build_agent(monkeypatch) responses = [_codex_tool_call_response(), _codex_message_response("done")] requests = [] @@ -389,7 +389,7 @@ def test_run_conversation_codex_replay_payload_keeps_call_id_and_fc_id(monkeypat function_call = next(item for item in replay_input if item.get("type") == "function_call") function_output = next(item for item in replay_input if item.get("type") == "function_call_output") assert function_call["call_id"] == "call_1" - assert function_call["id"] == "fc_1" + assert "id" not in function_call assert function_output["call_id"] == "call_1"