opencode icon indicating copy to clipboard operation
opencode copied to clipboard

TUI Renders Truncated LLM Response Despite Full Output in Log File

Open taqtiqa-mark opened this issue 1 month ago • 10 comments

Description

Environment

  • OpenCode version: v1.0.128
  • Operating System: Linux (Debian Testing)
  • Installation: Containerized setup via curl script
  • Mode: TUI (no serve-attach)

Steps to Reproduce

  1. Launch OpenCode in TUI mode.
  2. Submit a prompt to the LLM that elicits a detailed response, such as one involving script analysis (e.g., identifying issues in a shell script like vault0.sh).
  3. Examine the response displayed in the TUI interface.
  4. Review the associated log file for the complete session output.

Expected Behavior

The TUI interface should present the entirety of the LLM-generated response, aligning precisely with the content captured in the log file's session summary.

Actual Behavior

The TUI interface exhibits a truncated response, terminating prematurely (e.g., concluding at "prints the usage message when" rather than extending to the full content). In contrast, the log file preserves the complete response. The screenshot provided illustrates this truncation in the TUI, while the full log transcript below confirms the presence of the unabridged output:

INFO 2025-12-03T02:45:00 +0ms service=bus type=session.status publishing
INFO 2025-12-03T02:45:00 +1ms service=session.prompt step=2 sessionID=ses_51e0cfecfffe7hCucYDcjdh1m3 loop
INFO 2025-12-03T02:45:00 +11ms service=bus type=message.updated publishing
INFO 2025-12-03T02:45:00 +1ms service=session.summary body=Root cause: In vault0.sh, the `stop` function unnecessarily prints a usage message when given the valid argument "vault0" (lines 184-187), even though it proceeds to handle the stop operation. This is likely a copy-paste error, as a similar (but incorrect) printf exists in the `start` function.
Proposed prompt to fix: "In vault0.sh, edit the stop function to remove the unnecessary printf that prints the usage message when the argument is 'vault0'." body
INFO 2025-12-03T02:45:00 +0ms service=bus type=message.updated publishing
INFO 2025-12-03T02:45:00 +1ms service=bus type=session.updated publishing
INFO 2025-12-03T02:45:00 +0ms service=bus type=session.diff publishing
INFO 2025-12-03T02:45:00 +1ms service=session.prompt sessionID=ses_51e0cfecfffe7hCucYDcjdh1m3 exiting loop
INFO 2025-12-03T02:45:00 +0ms service=session.compaction pruning
INFO 2025-12-03T02:45:00 +12ms service=session.prompt sessionID=ses_51e0cfecfffe7hCucYDcjdh1m3 cancel
INFO 2025-12-03T02:45:00 +1ms service=bus type=session.status publishing
INFO 2025-12-03T02:45:00 +0ms service=bus type=session.idle publishing
INFO 2025-12-03T02:45:00 +5ms service=session.compaction pruned=0 total=0 found

Impact

This discrepancy compromises the reliability of the TUI for interactive sessions, compelling users to consult log files for complete information, which disrupts efficient workflows and diminishes the tool's usability.

Suggested Resolution

Examine the TUI rendering mechanism to guarantee comprehensive display of LLM responses, potentially by enhancing buffer management or synchronization with log outputs.

OpenCode version

v1.0.128

Steps to reproduce

As above

Screenshot and/or share link

Image

Operating System

Linux (Debian Testing)

Terminal

Alacritty+Zellij

taqtiqa-mark avatar Dec 03 '25 02:12 taqtiqa-mark

This issue might be a duplicate of existing issues. Please check:

  • #4990: Output from agent is frequently hidden (describes similar truncation/hiding of LLM responses)
  • #4239: TUI hangs when shell outputs massive log (related to TUI rendering with large output)
  • #1864: tui rendering artifacting (general TUI rendering issues)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 03 '25 02:12 github-actions[bot]

This is NOT:

  • #4990, there the issue is observed after the TUI has been left dormant for some time. Here there is no delay in usage.
  • #4239, here the log out put is trivial.
  • #1864, here there are no display artifacts. The text in the log is not displayed.

taqtiqa-mark avatar Dec 03 '25 03:12 taqtiqa-mark

As a possible workaround to show truncated output you can switch sessions back and forth. But yeah, it's very annoying to not see the last sentence

fpv-dev avatar Dec 03 '25 06:12 fpv-dev

I've noticed this too recently, not quite sure when it started happening.

ariane-emory avatar Dec 03 '25 17:12 ariane-emory

I've also been seeing this sort of truncating lately. Last few words or half way through the last sentence.

Thank you @fpv-dev for the session switch tip. that works, and after switching back I see the full message.

grahamcropley avatar Dec 15 '25 18:12 grahamcropley

I have also continued to observe this behaviour occasionally.

ariane-emory avatar Dec 15 '25 18:12 ariane-emory

I have similar issues on macOS in iTerm2 using Claude Sonnet/Opus 4.5. Just thought I'd add some data points.

thedaneeffect avatar Dec 18 '25 15:12 thedaneeffect