Description
When using OpenCode Desktop App (v1.4.0), the bundled opencode-cli serve backend process consistently exceeds 200% CPU during active agent sessions. The only effective workaround is setting "snapshot": false in config, which disables session change tracking and file revert/undo — a significant feature trade-off.
Root cause (CPU profiled):
- Top frame:
vcs.ts:63 accounts for ~65% of total sampled time
- Dominant stack:
execEditLength ← structuredPatch ← patch3[vcs.ts:53] ← (anonymous)[vcs.ts:63]
summarize() generates full unified patches on every file event when it only needs summary statistics
Environment:
| Item |
Detail |
| Machine |
Apple M4 Max, 128 GB RAM, 4 TB SSD |
| OS |
macOS 26.2 (Build 25C56), arm64 |
| Client |
OpenCode Desktop App v1.4.0 |
| Backend |
opencode-cli serve (bundled with Desktop App) |
| Project |
Large monorepo (~51,000 files excl. node_modules/.git, 19 packages) |
Suggested fixes (by priority):
- Separate summary stats from full patch generation —
summarize() only needs additions/deletions/files counts, which git diff --numstat provides cheaply. Generate actual patch strings only on demand when the user expands a specific file in the review UI.
- Debounce + coalesce
refreshVcs() — use a dirty-flag + debounce (300–1000 ms) so a burst of file writes triggers only one diff instead of clearing in-flight dedup state on every event.
- Use git-native patch output instead of JS-side
structuredPatch() — moves the O(N·D) algorithm out of the Node event loop entirely.
- Cache patches by file content hash — skip re-diffing files whose before/after content hasn't changed.
Related: #21470, #19466
Plugins
oh-my-openagent (local)
opencode-claude-auth@1.4.9
OpenCode version
1.4.0 (Desktop App, bundled opencode-cli serve)
Steps to reproduce
- Open a large project with OpenCode Desktop App (keep the Changes/Review panel visible)
- Start an agent session that edits files across multiple steps
- Observe
opencode-cli serve process CPU climbing above 200% as the session progresses
- Set
"snapshot": false in config to confirm it stops — this is the only workaround, but disables session change tracking
Screenshot and/or share link
CPU profile files are saved at ~/.local/share/opencode/log/cpu-*.cpuprofile and can be loaded in Chrome DevTools Performance tab.
Operating System
macOS 26.2 (Build 25C56), Apple M4 Max, 128 GB RAM, 4 TB SSD
Terminal
OpenCode Desktop App v1.4.0
Description
When using OpenCode Desktop App (v1.4.0), the bundled
opencode-cli servebackend process consistently exceeds 200% CPU during active agent sessions. The only effective workaround is setting"snapshot": falsein config, which disables session change tracking and file revert/undo — a significant feature trade-off.Root cause (CPU profiled):
vcs.ts:63accounts for ~65% of total sampled timeexecEditLength ← structuredPatch ← patch3[vcs.ts:53] ← (anonymous)[vcs.ts:63]summarize()generates full unified patches on every file event when it only needs summary statisticsEnvironment:
opencode-cli serve(bundled with Desktop App)node_modules/.git, 19 packages)Suggested fixes (by priority):
summarize()only needsadditions/deletions/filescounts, whichgit diff --numstatprovides cheaply. Generate actual patch strings only on demand when the user expands a specific file in the review UI.refreshVcs()— use a dirty-flag + debounce (300–1000 ms) so a burst of file writes triggers only one diff instead of clearing in-flight dedup state on every event.structuredPatch()— moves the O(N·D) algorithm out of the Node event loop entirely.Related: #21470, #19466
Plugins
OpenCode version
1.4.0 (Desktop App, bundled
opencode-cli serve)Steps to reproduce
opencode-cli serveprocess CPU climbing above 200% as the session progresses"snapshot": falsein config to confirm it stops — this is the only workaround, but disables session change trackingScreenshot and/or share link
CPU profile files are saved at
~/.local/share/opencode/log/cpu-*.cpuprofileand can be loaded in Chrome DevTools Performance tab.Operating System
macOS 26.2 (Build 25C56), Apple M4 Max, 128 GB RAM, 4 TB SSD
Terminal
OpenCode Desktop App v1.4.0