Skip to content

fix(cli): show_reasoning works independently of streaming setting (#34209) - #34355

Closed
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/34209-show-reasoning-non-streaming
Closed

fix(cli): show_reasoning works independently of streaming setting (#34209)#34355
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/34209-show-reasoning-non-streaming

Conversation

@Bartok9

@Bartok9 Bartok9 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Closes #34209

Problem

In CLI mode, show_reasoning=true only displayed reasoning when streaming=true. Users who prefer non-streaming output (streaming: false) couldn't see reasoning content even with show_reasoning: true explicitly set.

# cli.py::_current_reasoning_callback (before)
if self.show_reasoning and self.streaming_enabled:
    return self._stream_reasoning_delta
# show_reasoning=True, streaming=False fell through to None

The agent had no reasoning sink and reasoning tokens were silently dropped.

Fix

The CLI already has a buffered-preview render path (_on_reasoning + _flush_reasoning_preview) used today for verbose=True, show_reasoning=False — emits compact [thinking] blocks on natural boundaries.

Reusing it for the non-streaming show_reasoning case restores expected behavior without changing the user's CLI output preferences.

Coverage matrix after fix

show_reasoning streaming verbose reasoning render
True True any live token-by-token box
True False any buffered [thinking] preview ← #34209
False any True minimal [thinking] preview
False any False no reasoning render

Tests

  • Updated test_show_reasoning_non_streaming_uses_final_box_only...uses_buffered_preview. The old assertion enshrined the bug (assertIsNone); the new one locks in the fix.
  • 3 new tests: test_no_callback_when_all_options_off, test_no_callback_when_streaming_only, test_show_reasoning_takes_precedence_over_verbose.
$ python -m pytest tests/cli/test_reasoning_command.py
=== 58 passed in 1.11s ===

🎻 Co-authored-by: Cursor cursoragent@cursor.com

…usResearch#34209)

In CLI mode, `show_reasoning=true` only displayed reasoning when
`streaming=true`. Users who prefer non-streaming output
(`streaming: false`) could not see reasoning content even with
`show_reasoning: true` explicitly set in ~/.hermes/config.yaml.

Root cause: cli.py::_current_reasoning_callback returned None for the
combination (show_reasoning=True, streaming_enabled=False), so the
agent had no reasoning sink and reasoning tokens were silently dropped
before reaching any render path.

The CLI already had a buffered-preview render path (_on_reasoning +
_flush_reasoning_preview) used today by the (verbose=True,
show_reasoning=False) combination \u2014 that path emits compact
`[thinking] ...` blocks on natural boundaries. Reusing it for the
non-streaming show_reasoning case is the smallest change that
restores the expected behavior without changing anything else about
the user's CLI output preferences.

Coverage matrix after this fix:

  show_reasoning  streaming   verbose   reasoning render
  --------------  ---------   -------   ---------------------------
  True            True        any       live token-by-token box
  True            False       any       buffered [thinking] preview  \u2190 NousResearch#34209
  False           any         True      minimal [thinking] preview
  False           any         False     no reasoning render

Updated test name + assertion:
  test_show_reasoning_non_streaming_uses_final_box_only
    \u2192 test_show_reasoning_non_streaming_uses_buffered_preview
  (the old assertion enshrined the bug; new assertion locks in the fix)

Tests (3 new + 1 updated in TestReasoningDisplayModeSelection):

- test_show_reasoning_non_streaming_uses_buffered_preview \u2014 NousResearch#34209
  regression: confirms the buffered preview callback is returned
  for (show_reasoning=True, streaming=False).
- test_no_callback_when_all_options_off \u2014 default state guard.
- test_no_callback_when_streaming_only \u2014 streaming on but no
  reasoning flag = no callback (existing behavior pinned).
- test_show_reasoning_takes_precedence_over_verbose \u2014 when both
  show_reasoning and verbose are True with streaming, show_reasoning
  wins (live-stream callback, not preview).

All 58 tests in test_reasoning_command.py pass.

Refs: NousResearch#34209
Closes: NousResearch#34209

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #34224 for the same fix (#34209). Both route non-streaming reasoning through the buffered preview callback. This PR (Cursor co-authored) adds more test coverage.

@Bartok9

Bartok9 commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #34224 — thanks @alt-glitch and the reviewer pipeline for flagging the dup pattern (same as #34376 \u2192 #34241 earlier tonight).

@LeonSGP43's PR #34224 (opened ~54 min before mine) makes the same routing fix to _current_reasoning_callback AND \u2014 importantly \u2014 also marks _reasoning_shown_this_turn = True in the preview callback path, which prevents the final-response box from rendering a duplicate reasoning block. That's a real edge case my PR missed.

#34224 is the canonical fix; closing this one.

\u2014 Bartok9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show_reasoning should work independently of streaming in CLI mode

2 participants