GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sessions: legacy import stays completed after one early V2 run and never imports sessions created afterwards · Issue #64439 · anomalyco/opencode

sessions: legacy import stays completed after one early V2 run and never imports sessions created afterwards #64439

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
sessions: legacy import stays completed after one early V2 run and never imports sessions created afterwards#64439
Copy link
Labels
area/sessions-storageSessions, history and stored dataplatform/windowsWindowstype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@pica105
pica105
opened on Nov 17, 2026
Issue body actions

Description

Summary

Upgrading from V1 (1.19.5) to V2 (2.3.0) shows only 103 of 437 existing sessions. The migration.v1-v2 marker in kv was set to {"phase":"completed"} on 2026-09-25, when a V2 build was run once. Everything created while the user continued on V1 afterwards (335 sessions, 67 top-level chats, 23 959 messages, 2026-09-25 → 2026-11-17) exists only in the legacy session table, has no session_v2 row, and is invisible to the API and the UI.

Actual Behavior

Only the sessions that existed at the moment of the first V2 run are listed. Newer legacy sessions are silently absent:

  • GET /api/session/<id> → {"_tag":"SessionNotFoundError"}, HTTP 404
  • opencode session list in a directory that has 12 sessions returns 1
  • visibly split by project: one project shows 21 of 126 sessions, three projects show 0

Measured in the user's DB (PRAGMA integrity_check = ok):

table rows
session (legacy) 437
session_v2 103
sessions present only in session 335 (67 top-level chats)
message rows for those 335 23 959

By the per-row version column: every 1.18.18 / 1.18.31 / 1.18.32 row is in session_v2; every row with version >= 1.18.33 (everything written after 2026-09-25) exists only in session.

Expected Behavior

All existing sessions are visible after the upgrade, or the import re-runs (or at least warns) when legacy sessions newer than the last import are detected.

Additional Context

  • kv.migration.v1-v2 = {"phase":"completed"}, time_created 2026-09-25T15:55:41Z, time_updated 2026-09-25T15:55:52Z — the marker stayed completed through the later V1 usage and today's upgrade, so the import never re-runs.
  • The unmigrated sessions have no session_message rows (0), while their data is intact in the legacy message / part tables. session_part is empty overall.
  • opencode session export is not a workaround: it reads the new store, and these sessions 404.
  • Root cause is the one-shot, single-marker design: "run V2 once → back to V1 → upgrade to V2 later" permanently strands everything written in between.

Suggested fix: on startup compare SELECT max(time_created) FROM session (legacy) with the marker timestamp, or SELECT count(*) FROM session WHERE id NOT IN (SELECT id FROM session_v2), and run an idempotent re-import; failing that, at least log a warning and show the count in the UI instead of hiding sessions silently.

I still have the original DB, so I can test a build or run more queries if useful.

Plugins

None configured in the global opencode.jsonc

OpenCode version

2.3.0 (running app/server). The opencode CLI on PATH reports 2.0.16.

Steps to reproduce

  1. On V1 (released build), have some sessions in ~/.local/share/opencode/opencode.db.
  2. Run a V2 build once and use it, so migration writes kv: migration.v1-v2 = {"phase":"completed"}.
  3. Go back to V1 and keep working: create more sessions and messages for weeks.
  4. Upgrade to V2 (2.3.0) and open the session list.

Screenshot

No screenshots. Diagnostics: no related errors in opencode.log; the row counts above come from a read-only node:sqlite open of opencode.db.

Operating System

Windows_NT 10.0.26300 (win32 x64)

Terminal

OpenCode desktop app (no terminal env vars set); shell cmd.exe

Activity

  1. opencodejr commented on Nov 17, 2026

    @opencodejr
    opencodejrBot
    on Nov 17, 2026
    Contributor
    More actions

    Thanks for the detailed counts and the timeline. I think this is a duplicate of #50130. When the migration.v1-v2 marker is {"phase":"completed"}, V1 sessions created after that point are never imported. They stay in the legacy session table with no session_v2 row, and GET /api/session/<id> returns 404 SessionNotFoundError. That issue has been reproduced, and other users have confirmed it on 2.3.0 and on Windows.

    Related issues, ordered by likelihood:

    • server: V1 sessions created after migration.v1-v2 completes are never imported #50130: the same problem, where the completed marker means V1 sessions created later are never imported. It is open and reproduced.
    • fix(core): import V1 sessions created after migration completes #54272: an open PR aimed at this case.
    • session: migrated session missing messages written after V1→V2 migration; export truncated #57000: the related case of V1 messages written to an already-migrated session after the migration completed.
    • migrate-v1: non-git sessions in "global" project hidden after V1→V2 upgrade #49827: a different problem, where sessions are imported but end up under the wrong project. I list it only to tell the two apart.

    Please keep your original database as it is. The data is still in the legacy tables. Several people in #50130 have posted their recovery steps and discussed which approaches are safe.

    I'm closing this issue now as a duplicate of #50130. Please add your details there, especially that you can test a build with your database, since that would help with #54272. If you think this is a different problem, reply here and this issue will reopen.

  2. opencodejr
    closed this as a duplicateof server: V1 sessions created after migration.v1-v2 completes are never imported #50130 on Nov 17, 2026
  3. opencodejr
    added
    area/sessions-storageSessions, history and stored data
    platform/windowsWindows
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sessions-storageSessions, history and stored dataplatform/windowsWindowstype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.