tui-log-view-3

TUI Log view: response text not word-wrapping; long lines truncated/lost

Metadata

Statusdone
Assignedagent-696
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-04-27T15:05:27.982474953+00:00
Started2026-04-27T15:06:20.749557934+00:00
Completed2026-04-27T15:32:37.057538563+00:00
Tagseval-scheduled

Description

Description

User reports: 'the last response in the log isn't word wrapping? so we seem to be missing a lot of text. really the whole thing isn't word wrapping.'

The Log view (4:Log) renders agent responses but long lines are being truncated/cut off rather than wrapped to fit the pane width. Result: user can't see the full content of any non-trivial response.

Required

Render multi-line responses with proper word-wrapping to the pane width. Standard ratatui pattern: Paragraph::new(text).wrap(Wrap { trim: false }).

Apply to:

  • Agent response messages (claude / nex output)
  • Tool-result blocks (especially Bash output)
  • Any other long-text rendering in the Log pane

Preserve continuation-line alignment (per the related response-first-line-shift task: continuation lines hang under first character of text, not column 0).

Hard gate

Open wg tui in a chat with a long agent response (>120 chars / multi-paragraph). Visually confirm:

  • Text wraps to pane width
  • No content lost off-screen
  • Continuation lines align under first char of original line (not naked left margin)
  • Resize the pane → text re-wraps correctly

Files likely to touch

  • src/tui/viz_viewer/render.rs (response rendering — find Paragraph builders that lack .wrap())
  • Maybe state.rs if there's pre-formatting that pre-truncates

Validation

  • Failing test first: test_log_view_wraps_long_response — synthetic 500-char response in a 80-col pane → all chars present in render output across multiple wrapped lines
  • Implementation makes test pass
  • cargo build + cargo test pass with no regressions
  • HARD GATE manual smoke as above

Depends on

Required by

Messages 3 messages (3 unread)

  1. #1user2026-04-27T15:27:15.334930751+00:00read
    Additional observation from the user: when the bug fires, text doesn't just clip at the right edge — it ENDS mid-content with no continuation at all. Concrete example user pasted:
    
        ```
        **`scripts/smoke/wave-1-smoke.sh`** — 5-scenario assertion-driven smoke test:
        ```
    
    That's the literal last line rendered — no following bullet list, no rest of the response. Note it terminates right after a backtick-delimited inline code span and a colon, where the next line in the real response was a markdown bullet.
    
    Hypothesis worth checking alongside plain Wrap-missing: the renderer may be (a) stopping at the first line that exceeds pane height rather than scrolling, (b) choking on inline-code span boundaries when the span pushes past the right edge, or (c) consuming/dropping content when a styled span would wrap. So when you write the failing test for word-wrapping, also add a case with inline-code spans (`foo`) and a case where a single span itself exceeds the pane width — confirm both render fully across multiple wrapped lines without losing trailing content.
  2. #2tui-log-view-32026-04-27T15:27:51.843272987+00:00read
    Acknowledged — matches what my failing test caught (logical-vs-visual scroll mismatch + auto_tail miscounting). Adding two more test cases now: (1) inline-code spans must wrap without losing content, (2) a single span longer than pane width must wrap to multiple visual lines, all chars present. Will validate that wrap_line_spans handles both correctly.
  3. #3tui-log-view-32026-04-27T15:32:29.931324670+00:00sent
    Done — committed 8a0051ba8 + pushed. Added 4 tests that all pass: (1) 500-char single-line wraps fully, (2) auto_tail pins last wrapped visual line in small viewport (catches the bug), (3) inline-code multi-span wrapping preserves trailing content, (4) 200-char unbroken token hard-breaks with head+tail markers both present. Root cause: scroll math used logical line count but ratatui wrap produced visual lines, pushing tail off-screen. Fix: pre-wrap raw lines via wrap_line_spans(body_width) before Paragraph::new, dropped .wrap() to avoid double-wrap mismatch.

Log