Repository navigation
Conversation
Anthropic thinking text ends with "\n\n", and _stream_reasoning_delta printed every newline as a line, so the reasoning box always closed on an empty dim row. Trailing newlines are now held in the buffer and stripped at close; paragraph breaks inside the reasoning still render. The newline that ends a force-flushed (>80 char) partial line was also printed as an empty row, doubling paragraph gaps after long lines.
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.
What does this PR do?
With
show_reasoning+ streaming on, the CLI reasoning box always ends with an empty dim line just above the└───┘footer when the model is Anthropic Opus.Cause: Anthropic thinking text ends with
\n\n(every Opus reasoning in my localstate.dbdoes), and_stream_reasoning_delta(hermes_cli/cli_stream_mixin.py) prints every newline as a line, so the second\nbecomes a blank row before_close_reasoning_boxdraws the footer.Fix: trailing newlines stay in
_reasoning_bufuntil more text arrives, and_close_reasoning_boxstrips them. Paragraph breaks inside the reasoning are released as soon as the next text arrives, so they still render; leading blank lines are unchanged.Same loop, same symptom: the newline that ends a force-flushed (>80 char, no newline yet) partial line was also printed as an empty row, so a paragraph break after a long line rendered as two blank lines. That newline is now consumed as the end of the already-printed line.
Scope: only the blank-line handling. #53535 (streaming reasoning clamp, open) rewrites the same loop with a similar blank-line hold as part of a larger feature; this PR is the minimal bug fix, and the two will conflict textually; the tests here describe the display contract a clamp change can keep.
Related Issue
No existing issue. Related: #53535 (overlapping lines, larger scope).
Type of Change
Changes Made
hermes_cli/cli_stream_mixin.py:_stream_reasoning_deltaholds trailing newlines and skips the newline that ends a force-flushed line;_close_reasoning_boxstrips the held newlines and clears the flush flag;_reset_stream_stateclears the flag too.tests/hermes_cli/test_reasoning_box_blank_lines.py: two behaviour contracts (no trailing blank line, single and split chunks; no extra blank after a force-flushed line, including a whitespace continuation).How to Test
scripts/run_tests.sh tests/hermes_cli/test_reasoning_box_blank_lines.py— 4 cases fail onmain, pass with this change.scripts/run_tests.sh tests/hermes_cli/test_reasoning_box_blank_lines.py tests/hermes_cli/test_reasoning_command.py tests/hermes_cli/test_stream_delta_think_tag.py tests/hermes_cli/test_status_lines_held_during_stream_box.py— 42 passed.state.dbthrough_stream_reasoning_deltain random 1–12 char chunks (5 chunkings each): no box ends on a blank line and no text is lost./reasoning showwith an Anthropic Opus model; the reasoning box closes directly on its last text line.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — ran the affectedtests/hermes_cli/files viascripts/run_tests.sh, not the full suitepython scripts/checkpasses (the blocking lint and code-health checks CI runs)Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A