Repository navigation
fix(tui): keep a space where the model wrapped a line - #415
Merged
Merged
Conversation
Prose came out as "approval gate.Shell execution was denied" — the two sentences fused at the newline the model happened to wrap on. `Event::SoftBreak` was dropped on the floor. That was harmless while wrapping put a space between every token unconditionally, but the inline-code fix made adjacent spans with no whitespace between them glue deliberately, so `foo`. keeps its full stop. A dropped soft break looks exactly like that case, and models wrap prose at arbitrary columns, so this fired constantly. Emit the break as a space and let the tokenizer see the boundary it actually had. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
mohitranka
added a commit
that referenced
this pull request
Aug 21, 2026
Prose came out as "approval gate.Shell execution was denied" — the two sentences fused at the newline the model happened to wrap on. `Event::SoftBreak` was dropped on the floor. That was harmless while wrapping put a space between every token unconditionally, but the inline-code fix made adjacent spans with no whitespace between them glue deliberately, so `foo`. keeps its full stop. A dropped soft break looks exactly like that case, and models wrap prose at arbitrary columns, so this fired constantly. Emit the break as a space and let the tokenizer see the boundary it actually had. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
Prose came out as "approval gate.Shell execution was denied" — the two sentences fused at the newline the model happened to wrap on. `Event::SoftBreak` was dropped on the floor. That was harmless while wrapping put a space between every token unconditionally, but the inline-code fix made adjacent spans with no whitespace between them glue deliberately, so `foo`. keeps its full stop. A dropped soft break looks exactly like that case, and models wrap prose at arbitrary columns, so this fired constantly. Emit the break as a space and let the tokenizer see the boundary it actually had. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
Prose came out as "approval gate.Shell execution was denied" — the two sentences fused at the newline the model happened to wrap on. `Event::SoftBreak` was dropped on the floor. That was harmless while wrapping put a space between every token unconditionally, but the inline-code fix made adjacent spans with no whitespace between them glue deliberately, so `foo`. keeps its full stop. A dropped soft break looks exactly like that case, and models wrap prose at arbitrary columns, so this fired constantly. Emit the break as a space and let the tokenizer see the boundary it actually had. Claude-Session: https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p
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.
Prose rendered as
approval gate.Shell execution was denied— two sentences fused at the newline the model happened to wrap on.The bug
Event::SoftBreak => {}(markdown.rs:307) discarded soft breaks entirely.That was harmless while wrapping put a space between every token unconditionally. But the inline-code fix made adjacent spans with no whitespace between them glue deliberately, so
`foo`.keeps its full stop. A dropped soft break is indistinguishable from that case: the span before ends without whitespace, the span after starts without whitespace, so the tokenizer glues them.Models wrap prose at arbitrary columns, so this fired on ordinary answers constantly.
The fix
Emit the break as a space, so the tokenizer sees the word boundary the source actually had.
Verification
Two tests:
a_soft_break_keeps_the_words_apartcovers the break,inline_code_still_keeps_its_trailing_punctuationpins that the gluing this depends on is not regressed. Reverting the single line makes the first fail and the second pass.Found while driving the approval flow in a real tmux PTY for #414 — the denial message on screen is where the fused text showed up.
cargo fmt --all -- --checkclean,cargo clippy --all-targetsclean,forge-tuigreen at 922 tests.https://claude.ai/code/session_01XBsriDsqoNQsMD1dgacF5p