From 82a5bb377863bf98c2b3dac944eed4b8a35a4b6f Mon Sep 17 00:00:00 2001 From: DavyMassoneto Date: Sun, 10 May 2026 21:12:30 -0300 Subject: [PATCH] chore(sanitizer): remove explanatory reasoning comments Keep the tool/function-call preservation logic intact while removing noisy implementation comments from the PR diff. Co-Authored-By: OpenClaude (dmassoneto) --- open-sse/handlers/responseSanitizer.ts | 4 ---- tests/unit/response-sanitizer.test.ts | 2 -- 2 files changed, 6 deletions(-) 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 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" });