fix: preserve reasoning content in streamed chat traces - #2522
Open
Mathew Stevens (mstevens843) wants to merge 1 commit into
Open
Mathew Stevens (mstevens843) wants to merge 1 commit into
Mathew Stevens (mstevens843) wants to merge 1 commit into
Conversation
Mathew Stevens (mstevens843)
marked this pull request as ready for review
September 25, 2026 07:10
This branch has not been deployed
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.
Related to #2511.
Preserve streamed
delta.reasoning_contentasmessage.reasoning_content, concatenating fragments independently per choice. Keep absent, empty and null-only values distinct without letting later nulls erase text. Ordinary content stays separate;reasoningandreasoning_detailsare unchanged.Add constructed edge-case regressions and genuine DeepSeek recordings across six pinned/latest OpenAI SDK aliases through both
wrapOpenAIand auto-hook instrumentation. Expectations come from ordered raw fragments, with paired snapshots and a patch changeset.Support the scenario's dependency-bump workflow by forwarding
DEEPSEEK_API_KEYto Docker by name and stripping it from dependency-install environments. Two dummy-only behavioral regressions exercise the actual command/environment paths and run in CI.Fresh validation: 696 unique cases pass, including 87 focused, 589 compatibility, 15 helper/script, one genuine 12-path matrix and four changeset tests. The genuine matrix passes three consecutive keyless replays. Both credential defects were demonstrated RED before correction. Workspace/narrow typings, dependency builds, formatting, lint, script syntax and changeset checks pass.
Earlier identical genuine recordings demonstrated reasoning loss on untouched base after content passed. Optional whole-E2E type checking previously reported 323 identical base/patch diagnostics; it was not rerun in the maintenance pass. Actual Docker execution and other runtime/platform CI lanes remain unrun locally. No new provider requests were made for the maintenance correction.
Credit to the reporter and prior provider work linked in #2511. Prepared and independently reviewed with AI assistance; human review and any personal attestations remain with the submitter.