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
[BUG] Windows: session.path for non-git projects is drive-dependent, hiding sessions from /sessions based on launch drive #41567
On Windows, session.path for sessions in non-git projects (the global project) is computed relative to path.resolve("/"), which anchors to the drive root of the process working directory. The same physical directory therefore gets different relative paths depending on which drive opencode was launched from:
Non-git projects set worktree to a synthetic "/" (project.ts:217), so:
opened from C:\Users\foo → stored path is Users/foo/...
opened from D:\Dev\... → the same directory produces Dev/... or, cross-drive, an absolute-style C:/Users/foo/... result
The TUI's directory filter (packages/tui/src/context/sync.tsxsessionListQuery()) uses the same computation at query time, so sessions created from one drive disappear from /sessions when opencode is launched from another drive. In practice: sessions created in the home directory vanish from the session picker every time opencode is started from a folder on another drive.
Observed on 1.18.16 with a DB containing 121 sessions stored as path='Users/wxj20', 48 with path=NULL, and a few Dev/... sessions: from C:\Users\wxj20 the picker shows the 121, from D:\Dev\... it shows only the Dev/... ones.
Plugins
None
OpenCode version
1.18.16
Steps to reproduce
On Windows, launch opencode in a non-git directory on drive C: (e.g. C:\Users\foo) and create a session.
Verify the session is stored with path like Users/foo.
Launch opencode in any non-git directory on drive D: (no --directory), open /sessions.
The session created in step 1 is not listed, even though it belongs to the same project.
Screenshot and/or share link
N/A
Operating System
Windows 11
Terminal
Windows Terminal / PowerShell
Notes
The writer and query side both use path.resolve("/"), which is launch-drive dependent on win32; anchoring "/" to the directory's own drive root makes stored paths deterministic. A fix is prepared in # (see also fix(session): scope default lists by directory #38532 for scoping the default list by exact directory).
Fix prepared in #41568 (server-side path anchoring; reuses sessionPath() in cli/import.ts). The TUI's default list scoping for non-git directories is addressed separately in #38532.
Confirming this is still reproducible on 1.18.34 (Windows 11), with a desktop→CLI case that adds to the evidence here.
Environment: CLI 1.18.34 (npm opencode-ai) and Desktop 1.18.34, sharing the same opencode.db.
Affected folders are non-git directories on D:, e.g. D:\WORK\PTTK, D:\WORK\BÁO CÁO (project global, worktree /).
Sessions created from the desktop (sidecar running with its cwd on C:) are stored with absolute-looking paths:
directory
stored path
sessions
D:/WORK/PTTK
D:/WORK/PTTK
20
D:/WORK/BÁO CÁO
D:/WORK/BÁO CÁO
4
D:/WORK/Dating
D:/WORK/Dating
33
The desktop sidebar shows all of them. The CLI TUI launched in D:\WORK\PTTK computes path = relative(resolve("/"), "D:/WORK/PTTK") = "WORK/PTTK" at query time, so the /session picker returns nothing.
API repro against a 1.18.34 server using the same DB:
GET /session?directory=D:/WORK/PTTK -> 20
GET /session?directory=D:/WORK/PTTK&path=WORK/PTTK -> 0 (what the TUI sends)
GET /session?directory=D:/WORK/PTTK&path=D:/WORK/PTTK -> 20
Git projects are unaffected: worktree == directory, so the computed path is "" and the path filter is effectively skipped — which is why only non-git folders (the global project) exhibit this.
PR #41568 (anchoring sessionPath() to the directory drive) was closed without being merged. It looks like it needs to be revived: both the write side and the TUI query side (packages/tui/src/context/sync.tsxsessionListQuery()) must anchor "/" deterministically, otherwise the picker keeps depending on the drive opencode is launched from.
Related: #51258 is the same root cause in the reverse direction (sessions written by API/CLI hidden from the desktop picker).
Workaround for affected users: run the palette command app.toggle.session_directory_filter ("Disable session directory filtering") to list by project instead of by path.
Activity
wxj006007 commentedon Aug 10, 2026
Fix prepared in #41568 (server-side path anchoring; reuses
sessionPath()incli/import.ts). The TUI's default list scoping for non-git directories is addressed separately in #38532.phuchb204 commentedon Oct 2, 2026
Confirming this is still reproducible on 1.18.34 (Windows 11), with a desktop→CLI case that adds to the evidence here.
opencode-ai) and Desktop 1.18.34, sharing the sameopencode.db.D:, e.g.D:\WORK\PTTK,D:\WORK\BÁO CÁO(projectglobal, worktree/).C:) are stored with absolute-looking paths:pathD:/WORK/PTTKD:/WORK/PTTKD:/WORK/BÁO CÁOD:/WORK/BÁO CÁOD:/WORK/DatingD:/WORK/DatingD:\WORK\PTTKcomputespath = relative(resolve("/"), "D:/WORK/PTTK") = "WORK/PTTK"at query time, so the/sessionpicker returns nothing.API repro against a 1.18.34 server using the same DB:
Git projects are unaffected:
worktree == directory, so the computed path is""and the path filter is effectively skipped — which is why only non-git folders (theglobalproject) exhibit this.PR #41568 (anchoring
sessionPath()to the directory drive) was closed without being merged. It looks like it needs to be revived: both the write side and the TUI query side (packages/tui/src/context/sync.tsxsessionListQuery()) must anchor"/"deterministically, otherwise the picker keeps depending on the drive opencode is launched from.Related: #51258 is the same root cause in the reverse direction (sessions written by API/CLI hidden from the desktop picker).
Workaround for affected users: run the palette command
app.toggle.session_directory_filter("Disable session directory filtering") to list by project instead of by path.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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊