GeezerVison is showing github.com — Fix: High CPU / memory leak when filtering model list window to empty results by d3vr · Pull Request #6435 · anomalyco/opencode
Conversation
d3vr
commented
Dec 30, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Resolves #6433
When filtering the model selection list in the TUI to a point where no results match (resulting in an empty list), the application enters a CPU and memory spiral, causing 100% CPU usage and rapid memory consumption until the process crashes.
The Fix
Implemented a conditional rendering guard in packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx.
- Change: Wrapped the
<scrollbox> component in a <Show when={grouped().length > 0}> block.
- Result: When the result list is empty, the
ScrollBox component is completely unmounted from the render tree. This prevents the upstream ScrollBoxRenderable from ever encountering the hazardous 0-height state, effectively bypassing the infinite loop.
Verification
- Confirmed that typing a filter that yields no results now displays "No results found" without spiking CPU/memory or crashing.
- Confirmed that clearing the filter restores the list correctly.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
joachim-isaksson reacted with thumbs up emoji
|
Root Cause Analysis
The issue originates in the upstream @opentui/core library's ScrollBoxRenderable component:
- When the filtered list is empty, our
DialogSelect component passes a height of 0 to the ScrollBox.
- Inside
@opentui/core, the ScrollBoxRenderable listens to onSizeChange events to recalculate scrollbar properties.
- The
recalculateBarProps method contains a workaround that unconditionally schedules a re-render on the next tick: process.nextTick(() => this.requestRender()).
- With a height of
0, the layout engine repeatedly fires onSizeChange (or oscillates), triggering an infinite recursive loop of Layout -> Size Change -> Schedule Render -> Layout.
(DISCLAIMER: I'm not sure this is actually the cause, I'm not too familiar with the opentui codebase, this is Gemini 3 Pro's analysis)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
d3vr
changed the title
Fix: Infinite Layout Loop in DialogSelect when Filtering to Empty Results
Fix: High CPU / memory leak when filtering model list window to empty results
Dec 30, 2025
|
I can one up this I was getting scenarios of using 70GBs of ram but it might be a unrelated memory leak, would it even be feasible for developers to write opencode in Rust?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
hk9890
pushed a commit
to hk9890/opencode
that referenced
this pull request
Jan 1, 2026
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
May 5, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|