Repository navigation
[PR] fix: OpenAI proxy lane drops delta.reasoning — client keeps only first thinking token - #7434
Closed
ranxianglei wants to merge 3 commits into
Closed
ranxianglei wants to merge 3 commits into
ranxianglei wants to merge 3 commits into
Conversation
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11157-pr.7434.e627033This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7434.tgz
npm install -g packageInstall instructions are refreshed on each push. |
added 3 commits
November 21, 2026 12:50
…rame to reasoning_content (#7432) OpenAI-wire upstreams disagree on the streaming reasoning field name: the standard is reasoning_content, but Ollama Cloud (and some others) emit delta.reasoning. The proxy-lane SSE parser read only reasoning_content, so a provider streaming under delta.reasoning lost its whole thinking block — the client kept exactly the first token (the role-carrying frame hit the meta fallback; every later frame fell through all dispatch branches and was dropped). Read side now accepts the alias (reasoning_content -> reasoning -> reasoning_text, first non-empty, mirroring the client's reasoningFields order); the frame forwarded to the client is normalized back to reasoning_content so the client-visible field name stays stable and the history echo never trips an upstream that silently drops a reasoning field. withheldProseFrame (tool-call replay path) recognizes the alias too. Regression tests: trigger (delta.reasoning -> kind:reasoning + raw frame normalized) and non-trigger (delta.reasoning_content unchanged; plain text frame produces no reasoning event). Closes #7432
…g_content (#7432) kernel-change: openaiToCore (kernel/src/wire/openai.ts) read only m.reasoning_content when converting an assistant history message to core, so a client that echoes its prior-turn thinking under the reasoning field (Ollama Cloud) produced 0 reasoning cores and coreToOpenai dropped it — the second face of #7432 on the request side. Read side now accepts the alias (reasoning_content -> reasoning, first non-empty wins); the write side (coreToOpenai) stays reasoning_content — an upstream that silently drops a reasoning field would lose the CoT reuse. OpenAIMessage gains the optional reasoning field. Mechanical-bug exemption: provably-correct alias read mirroring the host fix; reproducing regression tests added (kernel unit + host integration). Human review tier still gates the merge. Bumps kernel 0.0.200 -> 0.0.201. Closes #7432
…7432) Two coverage gaps this PR's own implementation leaves untested: - the #1881 withheld-sibling-prose path (proxy-only tool frame) now reads the reasoning alias but no test drives it; - the third alias (reasoning_text) is in the read chain but untested. Both cases mirror the test shapes contributed by PR #7433 (JamesYuuu), the parallel host-only fix for the same issue, whose unique coverage this absorbs before that PR is superseded.
ranxianglei
force-pushed
the
2026-11-21_delta-reasoning-alias
branch
from
November 21, 2026 04:56
96c6b21 to
5fa66e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAI-wire upstreams disagree on the streaming reasoning field name: the standard is
reasoning_content, but Ollama Cloud (and some others) emitdelta.reasoning. The proxy-lane SSE parser (src/loop/adapter-openai.ts) read onlyreasoning_content, so a provider streaming underdelta.reasoninglost its whole thinking block — the client kept exactly the first token (the role-carrying frame hit the meta fallback; every later frame fell through all dispatch branches and was dropped). Same bug family on the request side:kernel/src/wire/openai.tsopenaiToCoreread onlym.reasoning_content, so a client echoing history underreasoningproduced 0 reasoning cores.Fix
reasoning_content→reasoning→reasoning_text, first non-empty, mirroring the client'sreasoningFieldsorder).reasoning_content— the client-visible field name stays stable and the history echo never trips an upstream that silently drops areasoningfield (empirical:reasoning_contentecho → upstream 200 + CoT reuse;reasoningecho → upstream 200 but reasoning frames=0).withheldProseFrame(tool-call replay path) recognizes the alias.openaiToCorereads the alias; write side (coreToOpenai) staysreasoning_content.OpenAIMessagegains the optionalreasoningfield.kernel-change
kernel/src/wire/openai.tsopenaiToCoreread onlym.reasoning_content; a client echoing prior-turn thinking underreasoning(Ollama Cloud) produced 0 reasoning cores andcoreToOpenaidropped it. Read side now accepts the alias (first non-empty wins); write side staysreasoning_content. Mechanical-bug exemption: provably-correct alias read mirroring the host fix; reproducing regression tests added (kernel unit + host integration). Human review tier still gates the merge.Bumps kernel 0.0.201 → 0.0.202 (master already carried 0.0.201 from an earlier kernel PR; branch rebased onto current master).
Tests
tests/openai-reasoning-content.test.ts— trigger (delta.reasoning→kind:reasoning+ raw frame normalized toreasoning_content), non-triggers (delta.reasoning_contentunchanged; plain text frame produces no reasoning event), plus thereasoning_textalias case and the [bug] ACP 标签泄漏:<acp tokens=...> 标签被模型原样复述到回复正文,仅靠系统提示劝阻不足 #1881 withheld-sibling-prose alias case — the two latter absorbed with credit from the parallel host-only PR [PR] fix: read the delta.reasoning alias in the OpenAI adapter (#7432) #7433 (JamesYuuu), which duplicates this one (labeledduplicate/superseded; its unique coverage now lives here, commit 5fa66e6).kernel/tests/wire-reasoning-echo.test.ts— alias read + echoed asreasoning_content; blank alias keeps the blank-echo contract;reasoning_contentwins over the alias when both present.Closes #7432