Skip to content

Commit 42c4288

Browse files
committed
fix(chat_completions): broaden tool_name strip docstring + AUTHOR_MAP
Salvage follow-up to PR #28958 (savanne-kham): - convert_messages() docstring now explicitly documents the tool_name strip alongside Codex fields, names which providers reject it (Fireworks, Moonshot/Kimi), and why permissive providers (OpenRouter, MiniMax) masked the bug. - AUTHOR_MAP entry for [email protected] -> savanne-kham.
1 parent 2589656 commit 42c4288

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

agent/transports/chat_completions.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,21 @@ def api_mode(self) -> str:
112112
def convert_messages(
113113
self, messages: list[dict[str, Any]], **kwargs
114114
) -> list[dict[str, Any]]:
115-
"""Messages are already in OpenAI format — sanitize Codex leaks only.
116-
117-
Strips Codex Responses API fields (``codex_reasoning_items`` /
118-
``codex_message_items`` on the message, ``call_id``/``response_item_id``
119-
on tool_calls) that strict chat-completions providers reject with 400/422.
115+
"""Messages are already in OpenAI format — strip internal fields
116+
that strict chat-completions providers reject with HTTP 400/422.
117+
118+
Strips:
119+
120+
- Codex Responses API fields: ``codex_reasoning_items`` /
121+
``codex_message_items`` on the message, ``call_id`` /
122+
``response_item_id`` on ``tool_calls`` entries.
123+
- ``tool_name`` on tool-result messages — written by
124+
``make_tool_result_message()`` for the SQLite FTS index, but not
125+
part of the Chat Completions schema. Strict providers (Fireworks,
126+
Moonshot/Kimi) reject any payload containing it with
127+
``Extra inputs are not permitted, field: 'messages[N].tool_name'``.
128+
Permissive providers (OpenRouter, MiniMax) silently ignore the
129+
field, which masked the bug for months.
120130
"""
121131
needs_sanitize = False
122132
for msg in messages:

scripts/release.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@
372372
"[email protected]": "bloodcarter",
373373
"[email protected]": "scotttrinh",
374374
"[email protected]": "quocanh261997",
375+
"[email protected]": "savanne-kham", # PR #28958 salvage (strip tool_name for strict providers)
375376
# contributors (from noreply pattern)
376377
"[email protected]": "davidvv",
377378
"[email protected]": "xiaoqiang243",

0 commit comments

Comments
 (0)