anomalyco / anomalyco/opencode
Desktop: sessions created before the Projects-sidebar update are invisible in search/sidebar (exact match on session.directory)
@Brendonovich is already working on this.
Since Sep 14, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Issue: Sessions created before the new "Projects" sidebar update are invisible in Desktop search/sidebar
Environment
- App: OpenCode Desktop (Windows, Electron)
- OS: Windows 11
- OpenCode version: current (post-update, with the new Projects sidebar in Home view)
Summary
After updating OpenCode Desktop, old sessions that existed before the "Projects" sidebar was introduced can no longer be found in the sidebar or through the session search. The sessions are still present in the SQLite database (opencode.db) and can be resumed from outside the UI, but they never show up in the new Home/Projects panel.
What I observed
- All historical sessions in the
sessiontable havedirectory = 'D:/'(and an emptypathcolumn), because they were created when OpenCode tracked only the root/global directory. - The current workspace is
C:\Games. After the update, the Desktop Home panel shows "Projects" and a "Search sessions" box. - Searching for
D:\Games(or scrolling the project's session list) returns "No sessions found", even though the sessions belong to this project and their tool calls/snapshots all referenceD:\Games. - After I manually ran:
the sessions appeared in the sidebar immediately. This confirms the new session list is filtered by an exact match on theUPDATE session SET directory = 'D:/Games', path = 'Games' WHERE id IN (...);session.directorycolumn.
Root cause (from the bundled server code)
The Desktop renderer calls client.session.list({ directory, roots: true }), and the server-side V2Session.list filters with:
if ("directory" in input)
conditions.push(eq(SessionTable.directory, input.directory));
Sessions created in earlier versions do not carry a normalized directory/path value matching the workspace they belong to, so exact-match filtering hides them from the UI.
Expected behavior
- Sessions should be matched to a project via the project/worktree mapping (e.g.
project_directory) rather than an exact string match onsession.directory, OR - There should be a migration that backfills
session.directory/pathfor legacy sessions, OR - The session search should also match sessions by content (message text / tool paths) so old sessions remain discoverable.
Steps to reproduce
- Have sessions created in a previous OpenCode Desktop version where
session.directory = 'D:/'inopencode.db. - Update OpenCode Desktop.
- Open the Home panel, select the project (e.g.
D:\Games) or type the folder name in "Search sessions". - Result: "No sessions found" – sessions are invisible even though they exist in the DB.
Data loss concern
This is not a crash, but it is effectively a user-visible data loss: conversations are intact but unreachable from the UI. Affected users will think their chats were deleted by the update.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.