Skip to content

V2: V1 session history is never imported into session_v2 — old sessions invisible in OpenCode 2 #41217

Description

@RennNathan

Summary

OpenCode 2 (beta) and OpenCode 1 share the same SQLite data directory
(~/.local/share/opencode/opencode.db), but V2 reads/writes a separate
session_v2 / session_message schema family and never imports legacy V1
session / message / part rows. As a result, a user who upgrades to V2
loses visibility of their entire V1 session history — it remains in the DB but
is unreachable from OpenCode 2, with no supported migration path.

Environment

  • opencode version: 0.0.0-next-17028 (V2, next/beta channel); 1.18.15 (V1)
  • OS: macOS arm64 (Darwin 27.0.0, Kernel 27.0.0 arm64)
  • Terminal: Apple_Terminal, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: V2 installed via npm @opencode-ai/cli@next, running as opencode2
  • Active plugins: fusion-audit.js, @slkiser/opencode-quota@latest,
    @tarquinen/opencode-dcp, opencode-caveman, opencode-memfs, opencode-rtk

Reproduction

  1. Have a V1 install with session history (legacy session / message / part rows).
  2. Install the V2 beta (npm install -g @opencode-ai/cli@next) and run opencode2 in the same project.
  3. Open the session list in V2.

Expected Behavior

V2 either (a) surfaces existing V1 session history, or (b) offers a documented
migration that imports legacy session/message/part data into session_v2
— or the migration guide clearly states that V1 session history is not carried
over and how to access it.

Actual Behavior

V1 sessions never appear in V2. They remain in the legacy tables and are not
copied or converted. The DB migration table (41 applied rows) contains no
import/backfill of legacy sessions — the only import migration is
20260805200742_import_legacy_credentials (credentials, not sessions).
session_v2/session_message rows only begin from the first V2 use.

Additional Context

  • DB schema evidence (read-only, from ~/.local/share/opencode/opencode.db):
    • Legacy family: session (674 rows), message (12259), part (53858)
    • V2 family: session_v2 (592 rows), session_message (10860),
      session_pending
    • session.version values are V1 CLI versions (1.18.x); session_v2.version
      includes 0.0.0-next-* beta versions.
    • V2 marker migration: 20260622170816_reset_v2_session_state
    • session_v2 schema differs (adds fork_session_id, fork_boundary,
      time_suspended) so a naive copy would be unsafe.
  • This is likely a missing feature/compat gap rather than a crash.
  • Workaround: reopen old sessions in V1 (opencode), which still reads the
    legacy tables. No V2-side workaround exists.
  • Frequency: consistent/reproducible.
  • Recent change: adopting the V2 beta; no V1 config changes.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions