Skip to content

The UI layout appears to be broken when interacting with the agent. #16859

Closed

Description

@fenggeHu

Description

The agent header text overlaps with the terminal output, causing the content to be misaligned and difficult to read.

This issue is consistently reproducible and happens every time a message is submitted.

It looks like the UI elements are rendered on top of the console output instead of being properly separated.

Plugins

oh-my-opencode

OpenCode version

1.2.*

Steps to reproduce

  1. iTerm2: opencode

2.Type any message in the input box

3.Submit the message

Screenshot and/or share link

Image

Operating System

macOS 15.7.4

Terminal

iTerm2

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 10, 2026
  2. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

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

  3. lazyalex616 commented on Mar 10, 2026

    @lazyalex616

    I looked into the source code to understand how this could happen. Here's what I found and a step-by-step way to narrow down the root cause.

    Background: How the TUI renders

    OpenCode's TUI explicitly disables stdout interception (renderer.disableStdoutInterception() in app.tsx) and does not use an alternate screen buffer. This means anything that writes to stdout outside the TUI's render cycle will paint directly over it.

    The Header component uses flexShrink={0} (fixed position), and the message area below uses flexGrow={1}. Under normal conditions this layout is stable, but if something interferes with the render cycle (extra stdout writes, or unexpected terminal state changes), the layout can break.

    This is NOT a duplicate of #11109

    #11109 is intermittent, happens without plugins, and only during long sessions with multiple tabs. Your issue is every single time on message submit — very different pattern.

    Isolation steps to find the root cause

    Try these one at a time, restarting OpenCode between each step. Stop as soon as the overlap disappears — that step identified the culprit.

    Step 1: Rule out plugins

    Remove oh-my-opencode from your config (set plugins: [] or delete the entry), restart OpenCode, and submit a few messages.

    • Overlap gone → plugin is involved, continue to Step 1b
    • Overlap still there → skip to Step 2

    Step 1b: If removing the plugin fixed it, check which version you have (oh-my-opencode --version or look in node_modules). Make sure it's ≥ 3.9.0 — older versions had a known bug where bun install output leaked into the TUI (#15357). Reinstall with latest and test again.

    Step 2: Rule out iTerm2

    With the same config (plugins removed or not, depending on Step 1), try running OpenCode in a different terminal:

    • macOS built-in Terminal.app

    • Ghostty or Kitty if you have them

    • Overlap gone in other terminal → iTerm2-specific rendering issue. Check iTerm2 settings: Preferences → Profiles → Terminal → "Terminal Emulation" section. Try toggling "Unicode version" and "Ambiguous characters" settings.

    • Overlap still there → not terminal-specific, continue to Step 3

    Step 3: Check OpenCode version

    You listed 1.2.* — can you share the exact version? (opencode --version). OpenTUI's layout engine had several fixes in recent releases. If you're not on the latest, try upgrading.

    Step 4: Collect debug info

    If none of the above resolves it, this info would help the maintainers:

    # Terminal size
    tput cols; tput lines
    
    # OpenCode exact version
    opencode --version
    
    # iTerm2 version
    # (iTerm2 menu → About)
    
    # oh-my-opencode version (if using)
    cat node_modules/oh-my-opencode/package.json | grep version
    
    # Does resizing the terminal window fix/change the overlap?
    # (Try making it wider/narrower while the overlap is visible)

    Also: does the overlap happen immediately on the first message of a fresh session, or only after a few exchanges?

  4. fenggeHu commented on Mar 10, 2026

    @fenggeHu
    Author

    I looked into the source code to understand how this could happen. Here's what I found and a step-by-step way to narrow down the root cause.

    Background: How the TUI renders

    OpenCode's TUI explicitly disables stdout interception (renderer.disableStdoutInterception() in app.tsx) and does not use an alternate screen buffer. This means anything that writes to stdout outside the TUI's render cycle will paint directly over it.

    The Header component uses flexShrink={0} (fixed position), and the message area below uses flexGrow={1}. Under normal conditions this layout is stable, but if something interferes with the render cycle (extra stdout writes, or unexpected terminal state changes), the layout can break.

    This is NOT a duplicate of #11109

    #11109 is intermittent, happens without plugins, and only during long sessions with multiple tabs. Your issue is every single time on message submit — very different pattern.

    Isolation steps to find the root cause

    Try these one at a time, restarting OpenCode between each step. Stop as soon as the overlap disappears — that step identified the culprit.

    Step 1: Rule out plugins

    Remove oh-my-opencode from your config (set plugins: [] or delete the entry), restart OpenCode, and submit a few messages.

    • Overlap gone → plugin is involved, continue to Step 1b
    • Overlap still there → skip to Step 2

    Step 1b: If removing the plugin fixed it, check which version you have (oh-my-opencode --version or look in node_modules). Make sure it's ≥ 3.9.0 — older versions had a known bug where bun install output leaked into the TUI (#15357). Reinstall with latest and test again.

    It's right here!

    From opencode/log:

    26-03-10T07:41:37 +8ms service=plugin path=oh-my-opencode loading plugin
    WARN 2026-03-10T07:41:38 +1075ms service=bun pkg=oh-my-opencode cachedVersion=3.8.5 Failed to resolve latest version, using cached
    INFO 202

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