[PR #13814] feat(tui): add OPENCODE_EXPERIMENTAL_FPS for RDP/remote session performance #14821

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

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

State: open
Merged: No


Fixes: #13817

What does this PR do?

When working on powerful remote machine over RDP (XRDP) I could see that it become laggy and xrdp consumes CPU. After some back and forth, I've assumed it may be to high refresh rate and it seems to be so - once I've set rps to 5, xrdp CPU consumption became much lower.

As well, when working over ssh - which is quite standard thing too, having high FPS doesn't make much sense, i.e. over 250-300 ms link, what kind of RPS you may expect :)

How did you verify your code works?

I've build local package, enabled debug information ( Ctrl+P -> Toggle Debug ) , watched FPS is limited while producing some output. In the other terminal, I was watching top for xrdp.

Tests seems to pass too.

Detailed Description

OpenCode TUI runs at 60 FPS by default, which can cause performance issues when used over RDP (Remote Desktop Protocol). This change allows users to reduce the FPS via the OPENCODE_EXPERIMENTAL_FPS environment variable.

Usage:
OPENCODE_EXPERIMENTAL_FPS=15 opencode

Key technical detail: OpenTUI has TWO FPS settings:

  • targetFps: The goal/aim (can render faster if there's pending work)
  • maxFps: The hard cap (absolute maximum, cannot exceed)

Initially only targetFps was set, which allowed FPS to still spike. Now BOTH are set to the user-specified value to truly cap the FPS.

Files changed:

  • src/config/config.ts: Added fps field to TUI schema (for future config file support, not yet wired up)
  • src/flag/flag.ts: Added OPENCODE_EXPERIMENTAL_FPS flag parsing
  • src/cli/cmd/tui/app.tsx: Changed render options to use the flag

For reference, OpenTUI source is at /home/ubuntu/gits/opentui, specifically packages/core/src/renderer.ts lines 88-89, 324, 351-352.

Questions to maintainers

I think that docs/removeme-after-merge/todo/todo.lower-fps-settings-findings.md should be deleted, leaving it for review - let me know how to proceed better here

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13814 **State:** open **Merged:** No --- Fixes: #13817 ### What does this PR do? When working on powerful remote machine over RDP (XRDP) I could see that it become laggy and xrdp consumes CPU. After some back and forth, I've assumed it may be to high refresh rate and it seems to be so - once I've set rps to 5, xrdp CPU consumption became much lower. As well, when working over ssh - which is quite standard thing too, having high FPS doesn't make much sense, i.e. over 250-300 ms link, what kind of RPS you may expect :) ### How did you verify your code works? I've build local package, enabled debug information ( Ctrl+P -> Toggle Debug ) , watched FPS is limited while producing some output. In the other terminal, I was watching `top` for xrdp. Tests seems to pass too. ### Detailed Description OpenCode TUI runs at 60 FPS by default, which can cause performance issues when used over RDP (Remote Desktop Protocol). This change allows users to reduce the FPS via the OPENCODE_EXPERIMENTAL_FPS environment variable. Usage: OPENCODE_EXPERIMENTAL_FPS=15 opencode Key technical detail: OpenTUI has TWO FPS settings: - targetFps: The goal/aim (can render faster if there's pending work) - maxFps: The hard cap (absolute maximum, cannot exceed) Initially only targetFps was set, which allowed FPS to still spike. Now BOTH are set to the user-specified value to truly cap the FPS. Files changed: - src/config/config.ts: Added fps field to TUI schema (for future config file support, not yet wired up) - src/flag/flag.ts: Added OPENCODE_EXPERIMENTAL_FPS flag parsing - src/cli/cmd/tui/app.tsx: Changed render options to use the flag For reference, OpenTUI source is at /home/ubuntu/gits/opentui, specifically packages/core/src/renderer.ts lines 88-89, 324, 351-352. # Questions to maintainers I think that `docs/removeme-after-merge/todo/todo.lower-fps-settings-findings.md` should be deleted, leaving it for review - let me know how to proceed better here
yindo added the pull-request label 2026-02-16 18:19:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14821