Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

chore(sanitizer): remove explanatory reasoning comments

DavyMassoneto82a5bb377863
diff --git a/open-sse/handlers/responseSanitizer.ts b/open-sse/handlers/responseSanitizer.ts
index 554a989f02..cf3131f79e 100644
--- a/open-sse/handlers/responseSanitizer.ts
+++ b/open-sse/handlers/responseSanitizer.ts
@@ -285,10 +285,6 @@ function sanitizeMessage(msg: unknown): unknown {
// Non-streaming responses should not expose both visible content and reasoning_content.
// Some clients drop the visible assistant text or render duplicated panels when both fields
// are present in the final payload. Keep reasoning_content only for reasoning-only messages.
- // EXCEPTION: When tool_calls (or legacy function_call) are present, reasoning_content
- // must be preserved because thinking-enabled providers (e.g., Kimi) require it on
- // assistant tool call messages. Without it, subsequent requests fail with:
- // "thinking is enabled but reasoning_content is missing in assistant tool call message"
if (
sanitized.reasoning_content !== undefined &&
hasVisibleMessageContent(sanitized.content) &&
diff --git a/tests/unit/response-sanitizer.test.ts b/tests/unit/response-sanitizer.test.ts
index e0bde80033..9cc7b71ab2 100644
--- a/tests/unit/response-sanitizer.test.ts
+++ b/tests/unit/response-sanitizer.test.ts
@@ -58,8 +58,6 @@ test("sanitizeOpenAIResponse extracts thinking, collapses newlines, preserves re
assert.equal((sanitized as any).choices[0].index, 2);
assert.equal((sanitized as any).choices[0].finish_reason, "tool_calls");
(assert as any).equal((sanitized as any).choices[0].message.content, "Hello\n\nworld");
- // reasoning_content extracted from <think> tags is preserved when tool_calls exist
- // because thinking-enabled providers require it on assistant tool call messages
assert.equal((sanitized as any).choices[0].message.reasoning_content, "internal chain");
(assert as any).deepEqual((sanitized as any).choices[0].message.tool_calls, [{ id: "call_1" }]);
assert.deepEqual((sanitized as any).choices[0].message.function_call, { name: "legacy" });