[PR #6435] Fix: High CPU / memory leak when filtering model list window to empty results #11902

Closed
opened 2026-02-16 18:16:50 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: Yes


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.
2025-12-30-102356_1073x495_scrot
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6435 **State:** closed **Merged:** Yes --- 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. <img width="1073" height="495" alt="2025-12-30-102356_1073x495_scrot" src="https://github.com/user-attachments/assets/ad9bfa7f-6379-4655-9c96-e095087e3261" />
yindo added the pull-request label 2026-02-16 18:16:50 -05:00
yindo closed this issue 2026-02-16 18:16:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11902