You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--continue selects wrong session due to incorrect sort order in sync.tsx #5510
Sessions are sorted by ID string comparison (a.id.localeCompare(b.id)) but session IDs use descending timestamp encoding (newer sessions have lexicographically smaller IDs via Identifier.descending()). This causes --continue to select an old/stale session instead of the most recently updated one.
Root cause:
packages/opencode/src/cli/cmd/tui/context/sync.tsx:282
(x.data ?? []).toSorted((a, b) => a.id.localeCompare(b.id))
Fix:
Sort by timestamp instead:
(x.data ?? []).toSorted((a, b) => b.time.updated - a.time.updated)
OpenCode version
1.0.152 (built from source, dev branch)
Steps to reproduce
Have multiple sessions (created over several hours/days)
Run opencode --continue
Observe that it opens an old session instead of the most recently updated one
Activity
github-actions commentedon Dec 14, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
Brandtweary commentedon Dec 14, 2025
Not the same as #4378, that's for concurrent situations. This occurs even if you have only one instance open at a time.