GeezerVison is showing github.com — migration: v1 sessions imported under project 'global' are invisible in project session lists · Issue #50999 · anomalyco/opencode
migration: v1 sessions imported under project 'global' are invisible in project session lists #50999
Description
Description
Summary
The v1→v2 session import runs and reports completed, but every imported v1
session is assigned project_id='global' (the catch-all project with path /)
instead of the project matching the session's preserved directory. Clients
list sessions scoped to a project, so the entire v1 history becomes invisible
after the upgrade even though the data is fully intact in the database.
Environment
- opencode version: 2.0.15 (upgraded from 1.18.31)
- OS: Linux 6.6.114.1-microsoft-standard-WSL2 x86_64
- Terminal: TERM_PROGRAM=vscode, TERM=xterm-256color, COLORTERM=truecolor
- Shell: bash
- Install/channel: release (v2 installed via bun; v1 previously via the curl install script)
- Active plugins: oh-my-opencode-slim (unrelated — the behavior is server-side data placement)
Reproduction
- Use opencode v1 (1.18.x) with session history across several distinct project directories.
- Upgrade to v2 and start it once. The import runs: KV gains
migration.v1-v2 = {"phase":"completed"}, and
GET /api/experimental/migration/v1 returns {"status":"completed"}.
- Open the TUI in any of the former project directories and list sessions
(<leader>l or ctrl+o).
Expected Behavior
Imported v1 sessions appear in the session list of the project/directory they
originally belonged to.
Actual Behavior
- All v1 sessions are imported with intact data: present in
session_v2 /
session_message, with correct directory, subpath, and original v1
version strings (e.g. 1.18.x).
- But every imported row carries
project_id='global'. No project rows are
created or resolved for the original directories.
- Project-scoped listings (
GET /api/session?project=<id>) therefore return
only post-upgrade sessions. From the affected installation (paths
anonymized): 97 imported v1 sessions spread across 5 distinct original
directories (largest: 41 sessions).
GET /api/session?project=<projectA> → 0 imported sessions
GET /api/session?directory=<projectA> → 41 (all with projectID: global)
GET /api/session?project=global → 97
- The migration reports
completed with no indication that sessions are
unreachable from their recorded directories.
Frequency: consistent — every project directory, every start.
Additional Context
- Verified workaround:
POST /api/session/{sessionID}/move with body
{"directory":"<original directory>"} re-associates a session and
auto-creates the target project row. Batch-moving 53 sessions this way made
them immediately visible in project-scoped lists. Note that
PATCH /api/session/{id} only supports title/metadata/permissions, so
move is the only API path.
- Minor related observation: the first
move call shortly after service start
was a silent no-op (empty response, exit 0, no change); the identical call
retried a few minutes later succeeded.
- Suggestion: have the importer resolve each session's
directory to its
project (creating it if needed, exactly as move already does).
Alternatively, include global-project sessions whose directory falls
under the requested location in project-scoped lists. At minimum, avoid
reporting completed while imported sessions remain unreachable.
- The migrate-v1 docs page does not mention session-history import or this
global-project placement.
- Reporter's network could not reach GitHub to search for duplicates or
cross-reference the recent v1 session-import migration change; maintainers
may want to cross-check against that work.
Activity
neriousy commented on Oct 20, 2026
Thanks for documenting the database checks and recovery steps — this is the same problem as #49827, where we're tracking imported sessions remaining under the old global project. Please subscribe or add a 👍 there, and your observation about the first move request doing nothing would be worth adding too.
Metadata
Metadata
Development
No branches or pull requestsIssue actions