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
Home sessions hidden from /sessions in global project #29581
Opening opencode from the home directory can make /sessions hide older home sessions.
In the failing case the TUI session query used path=home/cagedbird. Older home sessions in the database had directory=/home/cagedbird and an empty path, so they were filtered out even though opencode session list and the session API could still return them.
Plugins
rtk, opencode-browser
OpenCode version
1.15.11
Steps to reproduce
Have existing home sessions stored with directory=$HOME and empty path.
Open opencode from $HOME.
Open /sessions.
Some home sessions are missing.
Screenshot and/or share link
Not available. Local logging showed the dialog query was {"path":"home/cagedbird"} while the missing session had path=''.
Same bug confirmed on macOS with opencode 1.15.12. Here's the detailed root cause analysis from our debugging:
Root cause: The TUI session filter function (W() in the Sync provider) returns {path: relativePath} or {scope: "project"}. Both are valid query params for GET /session (the Effect HTTP handler's QF schema includes scope: optional(Literals(["project"])) and path: optional(String)). The server uses these to filter sessions, but sessions with project_id = "global" and no path set (empty string) don't match any project.
Why CLI works:opencode session list uses a different code path — the RPC handler listSessions(D) calls this.sdk.session.list({directory: D.cwd ?? void 0, roots: true}) directly against the DB with roots: true, bypassing the HTTP filter entirely.
No project with matching worktree in the project table
app.toggle.session_directory_filter toggles between {path: ""} and {scope: "project"} — neither helps because both paths end up filtering out global sessions
Suggested fix: The W() function should fall back to {directory: instance.directory, roots: true} when no project matches the current directory, mirroring the CLI behavior. Alternatively, the server-side handler for GET /session should include project_id = 'global' sessions when scope: 'project' finds no matching project.
Hitting this on a non-home directory as well — adding evidence in case it helps broaden the fix.
Setup
OpenCode 1.15.6 on macOS (anomalyco fork)
Working dir: a subfolder of ~/Desktop (not $HOME)
Project worktree: / (global)
Symptom
23 of 62 sessions in this directory are invisible in /sessions. opencode session list and opencode -s <id> both find them fine.
Root cause: writer/reader contract mismatch on session.path
Two states exist for the path column on sessions in the same directory:
path value
Count
Visible in /sessions?
NULL
39
yes
'' (empty string)
23
no
All 23 invisible sessions were created on OpenCode ≥ 1.14.39 (oldest 2026-05-06). All 39 visible ones are on ≤ 1.14.28. Something between those releases changed session creation from writing NULL to writing ''.
The server-side filter at packages/opencode/src/session/session.ts:1058:
The fallback that catches "no path-prefix match" only fires for path IS NULL. Sessions with path = '' don't match either branch and get filtered out.
Why this is broader than the home-directory case
PR #29582 special-cases the home directory by switching to project scope. That only triggers when the worktree resolves to /and the directory is $HOME. My case is a Desktop subfolder, so #29582 wouldn't fix it — but the underlying bug is identical.
This is non-breaking and covers existing DBs without requiring a data migration. Alternatively (or additionally), normalize at the writer to always store NULL when no path applies.
Local workaround (no app restart of fix, just data normalization)
UPDATE session SETpath=NULLWHEREpath='';
Confirmed on my DB: the 23 hidden sessions reappeared after restarting the TUI.
Activity
cagedbird043 commentedon May 27, 2026
PR opened: #29582
Appjak34 commentedon May 29, 2026
Same bug confirmed on macOS with opencode 1.15.12. Here's the detailed root cause analysis from our debugging:
Root cause: The TUI session filter function (
W()in the Sync provider) returns{path: relativePath}or{scope: "project"}. Both are valid query params forGET /session(the Effect HTTP handler'sQFschema includesscope: optional(Literals(["project"]))andpath: optional(String)). The server uses these to filter sessions, but sessions withproject_id = "global"and nopathset (empty string) don't match any project.Why CLI works:
opencode session listuses a different code path — the RPC handlerlistSessions(D)callsthis.sdk.session.list({directory: D.cwd ?? void 0, roots: true})directly against the DB withroots: true, bypassing the HTTP filter entirely.Database evidence from our env:
project_id = 'global',directory = '/Users/appjak',path = nullprojecttableapp.toggle.session_directory_filtertoggles between{path: ""}and{scope: "project"}— neither helps because both paths end up filtering outglobalsessionsSuggested fix: The
W()function should fall back to{directory: instance.directory, roots: true}when no project matches the current directory, mirroring the CLI behavior. Alternatively, the server-side handler forGET /sessionshould includeproject_id = 'global'sessions whenscope: 'project'finds no matching project.hxrikp1729 commentedon Jun 2, 2026
Hitting this on a non-home directory as well — adding evidence in case it helps broaden the fix.
Setup
~/Desktop(not$HOME)/(global)Symptom
23 of 62 sessions in this directory are invisible in
/sessions.opencode session listandopencode -s <id>both find them fine.Root cause: writer/reader contract mismatch on
session.pathTwo states exist for the
pathcolumn on sessions in the same directory:pathvalue/sessions?NULL''(empty string)All 23 invisible sessions were created on OpenCode ≥ 1.14.39 (oldest 2026-05-06). All 39 visible ones are on ≤ 1.14.28. Something between those releases changed session creation from writing
NULLto writing''.The server-side filter at
packages/opencode/src/session/session.ts:1058:The fallback that catches "no path-prefix match" only fires for
path IS NULL. Sessions withpath = ''don't match either branch and get filtered out.Why this is broader than the home-directory case
PR #29582 special-cases the home directory by switching to project scope. That only triggers when the worktree resolves to
/and the directory is$HOME. My case is a Desktop subfolder, so #29582 wouldn't fix it — but the underlying bug is identical.Proposed minimal fix (server-side, one line)
This is non-breaking and covers existing DBs without requiring a data migration. Alternatively (or additionally), normalize at the writer to always store
NULLwhen no path applies.Local workaround (no app restart of fix, just data normalization)
Confirmed on my DB: the 23 hidden sessions reappeared after restarting the TUI.
github-actions commentedon Aug 2, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.