High CPU usage #3149

Closed
opened 2026-02-16 17:38:51 -05:00 by yindo · 13 comments
Owner

Originally created by @shantur on GitHub (Nov 26, 2025).

Originally assigned to: @thdxr, @rekram1-node on GitHub.

Description

I use opencode on MacOS ( Intel ) and after sometime the CPU usage keeps increasing.
Even when session is idle, the CPU usage stays high.

My main usage is in 2 projects and I see the same behaviour in both.

  1. typescript, javascript, html app
  2. Dart / Flutter app

I don't use it anywhere else so not sure if this is related.

OpenCode version

1.0.110

Steps to reproduce

Unsure of the steps.
Just keep using opencode, switch sessions, fork sessions etc

Screenshot and/or share link

Image

Operating System

macOS 15.7.2

Terminal

iTerm2, CodeNomad

Originally created by @shantur on GitHub (Nov 26, 2025). Originally assigned to: @thdxr, @rekram1-node on GitHub. ### Description I use opencode on MacOS ( Intel ) and after sometime the CPU usage keeps increasing. Even when session is idle, the CPU usage stays high. My main usage is in 2 projects and I see the same behaviour in both. 1. typescript, javascript, html app 2. Dart / Flutter app I don't use it anywhere else so not sure if this is related. ### OpenCode version 1.0.110 ### Steps to reproduce Unsure of the steps. Just keep using opencode, switch sessions, fork sessions etc ### Screenshot and/or share link <img width="383" height="55" alt="Image" src="https://github.com/user-attachments/assets/3cac8a8c-feba-48f4-b031-7c2e6441ceb4" /> ### Operating System macOS 15.7.2 ### Terminal iTerm2, CodeNomad
yindo added the opentuibugperf labels 2026-02-16 17:38:52 -05:00
yindo closed this issue 2026-02-16 17:38:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 26, 2025):

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

  • #811: Text rendering is VERY slow (and CPU usage is really high even when idle) - Closed but reports similar high CPU usage on idle
  • #2688: Opencode freezes when pressing option + left arrow key on MacBook with high CPU usage - MacBook CPU spike issue
  • #2805: High RAM usage in latest release - Related to high resource usage
  • #3013: Uses a huge amount of memory - Memory usage keeps increasing with AI use
  • #3798: OpenTUI causes crashes and heavy memory usage - opentui related resource consumption

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 26, 2025): This issue might be a duplicate of existing issues. Please check: - #811: Text rendering is VERY slow (and CPU usage is really high even when idle) - Closed but reports similar high CPU usage on idle - #2688: Opencode freezes when pressing `option` + left arrow key on MacBook with high CPU usage - MacBook CPU spike issue - #2805: High RAM usage in latest release - Related to high resource usage - #3013: Uses a huge amount of memory - Memory usage keeps increasing with AI use - #3798: OpenTUI causes crashes and heavy memory usage - opentui related resource consumption Feel free to ignore if none of these address your specific case.
Author
Owner

@thdxr commented on GitHub (Nov 26, 2025):

do you have permissions turned on?

@thdxr commented on GitHub (Nov 26, 2025): do you have permissions turned on?
Author
Owner

@pablonification commented on GitHub (Nov 27, 2025):

happens to me too

@pablonification commented on GitHub (Nov 27, 2025): happens to me too
Author
Owner

@shantur commented on GitHub (Nov 27, 2025):

do you have permissions turned on?

No permissions aren't enabled in any of the projects

@shantur commented on GitHub (Nov 27, 2025): > do you have permissions turned on? No permissions aren't enabled in any of the projects
Author
Owner

@andre-schaerpf commented on GitHub (Dec 1, 2025):

Just observed an agent running into this very issue on accident. Reproduction steps are as follows:

  • Asked an agent to implement some feature and trigger a build / compile afterwards.
  • Agent completed the implementation and compiled successfully, which caused our build output directory to fill up (and, due to a misconfiguration on my end, this directory is not in any .gitignore file or similar)
  • Agent noticed the huge amount of new files after checking git status and decided to remove them using rm -rf.
  • After freezing for about 30s, OpenCode's "Modified Files" sidebar started listing every single deleted file that previously existed in the now deleted directory. In this state, the TUI does not react to any key presses anymore and needs to be killed.

I submitted https://github.com/sst/opencode/pull/4963 to introduce pagination for this scenario.

@andre-schaerpf commented on GitHub (Dec 1, 2025): Just observed an agent running into this very issue on accident. Reproduction steps are as follows: - Asked an agent to implement some feature and trigger a build / compile afterwards. - Agent completed the implementation and compiled successfully, which caused our build output directory to fill up (and, due to a misconfiguration on my end, this directory is not in any .gitignore file or similar) - Agent noticed the huge amount of new files after checking `git status` and decided to remove them using `rm -rf`. - After freezing for about 30s, OpenCode's "Modified Files" sidebar started listing every single deleted file that previously existed in the now deleted directory. In this state, the TUI does not react to any key presses anymore and needs to be killed. I submitted https://github.com/sst/opencode/pull/4963 to introduce pagination for this scenario.
Author
Owner

@rekram1-node commented on GitHub (Dec 1, 2025):

are you sure the issue was the sidebar rendering and not the diff checking? just curious

Did you use btop to figure that out

@rekram1-node commented on GitHub (Dec 1, 2025): are you sure the issue was the sidebar rendering and not the diff checking? just curious Did you use btop to figure that out
Author
Owner

@andre-schaerpf commented on GitHub (Dec 1, 2025):

The diff itself seems to be pretty fast - at least based on what I saw during debugging. I did not measure the timing though (also no btop).
My first approach was to change the diff panel to be collapsed by default while leaving the diff logic itself unchanged. This immediately improved performance for me; at least until I manually expanded the panel again, which then caused a freeze as expected.

@andre-schaerpf commented on GitHub (Dec 1, 2025): The diff itself seems to be pretty fast - at least based on what I saw during debugging. I did not measure the timing though (also no btop). My first approach was to change the diff panel to be collapsed by default while leaving the diff logic itself unchanged. This immediately improved performance for me; at least until I manually expanded the panel again, which then caused a freeze as expected.
Author
Owner

@rekram1-node commented on GitHub (Dec 1, 2025):

Ahh okay good to know

@rekram1-node commented on GitHub (Dec 1, 2025): Ahh okay good to know
Author
Owner

@rekram1-node commented on GitHub (Dec 1, 2025):

i'll take a look at the pr just wanted to make sure we address core issue

@rekram1-node commented on GitHub (Dec 1, 2025): i'll take a look at the pr just wanted to make sure we address core issue
Author
Owner

@paralin commented on GitHub (Dec 1, 2025):

What I'm seeing is quite a bit different. If I tab away from the agent for a long time, then tab back, it's quite laggy - sometimes typing is very slow, and if I press enter it will send the message without everything I typed in there. And then it won't show the agent replying until some time later (after a delay). Often I Ctrl c out of open code then reopen it and go to the session to see that the agent indeed was working and I had just interrupted it midway due to the UI lag. Maybe opencode is trying to update the display constantly when nothing is changing (while tabbed out) and this all gets buffered somehow lagging out future updates? Just a guess.

@paralin commented on GitHub (Dec 1, 2025): What I'm seeing is quite a bit different. If I tab away from the agent for a long time, then tab back, it's quite laggy - sometimes typing is very slow, and if I press enter it will send the message without everything I typed in there. And then it won't show the agent replying until some time later (after a delay). Often I Ctrl c out of open code then reopen it and go to the session to see that the agent indeed was working and I had just interrupted it midway due to the UI lag. Maybe opencode is trying to update the display constantly when nothing is changing (while tabbed out) and this all gets buffered somehow lagging out future updates? Just a guess.
Author
Owner

@shantur commented on GitHub (Dec 24, 2025):

This was Bun stderr bug present on macOS Sequoia

@shantur commented on GitHub (Dec 24, 2025): This was Bun stderr bug present on macOS Sequoia
Author
Owner

@LeoMassie commented on GitHub (Jan 20, 2026):

This is still an issue for me on linux.

@LeoMassie commented on GitHub (Jan 20, 2026): This is still an issue for me on linux.
Author
Owner

@manascb1344 commented on GitHub (Jan 30, 2026):

Yes, dont know why on linux its unusually HIGH!!

@manascb1344 commented on GitHub (Jan 30, 2026): Yes, dont know why on linux its unusually HIGH!!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3149