fix-pty-output

Fix PTY output doubling in wg TUI: lines render twice in pane

Metadata

Statusdone
Assignedagent-904
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-04-28T01:44:01.439620585+00:00
Started2026-04-28T01:44:21.260307226+00:00
Completed2026-04-28T02:16:04.815750851+00:00
Tagseval-scheduled
Eval score0.74
└ blocking impact0.75
└ completeness0.72
└ constraint fidelity0.85
└ coordination overhead0.70
└ correctness0.75
└ downstream usability0.74
└ efficiency0.78
└ intent fidelity0.65
└ style adherence0.76

Description

Description

The wg TUI's PTY-rendering pane is duplicating output. The user pasted a screenshot of one pane that shows the same multi-line block printed twice — a list of three review-session tasks (stocktake-assets / content-review-poietic-life / wg-visual-language-study) followed by the identical block again, all inside a single bordered box.

User quote: 'this shows a bug where the pty output gets doubled. seems pretty annoying lol'

This is a display / rendering bug, not a state corruption bug — the underlying chat/log data is fine, only the on-screen rendering is wrong. Likely something in:

  • the PTY scrollback buffer / line wrapping logic
  • redraw-on-resize re-printing already-printed lines
  • terminal capability mismatch (CRLF / cursor-up handling)
  • ratatui Paragraph wrapping interacting badly with embedded ANSI

The worker should reproduce first (find a chat / log view that consistently doubles), then narrow to the specific pane / view widget, then fix.

Repro hints

  • The doubled content appears in a bordered Tui box, multi-line, looks like an active chat-agent transcript or a streamed paste from a session
  • Probably reproducible by pasting a long block into a chat input or by streaming chat-agent output at a width where wrapping kicks in
  • Check both the chat detail view and the log raw view since they share the same underlying renderer paths

Out of scope

  • No restyling of the panes (per the user's earlier feedback the log raw view is 'amazing as it currently is')
  • Don't change colors, borders, layout — just stop the duplication

Validation

  • Reproduce: identify the exact view + content shape that triggers doubling, document the steps
  • Failing test first: a unit/integration test that renders the offending content into a fixed-width buffer and asserts the rendered cells contain each input line exactly once
  • Implementation makes the test pass
  • Manual smoke: paste/stream the kind of content the user showed (a multi-line list, ~10 lines) into the same view and verify single-render
  • Verify on at least two terminal widths (narrow enough to wrap, wide enough not to) — bug shouldn't be width-dependent
  • No regressions in chat detail view, log raw view, or any other PTY-driven pane
  • cargo build + cargo test pass

Depends on

Required by

Log