Windows: global-project session path depends on server process drive, hides API-created sessions from desktop picker
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Read sessionPath in packages/opencode/src/session/session.ts, then inspect sessionListQuery() in packages/tui/src/context/sync.tsx and the path matching described in the issue. Verify that global-project sessions created on another Windows drive use the same path spelling and appear in the desktop /sessions picker; add or run the relevant session and TUI checks if available.
Written by the indexing model from the issue text.
Description
Problem
Sessions created through opencode web (or any API client) on Windows are invisible in the desktop TUI /sessions picker when the target directory is on a different drive than the server process's cwd — as long as the directory has no git repo (so the session lands in the global project).
Concrete case (v1.18.32, single shared opencode.db):
opencode webruns with cwd onC:.- Phone app creates a session with
directory=D:\Work\ForAI\dsh-plugin-TTS, sends messages. The session is fully readable viaGET /sessionandGET /session?directory=.... - Desktop TUI opened in
D:\Work\ForAI\dsh-plugin-TTSshows only an older session in its picker, never the new ones.
Root cause
packages/opencode/src/session/session.ts:
sessionPath(worktree, cwd)=relative(resolve(worktree), cwd). Forglobal-project sessions the worktree is/, and on Windowsresolve("/")is the server process's drive root. Same directory string therefore stores a differentpathdepending on who created it:- web on
C:→path = "D:/Work/ForAI/dsh-plugin-TTS"(absolute, cross-drive fallback) - TUI on
D:→path = "Work/ForAI/dsh-plugin-TTS"(relative)
- web on
- The TUI picker (
packages/tui/src/context/sync.tsx→sessionListQuery()) queriessession.list({ path })with its own drive-relative spelling, andlistByProjectmatchespathverbatim (eq/LIKE path/%). The two spellings never match, so each side only ever sees sessions minted on its own drive.
Verified locally: GET /session?path=Work/ForAI/dsh-plugin-TTS&roots=true returns exactly the 1 old session; the same query with the absolute spelling returns exactly the 2 missing ones.
Side note explaining a related asymmetry: a phone app that lists sessions globally (no project_id/path filter) sees desktop-created sessions fine — the filtering only bites in the desktop picker direction. Also note git init does NOT help here: it moves the TUI query to a new project id while existing sessions stay global, hiding even more.
Suggested fix
In sessionPath, when the worktree is the global root ("/") and the session directory is a Windows drive-absolute path, anchor the relative computation at the session directory's own drive root (D:/) instead of the server process drive. That makes the stored path identical no matter which drive the server runs on, and identical to what a same-drive TUI queries. It is a no-op for same-drive sessions and for real (git) worktrees.
I can put up a PR for this if the approach sounds right.
- Dominant language
- TypeScript
- Stars
- 210k
- Forks
- 27.8k
- Avg merge
- 8h 43m
- Merged PRs (30d)
- 380
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
anomalyco/opencode#51159 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
All issues in anomalyco/opencode
Similar issues
-
resources
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
railmapgen/rmg-palette#2445 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
danielmiessler/LifeOS#2242 ·
Maintainers usually reply within 5 days
-
good first issue hacktoberfest help wanted translation
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
callstackincubator/appduct#129 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100