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
migrate: V1-era session exists only in legacy table, invisible to V2 clients #50980
After upgrading from opencode 1.x to 2.0.15, a session created by V1 minutes
before the upgrade exists in the legacy session table but was never carried
into session_v2 (the live store). It is invisible to the TUI, opencode session list, and the API — apparent data loss for the user.
Environment
opencode version: 2.0.15 (upgrade V1 -> V2 performed 2026-09-23)
OS: Linux 6.12.107+deb13-amd64 (Debian 13)
Terminal: xterm-256color, truecolor
Shell: fish
Install/channel: latest
Active plugins: none configured
Reproduction
Run opencode 1.x and create a session (this one was created ~11 minutes
before the V2 upgrade; V1 wrote it to the legacy session table only).
Upgrade to opencode 2.0.15 and let the first V2 server start apply DB
migrations.
Run opencode session list in the session's directory — the session does
not appear.
Inspect the database read-only:
SELECT id FROM session WHERE id = 'ses_f304ef2b…'; → 1 row (legacy)
SELECT id FROM session_v2 WHERE id = 'ses_f304ef2b…'; → 0 rows
Expected Behavior
The V1→V2 data migration should carry every session from the legacy session/message/part tables into session_v2 (or V2 clients should fall
back to the legacy table for sessions missing from the live store).
Actual Behavior
The session is present in the legacy projection only. No V2 client surface
shows it. It could only be recovered by manually rebuilding an export-format
JSON ({"info": …, "messages": …}) from the legacy tables and running opencode session import --directory <dir>.
Additional Context
The first V2 server start did apply migrations (~54 rows in the migration
table), so the gap is specifically this last-minute V1 write.
Verified workaround: manual reconstruction + re-import; all 20 messages /
64 parts recovered intact.
Same root cause as #50130: once the V1→V2 migration is marked complete (most likely by an earlier V2 run on this database), V1 sessions written afterwards are not imported. Tracking there.
Activity
rekram1-node commentedon Oct 21, 2026
Same root cause as #50130: once the V1→V2 migration is marked complete (most likely by an earlier V2 run on this database), V1 sessions written afterwards are not imported. Tracking there.