v2: sessions with path=NULL (around v1's add_session_path schema change) are missing from project session lists
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
Start with packages/core/src/session/store.ts around line 108 and compare the project-scoped filter with packages/opencode/src/session/session.ts around lines 970-976. Check how SessionStore.list handles a root subpath and reproduce the query against rows where path IS NULL. Done means correctly attributed root sessions appear in the project list without changing all-project behavior.
Written by the indexing model from the issue text.
Description
Description
Sessions with path = NULL are missing from project session lists after the v1→v2 upgrade, even though their project_id is correct.
v1 began with no path column; 20260428004200_add_session_path added it (default NULL), and v1's inserts still left it NULL for root-level sessions for a while (in our DB: a clean NULL window 2026-04-03→05-05, with every later session writing ''). The v1→v2 importer copies path verbatim, so these rows arrive in session_v2 with path IS NULL. The project-scoped picker sends {project, subpath: ''} and SessionStore.list filters with an exact eq(SessionTable.path, input.subpath) (packages/core/src/session/store.ts:108) — in SQL, NULL = '' is not true, so the rows are excluded. The projector only rewrites the path of the session that triggered a Resolved event; historical rows are never backfilled.
Scope in our DB (opencode 2.0.14, upgraded from 1.18.x): 90 sessions — 88 in one git repo (87 top-level, mostly user-initiated forks, ~1,300 messages total) + 2 in a second repo. All have directory = project.worktree, so the correct value is ''. They are only reachable via "all projects" scope / global search.
This is a different defect from #50980 (where the row is absent from session_v2 entirely) and from the project_id='global' family (#50551, #50800, #50999): here the project attribution is right, only path is null.
Plugins
None relevant (server-side data/filter behavior).
OpenCode version
2.0.14 (affected, by source comparison: 2.0.14–2.0.16; not fixed on latest tag)
Steps to reproduce
- In opencode v1, create sessions in a git repo root during the window where v1 didn't write
path(around the20260428004200_add_session_pathchange — e.g. after thepathcolumn exists but before v1 started writing''). - Upgrade to v2.0.14–2.0.16 and open that repo. The import copies
path = NULLintosession_v2. - List sessions in the project: the NULL-path sessions don't appear, though "all projects" scope shows them.
Check your own DB:
SELECT project_id, directory, COUNT(*) FROM session_v2 WHERE path IS NULL GROUP BY 1, 2;
Expected Behavior
Sessions whose directory equals the project worktree should be listed at subpath = '', i.e. NULL should be treated as the empty path (the dev branch already adds this: and(isNull(path), eq(directory, …)) at packages/opencode/src/session/session.ts:970-976).
Related issues
- #35750 — v1-era: new
pathcolumn not back-filled during migration (origin of these NULLs) - #50980 — sister symptom: v1-era session missing from
session_v2entirely - #50551 — the
project_id='global'family (different root cause, same picker filter)
Operating System
Arch Linux, x86_64
Terminal
kitty
- 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 78/100
Maintainers usually reply within 1 day
-
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 74/100
Maintainers usually reply within 1 day
All issues in anomalyco/opencode
Similar issues
-
module-request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
appandflow/stim#1604 · 1 comment ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 92/100
lingdojo/kana-dojo#31060 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
paperclipai/paperclip#14173 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day