Repository navigation
Conversation
OpenAI reasoning summary parts each open with a bold title line. Streaming separated them with a single newline, which Markdown treats as a soft break, so every title after the first rendered at the end of the previous paragraph. A blank line now precedes each part. The first part gets one too. Consumers that join consecutive reasoning items, such as the Coder chat UI, would otherwise glue the next item's title onto the previous sentence. Generate joins the parts with a blank line to match.
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.
Problem
Each OpenAI reasoning summary part has the form
**Title**\n\nBody.Streamsent a single"\n"before each part, andGeneratejoined the parts with"\n". Markdown treats a single newline as a soft break, so in the Coder chat UI each title after the first one shows inline at the end of the previous paragraph.Fix
Streamsends"\n\n"before every summary part, including the first one. Stream deltas do not mark where one reasoning item ends. The Coder chat UI joins adjacent reasoning parts into one block, including across provider-executedweb_searchcalls. Without the leading blank line, the title of the next item would join the previous sentence with no space.Generatejoins the parts with"\n\n". It still adds no blank line before the first part, as before.Generatereturns each reasoning item as a separateReasoningContent.Replay is unaffected.
responsesReasoningInputItemrebuilds each item fromResponsesReasoningMetadata.Summary, not from the text.Not changed: the OpenRouter and Vercel providers use the same single newline for
openai-responsesreasoning details (providers/openrouter/language_model_hooks.go:157,356andproviders/vercel/language_model_hooks.go:196,403). Their first part has no leading separator, and I have not checked their data.Validation
responses_reasoning_summary_test.gocoversStream(an item with two parts, then an item with one part) andGenerate. Both tests fail with the old separator.go test ./...,go build ./..., andgolangci-lint run ./providers/openai/...pass, andgo mod tidyleaves no diff. A fullgolangci-lint run(local v2.0.2) reports onepreallocissue inproviders/kronk/language_model.go:624, a file this PR does not change.go.mod.coder/coder will update its fantasy pin after this merges.
Dogfood data behind the leading separator
I queried 7 days of dogfood
chat_messagesfor OpenAI Responses models (openai, and Bedrockopenai.*):"\n" + summary[0] + "\n" + summary[1] .... Only this provider adds the separator.**Title**\n\n. No part starts or ends with whitespace.web_searchcall is between them. Without a blank line before the first part, these would show assentence.**Title**.