Skip to content

cli: 100% CPU on one core while a shell tool command runs #51926

Open

Description

@Mnham

Summary

On Windows 11, opencode-cli.exe (OpenCode Desktop 2.0.18) pins ~100% of one CPU core for the entire time a shell tool command is running — even when the command only sleeps and produces no output. Memory use is ~0.7 GB. The sleeping child process itself uses ~0% CPU.

Environment

  • opencode version: 2.0.18 (opencode-cli.exe --version → opencode v2.0.18; desktop-bundled CLI, not on PATH)
  • OS: Microsoft Windows [Version 10.0.26200.9457] (Windows 11)
  • Terminal: OpenCode Desktop app (Electron); TERM=xterm-256color, TERM_PROGRAM and COLORTERM unset
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: OpenCode Desktop release, latest (updater reports "Update for version 2.0.18 is not available"); CLI at %APPDATA%\ai.opencode.desktop\cli\2.0.18\opencode-cli.exe
  • Active plugins: none found (checked opencode.json/opencode.jsonc in the workspace and ~/.config/opencode/, plus plugin/plugins directories). MCP servers are configured in ~/.config/opencode/opencode.jsonc, all with "disabled": true

Reproduction

  1. On Windows 11, run OpenCode Desktop 2.0.18 and use a session for a while (in my case ~3.5 h of history with many tool calls).
  2. Have the agent run a shell command that takes a while without output, e.g. powershell -NoProfile -Command "Start-Sleep -Seconds 60".
  3. While the command runs, watch opencode-cli.exe CPU in Process Explorer / Task Manager.

Expected Behavior

The CLI process should be near-idle while waiting for the child process. Only the child command should consume resources (it used ~0%).

Actual Behavior

opencode-cli.exe consumes ~100% of one CPU core for the whole duration of the command:

  • foreground command, 20 s window: 20.16 s of CPU time in 20 s wall clock (100.8% of one core);
  • background command, 60 s window, sampled every 5 s (% of one core): 101.2, 98.1, 101.2, 99.7, 99.1, 99.7, 99.4, 99.4, 99.7, 100, 101.6, 100 — average 99.9%;
  • process memory: Private Bytes ~765 MB, Working Set ~440 MB (CLI process alone).

During one measured 60 s window the CLI wrote no log lines and spawned no subprocesses (~/.local/share/opencode/log/opencode.log), so the busy loop is silent.

Additional Context

Image

Activity

  1. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

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

    • #51852: Similar silent, roughly one-core CPU usage in the CLI service; that report occurs intermittently while idle on Linux and notes watcher churn.
    • #42306: Similar ~100% CPU usage in the CLI/TUI without useful output, attributed there to repeated spinner rendering.
    • #42557: Similar high CPU in a large workspace, attributed there to the file-watcher/git-status loop.
  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed measurements! I tried this on Linux with the 2.0.18 CLI and a simulated model, running a real silent sleep 40 through the shell tool. There the OpenCode server used about 2% of a core and the TUI about 6% (mostly the spinner) while the command ran. I couldn't get the ~100% busy loop you measured.

    Your setup differs from what I can test here in several ways: Windows 11, the CLI bundled with OpenCode Desktop, cmd.exe as the shell, a long session and a large workspace. Windows has its own code for waiting on processes, so this needs a maintainer with Windows and the Desktop app to check.

    If you have time, these would help narrow it down:

    • Does it still happen after restarting the app, in a fresh short session?
    • Does it happen in a small or empty folder instead of the workspace with the large .venv?

    Related issues (none of them looks like the same problem):

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions