Train 1D: merge via --admin on .113 validation

Squash merge from local merge-train (Hard Rule owner-approved). Tip 029cdf4215cf465f0e1716ac9f84a84692b1e881 validated on 192.168.0.113: 26631/26653 pass.
This commit is contained in:
Austin Liu
2026-07-27 23:59:38 +09:30
committed by GitHub
parent 847d1ad84c
commit f93da3f5ca
2 changed files with 35 additions and 1 deletions

View File

@@ -191,7 +191,11 @@ export function openaiToClaudeResponse(chunk, state) {
}
if (parts.length > 0) reasoningContent = parts.join("");
}
if (reasoningContent && !isInternalReasoningPlaceholder(reasoningContent)) {
if (
typeof reasoningContent === "string" &&
reasoningContent !== "" &&
!isInternalReasoningPlaceholder(reasoningContent)
) {
stopTextBlock(state, results);
if (!state.thinkingBlockStarted) {

View File

@@ -0,0 +1,30 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { openaiToClaudeResponse } from "../../open-sse/translator/response/openai-to-claude.ts";
test("openai-to-claude ignores zero-length reasoning_content empty string deltas", () => {
const state = {
messageStartSent: true,
thinkingBlockStarted: false,
thinkingBlockIndex: -1,
textBlockStarted: false,
textBlockIndex: -1,
textBlockClosed: false,
nextBlockIndex: 0,
_pendingXmlToolCalls: [],
};
const chunk = {
choices: [
{
delta: {
reasoning_content: "",
},
},
],
};
const results = openaiToClaudeResponse(chunk, state) || [];
assert.equal(results.length, 0);
assert.equal(state.thinkingBlockStarted, false);
});