Skip to content

Screen flickering/vibrating on diff views in v1.0.120, causes PTY host crash #4905

Closed

Description

@wthrbtn

Description

Screen flickering/vibrating when viewing file diffs in v1.0.120. The display constantly repaints causing a "vibrating" visual effect on diff views (Edit tool output).

This occurs after prolonged use of a session, not immediately. After the flickering starts, it leads to:

  • All OpenCode terminal windows in VSCode becoming unresponsive
  • Yellow PTY host error: "Restarting the terminal because the connection to the shell process was lost"

Regression: Issue does not occur in v1.0.119. Rolling back to v1.0.119 resolves the problem.

Likely cause: Commit 52deb7f35 ("opentui diffs") which:

  1. Upgrades @opentui/core from 0.1.50 to 0.1.51
  2. Replaces custom diff rendering with new native <diff> component

v1.0.120 (broken)
v1.0.119 (works)

OpenCode version

1.0.120

Steps to reproduce

  1. Run OpenCode v1.0.120 in VSCode terminal
  2. Use for an extended session with multiple edits/diffs
  3. Eventually screen starts flickering/vibrating on diff output
  4. Terminal hangs and PTY host error appears

Screenshot and/or share link

I have tried to reproduce this on demand but cannot - will add a screen recording if possible when it occurs again.

Operating System

macOS 26.1 (Tahoe)

Terminal

VSCode integrated terminal zsh

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 29, 2025
  2. github-actions commented on Nov 29, 2025

    @github-actions
    Contributor

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

    While these issues may have different root causes, they all involve rendering performance degradation and CPU spikes after recent version updates. The flickering/vibrating behavior you're experiencing might be a visual manifestation of the same underlying rendering performance problem.

    Feel free to ignore if your specific case with diff views and PTY crashes is distinctly different from these general performance issues.

  3. kommander commented on Nov 29, 2025

    @kommander
    Contributor

    I have a vague idea where that could come from, but a screen recording of the kind of flickering would be really helpful.

    Can you reproduce it when loading a large session and continuing maybe?

    If you get it reproduced it would be really helpful if you could run it with OTUI_DEBUG_FFI=true, which creates a log in the cwd.

  4. wthrbtn commented on Nov 30, 2025

    @wthrbtn
    Author

    https://github.com/user-attachments/assets/a5266f61-81d2-445b-9008-28609dc97079
    @kommander
    I have a screen recording of a few seconds now on 1.0.121
    The sessions is locked up flicker and after about 10 minutes it stopped and the Pty Host error came
    Sorry, forgot the OTUI_DEBUG_FFI on this. Will try again.

  5. redtux commented on Nov 30, 2025

    @redtux

    Haha, I was also recording this now, and after the record it looked even worse. 🤣 (Fresh session; no -c here...)

    Image
  6. wthrbtn commented on Nov 30, 2025

    @wthrbtn
    Author

    started and resumed the session with OTUI_DEBUG_FFI=true and then scrolled up and it triggered on a side by side diff and got stuck - 218 MB - 3,355,681 lines - in a few seconds. Wow 😅

    ffi_otui_debug_2025-11-30_00-31-20-773.log.gz

  7. wthrbtn commented on Nov 30, 2025

    @wthrbtn
    Author

    I converted the captured video (1.0.121) to a gif also.

    • Note: the real flickering is much faster
    • It also occurs on 1.0.122

    Image

  8. tancou commented on Nov 30, 2025

    @tancou

    Hi,
    I also noticed this issue. In my case, it occurs when the terminal window is wide enough for the chat to display a side-by-side “+ / –” comparison between two files. If the window isn’t wide enough, the two columns don’t appear — only a single modification view is shown — and in that situation, the flickering does not happen.

    I was able to reproduce the problem every time a before/after file comparison was displayed.

  9. redtux commented on Nov 30, 2025

    @redtux

    Hi,
    I also noticed this issue. In my case, it occurs when the terminal window is wide enough for the chat to display a side-by-side “+ / –” comparison between two files. If the window isn’t wide enough, the two columns don’t appear — only a single modification view is shown — and in that situation, the flickering does not happen.

    I was able to reproduce the problem every time a before/after file comparison was displayed.

    In my case it doesn't happen with every diff. It seems to happen to me with every markdown diff (side-by-side), but the same agent called a subagent using many Typescript diffs, and there I didn't experience the issue. I also use zsh, in case this helps. I had the issue on two different machines (with Ubuntu and Debian Sid)...

  10. rwese commented on Nov 30, 2025

    @rwese
    Contributor

    Can it be the sidebar messing with the width calculation, causing wrapping when the rendering is done, it's starting to flip/flop.

    Screen Recording 2025-11-30 at 20.01.11.zip

  11. redtux commented on Dec 1, 2025

    @redtux

    Can it be the sidebar messing with the width calculation, causing wrapping when the rendering is done, it's starting to flip/flop.

    Screen Recording 2025-11-30 at 20.01.11.zip

    I also have it with subagents where there is no sidebar on the right side. But I don't see this all the time, only with certain text. 🤷

  12. kommander commented on Dec 1, 2025

    @kommander
    Contributor

    Should be better in 1.0.123

  13. redtux commented on Dec 1, 2025

    @redtux

    Should be better in 1.0.123

    Cool! Was the bug introduced by this change? anomalyco/opentui#358
    Can you explain what this does? (The PR contains no information and I found no issue.) What is Claude Code's flicker feature? And why does this only affect markdown files? (And why only sometimes, and why does it not always crash when this happens?) Thanks!

  14. kommander commented on Dec 1, 2025

    @kommander
    Contributor

    can you explain...

    Well, yes the bug was introduced with the diffs, the diff view just didn't exist before that. That PR introduces the diff view.

    The "cc flicker feature" is just a pun on the Claude Code flickering memes.

    It did not only affect markdown files, it would affect all code with conceal highlights, where it removes for example markdown like **/__ etc. which changes the line width and therefor the wrapping, which in turn changes the height of the element, which triggers a layout pass, which makes the diff view rebuild, which sets the text again and causes another highlight pass... repeat indefinitely.

    It only happened sometimes, because the width of the diff + text + highlights have to meet the conditions causing the concealed text to change height and trigger the layout pass + highlighting has to be slow enough to trigger another layout pass just after the last one.

    The loop caused thousands of frame redraws per second, which overwhelmed the CPU and caused memory pressure - crash.

    It did not always crash, because when the renderer is in live mode, running at a target frame rate, which opencode does when the loading indicator in the bottom left is running for example, frame requests that would be triggered by the endless loop would just be deferred to the next scheduled frame, mitigating the crash. Then when the diff goes out of view it is not rendered anymore, breaking the endless loop.

  15. redtux commented on Dec 1, 2025

    @redtux

    Thanks for the explanation! Regarding "infinite loop", I have sessions where it could proceed without issues. When I scroll up, it flickers. When I stay there, it crashes. I liked the diff, and from time to time I also liked the party flickering mode. 🪩🕺📀

    Edit: While I can confirm that this has been fixed (at least for me), I never experienced the exact same behavior as @wthrbtn.

    Yellow PTY host error: "Restarting the terminal because the connection to the shell process was lost"

    In my case the agent just froze or became unresponsive, but I always had to manually kill it then - which resulted in a bunch of numbers in the terminal at every hover or mouse-over (so I had to close the terminal window to totally kill the PTY process...).

  16. redtux commented on Dec 4, 2025

    @redtux

    Hi, shouldn't this be closed as solved?

  17. rekram1-node commented on Dec 4, 2025

    @rekram1-node
    Contributor

    closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions