-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
bugSomething isn't workingSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
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
Screenshot and/or share link
No response
Operating System
Pop!_OS 22.04 LTS
Terminal
Zed IDE integrated terminal
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui