Skip to content

tui: background subagent load freezes tab switching and text input #43891

Closed as not planned

Description

@pascalandr

Summary

Running many background subagents in one TUI tab systematically makes the entire TUI sluggish until the subagent load decreases. Switching tabs becomes slow and text input or draft editing can temporarily freeze.

Environment

  • opencode version: 0.0.0-beta-17793
  • OS: Microsoft Windows 10.0.26200.9168 (win32 x64)
  • Terminal: Unavailable: terminal environment variables are not set
  • Shell: C:\WINDOWS\system32\cmd.exe (diagnostics executed with PowerShell 7.6.5)
  • Install/channel: beta, installed as opencode2
  • Active plugins: aftereffects.ts, blender.ts, m365.ts, resolve.ts, unreal.ts, ponytail-v2.mjs, opencode-gemini-auth@latest, opencode-ponytail

Reproduction

  1. Start one opencode2 TUI connected to the default shared background service.
  2. Open multiple virtual tabs in that TUI, each showing a different session or workspace.
  3. In one tab's primary session, launch about eight independent background subagents.
  4. While those subagents are running, switch between tabs and type or edit a draft.
  5. Observe delayed tab changes, sluggish input, and temporary UI freezes.
  6. Wait for the subagent load to decrease; TUI interactivity returns to normal.

Expected Behavior

Background work in one session should not make TUI navigation or text editing unresponsive. Tab changes and draft input should remain interactive under subagent load.

Actual Behavior

The whole TUI becomes very sluggish while the subagents are active. Switching to another virtual tab is delayed, and typing or editing a draft can freeze temporarily. Interactivity returns after the load decreases. This reproduces systematically with comparable load, while the service remains healthy according to /api/health.

Additional Context

  • Shared service URL during the latest observation: http://127.0.0.1:49374
  • Shared service PID: 29336
  • CPU: Intel Core i9-14900KF, 24 cores / 32 logical processors
  • During one observation, the Bun server used about 3.4% total-machine CPU (roughly 1.1 logical processors), while its working set grew from about 3.36 GiB to 4.24 GiB.
  • The problem occurs inside one TUI process with multiple virtual tabs; no additional terminal or TUI client is involved.
  • It has not been determined whether background session execution also slows; the directly observed symptom is degraded TUI input and navigation.
  • Reducing concurrent subagent load avoids the UI stalls.

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

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

  2. pascalandr commented on Aug 21, 2026

    @pascalandr
    Author

    Clarification regarding the possible duplicate #42657:

    This V2 report has a different runtime and CPU signature.

    • TUI lag with multi-subagent sessions (97% CPU on render thread) #42657 reports OpenCode V1 (1.18.18) with the TUI render thread near 97% CPU, and a follow-up reports 87-100% total CPU across 3-4 OpenCode processes. After restarting with one process, that reporter saw no input lag and peaks below 17%.
    • This issue reproduces on OpenCode V2 beta 0.0.0-beta-17793 inside one TUI process with multiple internal virtual tabs. The lag is present while total machine CPU remains around 14%; the shared server was observed around 3.4% of a 32-logical-processor machine. The service remains healthy.

    The V2 topology also differs from launching multiple OpenCode processes:

    • Internal TUI tabs are views over sessions/workspaces, not separate OS processes.
    • In default mode, the TUI connects to one managed background server (server connection).
    • Session execution is explicitly process-local (session execution).
    • Subagents are child sessions registered in the process-local Job service, not worker processes (subagent, job).

    No worker pool, per-session process placement, or setting that isolates internal TUI tabs was found in this beta. --standalone creates one private server for an entire TUI invocation; it does not isolate individual tabs while retaining one TUI.

    The directly observed bug remains TUI input/navigation stalls under subagent load. The process-local topology may or may not be the root cause, but it means the V1 multi-process CPU-saturation report should not be assumed to explain this V2 behavior.

  3. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions