Conversation
When a reasoning block has a background colour configured, the blank line separating it from the following message was incorrectly rendered with the reasoning background, visually extending the shaded region one line too far. The root cause was that inter-block separators were emitted as part of the block that preceded them, so the separator after a reasoning block always inherited its background, regardless of what came next. The fix defers that separator: `print_block` now suppresses the trailing separator for reasoning blocks (via the new `suppress_trailing_separator` field on `TerminalOptions`) and sets a `reasoning_separator_pending` flag instead. When the next event arrives the flag is consumed and the separator is emitted with the correct background — shaded when more reasoning follows (the gap stays inside the reasoning region), unstyled when reasoning gives way to a message, tool call, or end of stream. `flush` also drains the pending separator without shading, covering role-header transitions and end-of-stream cases. Two regression tests pin the behaviour: one checks that a single reasoning block followed by a message produces no shaded separator, and another checks that multi-paragraph reasoning keeps exactly one shaded inter-paragraph separator while the gap to the message remains unstyled. Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
When a reasoning block has a background colour configured, the blank line separating it from the following message was incorrectly rendered with the reasoning background, visually extending the shaded region one line too far.
The root cause was that inter-block separators were emitted as part of the block that preceded them, so the separator after a reasoning block always inherited its background, regardless of what came next.
The fix defers that separator:
print_blocknow suppresses the trailing separator for reasoning blocks (via the newsuppress_trailing_separatorfield onTerminalOptions) and sets areasoning_separator_pendingflag instead. When the next event arrives the flag is consumed and the separator is emitted with the correct background — shaded when more reasoning follows (the gap stays inside the reasoning region), unstyled when reasoning gives way to a message, tool call, or end of stream.flushalso drains the pending separator without shading, covering role-header transitions and end-of-stream cases.Two regression tests pin the behaviour: one checks that a single reasoning block followed by a message produces no shaded separator, and another checks that multi-paragraph reasoning keeps exactly one shaded inter-paragraph separator while the gap to the message remains unstyled.