Skip to content

Severe scroll lag in VSCode/Cursor integrated terminal on WSL2 after large output (unusable for minutes) #7893

Closed

Description

@git-qiaozq

Description

OpenCode becomes completely unusable in VSCode/Cursor integrated terminal on WSL2 after outputting a moderate amount of content. Scrolling freezes for tens of seconds to several minutes, making the application practically unusable. However, running the same OpenCode version in Windows Terminal + WSL works perfectly.

Environment

Component Version
OpenCode 1.1.13
OS Windows 11
WSL 2.6.3
WSL Distro Ubuntu 24.04.2 LTS
Cursor 2.3.34 (VSCode 1.105.1)
VSCode 1.105.1 (same issue)
Windows Terminal Works normally

Steps to Reproduce

  1. Open Cursor or VSCode on Windows 11
  2. Connect to WSL2 environment
  3. Run opencode in the integrated terminal
  4. Ask a question that generates a long response
  5. Try to scroll up/down during or after the output
  6. Observe: scrolling becomes extremely laggy (tens of seconds to minutes of delay)

Additional reproduction path:

  1. Use /session to restore a previous session
  2. Scroll up and down a few times quickly
  3. Observe: after a few scroll operations, the lag appears

Expected Behavior

Scrolling should be smooth and responsive, similar to the experience in Windows Terminal.

Actual Behavior

Scenario Behavior
During LLM streaming Almost impossible to scroll, UI freezes
After output completes Scroll lag of 10-60+ seconds
After restoring session via /session Initially OK, then severe lag after a few scroll operations
In Windows Terminal + WSL ✅ Works perfectly, no lag

Key Observation

The same OpenCode version (1.1.13) works perfectly when running through:

  • PowerShell → wsl → opencode
  • Windows Terminal → WSL → opencode

This strongly suggests the issue is specific to xterm.js-based integrated terminals (VSCode/Cursor) combined with OpenTUI's rendering on WSL2.

Likely Related Issues

Issue Relevance
#5361 WSL2 TUI freeze regression (v1.0.129+) - similar root cause
#6172 O(n) text buffer rendering causing high CPU - explains why large output triggers lag
#7316 Mouse wheel stops working on Windows Terminal - possibly related input handling issue
#5168 SIGPWR signal storm in WSL2 - another WSL2-specific issue

Potentially Related PRs

These PRs appear to address the underlying performance issues:

Workaround

Currently using Windows Terminal + WSL as a workaround, which works normally.

Additional Context

This issue makes OpenCode essentially unusable for daily development in Cursor/VSCode on WSL2, which is a very common development environment. The fact that Windows Terminal works fine suggests this is fixable with rendering optimizations for xterm.js-based terminals.

Would be happy to provide additional diagnostic information (strace, performance profiles, etc.) if needed.

OpenCode version

1.1.13

Operating System

Windows 11 + WSL2 2.6.3 + Ubuntu 24.04.2 LTS

Terminal

Cursor 2.3.34 / VSCode 1.105.1 integrated terminal (both affected)

Activity

  1. github-actions commented on Jan 12, 2026

    @github-actions
    Contributor

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

    The issue specifically mentions xterm.js-based terminals (VSCode/Cursor integrated terminal) vs Windows Terminal working fine. This strongly suggests the root cause is OpenTUI's rendering pipeline not being optimized for xterm.js.

    Feel free to ignore if your specific case differs from these issues.

  2. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    perfIndicates a performance issue or need for optimization
    on Jan 12, 2026
  3. git-qiaozq commented on Jan 12, 2026

    @git-qiaozq
    Author

    Update: Tested with v1.0.128 - Issue Still Exists

    I downgraded to OpenCode v1.0.128 (the version before the WSL2 freeze regression in #5361), but the scroll lag issue persists.

    This confirms that:

    1. This issue is NOT the same as TUI freezes for ~10 seconds periodically on WSL2 (regression in v1.0.129) #5361 (WSL2 TUI freeze regression in v1.0.129+)
    2. The scroll lag in xterm.js-based terminals (VSCode/Cursor) is a separate, longer-standing issue
    3. The root cause is likely the O(n) rendering complexity mentioned in High CPU usage (100%+) during LLM streaming in long sessions due to O(n) text buffer rendering #6172, which affects xterm.js terminals more severely than native terminals like Windows Terminal

    Test Results

    Version Scroll Lag in Cursor/VSCode Scroll in Windows Terminal
    1.1.13 ❌ Severe lag (unusable) ✅ Normal
    1.0.128 ❌ Severe lag (still exists) ✅ Normal

    This suggests the performance issue with xterm.js-based integrated terminals has existed for a while and is independent of the v1.0.129 opentui update.

  4. hieudtr8 commented on Jan 21, 2026

    @hieudtr8

    Got same issues on Windows 10 with Cursor/Vscode IDE

  5. github-actions commented on Mar 28, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentuiperfIndicates a performance issue or need for optimizationwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions