Repository navigation
Description
Desktop (GUI) Home view shows projects but zero sessions — database is correct
Summary
The OpenCode Desktop app (macOS) shows the list of projects in the Home / sidebar, but every project displays "Nothing here yet" / 0 sessions, even though the SQLite database contains correctly-linked sessions. The terminal opencode CLI reads and writes the exact same database without any problem.
Environment
- OpenCode Desktop: 1.17.16 (also reproduced on earlier versions)
opencodeCLI: 1.17.15- OS: macOS (darwin, arm64)
- Database:
~/.local/share/opencode/opencode.db(~916 MB, 164 sessions, 5+ projects)
Observed behavior
- Open Desktop → Home view.
- Sidebar lists the 3 projects the user has added (e.g.
opencode-settings-project,dockinkz,usage-widget). - Selecting any project shows "Nothing here yet — Create a session to get started". No session is listed for ANY project.
- The terminal
opencodeCLI in the same projects works perfectly and its sessions are persisted to the DB.
Expected behavior
Sessions that exist in the database for a given project should appear in the Desktop Home view for that project.
Evidence that the data is correct (not a DB/config issue)
Verified directly against ~/.local/share/opencode/opencode.db:
session.project_idcorrectly referencesproject.id(FK intact):SELECT s.id, p.worktree, COUNT(*) FROM session s JOIN project p ON p.id = s.project_id GROUP BY p.id; -- /Users/diasmazhenov/vibecode/usage-widget | 3 -- /Users/diasmazhenov/vibecode/dockinkz | 1 -- .../opencode-settings-project | 1session.directorymatchesproject.worktree(fixed a mismatch, but the other projects already matched and still show 0).session.time_archivedis NULL for all relevant sessions.session.workspace_idis NULL for all (consistent, not the cause).workspacetable is empty for everyone — not the differentiator.- The Desktop process holds the same shared DB file (confirmed via
lsof:OpenCode … /Users/diasmazhenov/.local/share/opencode/opencode.db). - Other projects (
/,open-design) that are NOT in the Desktop sidebar DO have many sessions in the DB (86 / 73), so the Desktop's project list is a curated subset — but the 3 it shows still render 0 sessions despite valid data.
Notes
- The local Desktop API (
http://127.0.0.1:<port>/project/:id/session) returns401 Unauthorized(Basic realm) and the session list endpoint returns empty; the auth token could not be retrieved from local storage / process env, so the failure appears to be server-side session listing within the Desktop-embedded server rather than a pure frontend render issue. - A fresh restart of the Desktop app (which regenerates
opencode.global.dat) does not resolve it. opencode servestarted manually also returns empty session lists for the same DB, suggesting the session-listing query/path used by the server is the failing component.
Impact
The Desktop GUI is effectively unusable for browsing/reopening past sessions; only the terminal CLI can access them.
Root-cause analysis (from source)
The Desktop Home session list pipeline:
-
packages/app/src/pages/home.tsx→sessionLoadquery calls
focusedSync().project.loadSessions(directory, …)for eachprojectDirectories(). -
packages/app/src/context/directory-sync.ts→fetch()callsclient.session.list()
(SDK client scoped to the project directory) and stores results in the sync store. -
buildHomeSessionRecords()(home.tsx:108) readssync.child(directory)[0]and runs
sortedRootSessions()→roots()→isRootVisibleSession(). -
packages/app/src/pages/layout/helpers.ts:26:const isRootVisibleSession = (session, directory) => pathKey(session.directory) === pathKey(directory) && !session.parentID && !session.time?.archived
The bug: isRootVisibleSession reads session.directory, but the OpenCode server's
GET /api/session response does NOT include a top-level directory field — the directory
is only present under location.directory:
{
"id": "ses_xxx",
"projectID": "…",
"location": { "directory": "/Users/…/project" },
"time": { "created": …, "updated": … }
}So session.directory is undefined → pathKey(undefined) === pathKey(directory) is false →
every session is filtered out of the Home list. This matches the reported symptom exactly
(projects show, sessions never do, for all projects).
projectForSession() (helpers.ts:104) has the same problem: its directory fallback
pathKey(project.worktree) === pathKey(session.directory) also fails when session.directory
is undefined (only the projectID direct match works there).
Suggested fix
Either:
- The server should return a top-level
directoryfield on sessions (mirroringlocation.directory), or - The SDK/client
Sessiontype should maplocation.directory→directorybefore the UI consumes it.
Activity
github-actions commentedon Jul 9, 2026
This issue might be a duplicate of existing issues. Please check:
session.version = 'local'— sessions in DB not shown in Desktop sidebar (different root cause but same symptom).DiasMazhenov commentedon Jul 9, 2026
Update from community report (forum): this is a Desktop cache/state restoration bug, not a storage or directory-mapping issue.
A user confirmed that clearing only the Desktop UI/cache state restored session visibility immediately:
(macOS equivalent:
~/Library/Application Support/ai.opencode.desktop/)After removing those files and restarting Desktop, the full session list reappeared. CLI and TUI could always see all sessions. Symlink vs realpath may be a trigger but was not the root cause in that case.
So the failure is in Desktop's cached session-list index / state restoration going stale and not re-indexing from the DB — not in session persistence. The earlier hypothesis about
session.directoryvslocation.directorydoes not hold (clearing cache fixes it without any data change).JohnRen325 commentedon Jul 11, 2026
Additional data point: cross-version DB, cache-clear does NOT fix, write-touch does
Environment: DB authored by Desktop v1.14, opened/read by CLI v1.17, Desktop v1.14→v1.17, Windows (
%APPDATA%\ai.opencode.desktop\).Observed
opencode.dbwas read by CLI v1.17, the Desktop sidebar showed 1 sessions for every project, while the CLI listed them all from the same file.opencode.global.dat+opencode.workspace.*.datand restarting did NOT help either — so for this case it is not a stale UI-cache issue.Workaround (reliable)
ESC-interrupt it.Giblarium commentedon Aug 14, 2026
Additional data point for Windows: drive-letter case mismatch between the Desktop layout store and the DB hides all sessions in Home.
Environment
C:\Users\<user>\.local\share\opencode\opencode.dbObserved
Projects show in Home, but every project renders zero sessions — same as the original report. The terminal CLI lists all sessions from the same DB without issue. Clearing the Desktop UI cache (.dat files, Local Storage) did not help; "write-touch" via CLI did not help either.
Root cause found
The persisted Desktop layout store (
opencode.global.dat, keyserver.projects) stores the project worktree with a lowercase drive letter:while the database stores
session.directory/project.worktreewith an uppercase drive letter:The Home pipeline (
buildHomeSessionRecords->pathKey) comparespathKey(session.directory)againstpathKey(project.worktree)from the layout store.pathKeyonly normalizes slashes (\->/) and does not normalize drive-letter case, so on Windows:Every session is filtered out -> "zero sessions" for every project. This matches the symptom exactly and is the same path-sensitivity class as #14570 / #17518, but on the Home/Desktop layout store side.
Workaround (confirmed working)
Align the DB paths to the layout's drive-letter case (lowercase), then fully restart Desktop:
(or, alternatively, normalize the persisted layout
worktreeto uppercase — the two stores must match case-wise).Suggested fix
Make path comparison on Windows case-insensitive in
pathKey(normalize drive letter and ideally compare case-insensitively), or canonicalize paths to a single form when persisting to the layout store vs. writing to the DB.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊