Uh oh!
There was an error while loading. Please reload this page.
fix: session not found when selecting sessions from TUI picker - #12343
fix: session not found when selecting sessions from TUI picker#12343Limme-swe wants to merge 3 commits into
Conversation
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found one potentially related PR: PR #8825: fix: skip corrupted session files when listing sessions
The other search results (#6138, #5020, #5518) are related to TUI session handling but address different features/issues (session picker limits, layout system, linear search fallback) rather than the specific bugs in PR #12343. Recommendation: Check PR #8825 to see if it's already been merged or if it duplicates the corrupted file handling fix in PR #12343. |
localeCompare and < produce different orderings for mixed-case strings. Binary.search uses <, so arrays sorted with localeCompare cause search misses — resulting in 'session not found' when selecting sessions from the TUI picker.
A single corrupted JSON file would cause the messages endpoint to return 500, making the entire session unloadable. Now corrupted files are skipped so the rest of the session remains accessible.
Fixes#12345
Two bugs causing "session not found" when picking sessions in the TUI:
The session array gets sorted with
localeComparebutBinary.searchuses<. 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. Theapp/package already does this correctly, the TUI sync store and permission sort were the odd ones out.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()andparts()skip unreadable files instead of crashing.