[PR #13901] feat(web): fix(web): - Add FPS configuration for terminal to stop busy cycling (Issue #13899) #14862

Open
opened 2026-02-16 18:19:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13901

State: open
Merged: No


What does this PR do?

This PR fixes #13899 and fixes #13817

When the terminal is loaded in the opencode web interface, my CPU cycles 100%. I traced this down to the terminal constantly requesting another animation frame. My monitor is 240hz so this used up an entire core forcing my computer into a higher power state.

This PR adds a new configurable setting via the web ux, to limit the max FPS of the terminal. I've set it to a default of 15 fps which uses negligible CPU. Setting it 0 uses the maximum frame rate. Anything else and it targets that frame rate.

I've added e2e tests to verify the settings are saved and applied to multiple terminals correctly.

Here is a screen shot of that UX:

image

Details of my analysis are in the original issue linked above.

Testing

  1. Goto a fresh opencode web instance without a terminal. Examine CPU usage in the terminal or use the chrome profiler.
  2. Open up the terminal. It should now be 15fps by default, and CPU usage should be minimal.
  3. Type in the terminal make sure it doesn't look lagy
  4. Open the settings and put it to 1fps, notice the terminal is laggy
  5. Change the fps to 240 (or 0) on a machine that can support that refresh rate and watch the CPU usage spike to 100%

How did you verify your code works?

I ran the testing described above, and added tests.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13901 **State:** open **Merged:** No --- ### What does this PR do? This PR fixes #13899 and fixes #13817 When the terminal is loaded in the opencode web interface, my CPU cycles 100%. I traced this down to the terminal constantly requesting another animation frame. My monitor is 240hz so this used up an entire core forcing my computer into a higher power state. This PR adds a new configurable setting via the web ux, to limit the max FPS of the terminal. I've set it to a default of 15 fps which uses negligible CPU. Setting it 0 uses the maximum frame rate. Anything else and it targets that frame rate. I've added e2e tests to verify the settings are saved and applied to multiple terminals correctly. Here is a screen shot of that UX: <img width="3839" height="2159" alt="image" src="https://github.com/user-attachments/assets/d3a40f39-d214-4a95-93dd-258e0ce65d5d" /> Details of my analysis are in the original issue linked above. ### Testing 1. Goto a fresh opencode web instance without a terminal. Examine CPU usage in the terminal or use the chrome profiler. 2. Open up the terminal. It should now be 15fps by default, and CPU usage should be minimal. 3. Type in the terminal make sure it doesn't look lagy 4. Open the settings and put it to 1fps, notice the terminal is laggy 5. Change the fps to 240 (or 0) on a machine that can support that refresh rate and watch the CPU usage spike to 100% ### How did you verify your code works? I ran the testing described above, and added tests.
yindo added the pull-request label 2026-02-16 18:19:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14862