openclaw - ✅(Solved) Fix [Bug]: Thinking lines are missing whitespace [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66008Fetched 2026-04-14 05:39:17
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
cross-referenced ×2labeled ×2referenced ×2

Streamed thinking output is missing whitespace and sentences just get smushed together.

Root Cause

Streamed thinking output is missing whitespace and sentences just get smushed together.

Fix Action

Fixed

PR fix notes

PR #66067: fix(tui): preserve spaces between thinking fragments

Description (problem / solution / changelog)

Summary

  • Problem: streamed thinking fragments were joined with single newlines, and the TUI markdown renderer collapsed those boundaries so adjacent sentences appeared smushed together
  • Why it matters: reasoning output in the terminal became hard to read even though the underlying content arrived correctly
  • What changed: normalize single-line thinking boundaries into spaces while preserving paragraph breaks, and add formatter/stream-assembler regressions
  • What did NOT change (scope boundary): assistant answer text rendering and non-thinking text block joining remain unchanged

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #66008
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the TUI formatter preserved single newlines between thinking fragments, but the markdown renderer did not render those boundaries as readable spaces
  • Missing detection / guardrail: there was no regression test covering multiple thinking blocks rendered in a single streamed assistant update
  • Contributing context (if known): reasoning/thinking often arrives in sentence-sized chunks instead of one complete paragraph

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/tui/tui-formatters.test.ts and src/tui/tui-stream-assembler.test.ts
  • Scenario the test should lock in: consecutive thinking fragments stay readable with spaces while explicit paragraph breaks survive
  • Why this is the smallest reliable guardrail: it exercises the exact formatter and streamed-assembly surfaces that build terminal assistant output
  • Existing test that already covers this (if any): prior tests covered thinking visibility but not fragment boundary spacing
  • If no new test is added, why not:

User-visible / Behavior Changes

  • Streamed thinking text in the TUI now keeps sentence spacing instead of smushing adjacent fragments together.

Diagram (if applicable)

Before:
[thinking chunk A]\n[thinking chunk B] -> markdown render -> "chunk Achunk B"

After:
[thinking chunk A]\n[thinking chunk B] -> whitespace normalization -> "chunk A chunk B"

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local pnpm/vitest
  • Model/provider: N/A
  • Integration/channel (if any): TUI
  • Relevant config (redacted): showThinking=true

Steps

  1. Render an assistant message containing multiple thinking fragments.
  2. Show thinking in the TUI.
  3. Inspect the rendered output.

Expected

  • Adjacent thinking fragments remain readable with spaces between sentences.

Actual

  • Before this fix, sentence boundaries could collapse and appear as one long smushed block.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: targeted vitest run for src/tui/tui-formatters.test.ts and src/tui/tui-stream-assembler.test.ts
  • Edge cases checked: consecutive thinking fragments and explicit paragraph breaks
  • What you did not verify: full interactive terminal reproduction against a live model stream

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: some intentionally line-broken thinking text could become single-paragraph prose
    • Mitigation: explicit blank-line paragraph breaks are preserved, and the fix only touches thinking text in the TUI path

AI-assisted: Yes (Codex). Testing: targeted vitest coverage listed above. I attempted codex review --base origin/main, but the local Codex CLI is currently rate-limited.

Changed files

  • src/tui/tui-formatters.test.ts (modified, +22/-1)
  • src/tui/tui-formatters.ts (modified, +12/-2)
  • src/tui/tui-stream-assembler.test.ts (modified, +14/-0)

Code Example

I’m going to read the skill-authoring instructions first, then I’ll turn the SendBlue flow into a proper skill.I’m checking the rest
of the skill-creator instructions so I can build this in the right shape, not just dump a folder.I’m creating the skill skeleton
now, then I’ll wire in the SendBlue workflow and package it.I need one quick detail from SendBlue’s docs so the skill doesn’t bake
in the wrong API shape.I don’t have SendBlue docs available locally, so I’m making the skill intentionally small and adaptable: a
safe wrapper for whatever SendBlue CLI/HTTP command you have on this machine.I’ve got enough to build the skill now. I’m writing it
as a small “adapter skill” so it works whether your SendBlue access is CLI- or HTTP-based.I’m validating the skill structure before
I call it done.I’ve packaged it successfully. I’m going to make one tiny cleanup pass so the skill name reads a bit more cleanly,
then I’ll commit it.I’m committing the new skill now.DoneI created a sendblue-imessage skill and packaged it.

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Streamed thinking output is missing whitespace and sentences just get smushed together.

Steps to reproduce

  1. Use TUI and ask a question
  2. Observe streamed thinking output.

Expected behavior

Streamed thinking is neatly formatted with proper whitespace. Lines should have a space between them so sentences don’t become unreadable.

Actual behavior

The output looks like this:

I’m going to read the skill-authoring instructions first, then I’ll turn the SendBlue flow into a proper skill.I’m checking the rest
of the skill-creator instructions so I can build this in the right shape, not just dump a folder.I’m creating the skill skeleton
now, then I’ll wire in the SendBlue workflow and package it.I need one quick detail from SendBlue’s docs so the skill doesn’t bake
in the wrong API shape.I don’t have SendBlue docs available locally, so I’m making the skill intentionally small and adaptable: a
safe wrapper for whatever SendBlue CLI/HTTP command you have on this machine.I’ve got enough to build the skill now. I’m writing it
as a small “adapter skill” so it works whether your SendBlue access is CLI- or HTTP-based.I’m validating the skill structure before
I call it done.I’ve packaged it successfully. I’m going to make one tiny cleanup pass so the skill name reads a bit more cleanly,
then I’ll commit it.I’m committing the new skill now.Done — I created a sendblue-imessage skill and packaged it.

There’s no proper spacing between lines and it quickly becomes hard to read.

<img width="2128" height="302" alt="Image" src="https://github.com/user-attachments/assets/3db440cf-9a89-46f9-abe5-291a88361aaf" />

OpenClaw version

2026.4.12

Operating system

macOS 15.7.2 (24G325)

Install method

bun

Model

github-copilot/gpt-5.4-mini

Provider / routing chain

openclaw-tui

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by modifying the streamed thinking output to include proper whitespace and line breaks.

Guidance

  • Verify that the output is being generated correctly by checking the code responsible for streaming the thinking output.
  • Check the formatting options for the TUI and see if there are any settings that can be adjusted to include whitespace and line breaks.
  • Consider adding a post-processing step to the output to insert line breaks and whitespace as needed.
  • Review the model's output formatting to ensure it is not causing the issue.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The issue may be specific to the openclaw-tui provider or the github-copilot/gpt-5.4-mini model, and further investigation may be needed to determine the root cause.

Recommendation

Apply a workaround by modifying the output formatting to include whitespace and line breaks, as the root cause is unclear and may require further investigation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Streamed thinking is neatly formatted with proper whitespace. Lines should have a space between them so sentences don’t become unreadable.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING