[PR #12343] fix: session not found when selecting sessions from TUI picker #14177

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

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

State: closed
Merged: No


Fixes #12345

Two bugs causing "session not found" when picking sessions in the TUI:

  1. The session array gets sorted with localeCompare but Binary.search uses <. These give different orderings for mixed-case strings — and session IDs have base62 random suffixes with mixed case. So binary search just misses sessions that are right there in the array. The app/ package already does this correctly, the TUI sync store and permission sort were the odd ones out.

  2. If any message or part file has corrupted JSON, the messages endpoint blows up with a 500 and the catch handler shows "session not found" even though the session is fine. Now stream() and parts() skip unreadable files instead of crashing.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12343 **State:** closed **Merged:** No --- Fixes #12345 Two bugs causing "session not found" when picking sessions in the TUI: 1. The session array gets sorted with `localeCompare` but `Binary.search` uses `<`. These give different orderings for mixed-case strings — and session IDs have base62 random suffixes with mixed case. So binary search just misses sessions that are right there in the array. The `app/` package already does this correctly, the TUI sync store and permission sort were the odd ones out. 2. If any message or part file has corrupted JSON, the messages endpoint blows up with a 500 and the catch handler shows "session not found" even though the session is fine. Now `stream()` and `parts()` skip unreadable files instead of crashing.
yindo added the pull-request label 2026-02-16 18:18:59 -05:00
yindo closed this issue 2026-02-16 18:18:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14177