Skip to content

V1→V2 migration: one off-format message ID aborts it; migrated sessions stay invisible (stale project_id + path) #55663

Closed as duplicate

Description

@marcello-russo

Summary

After upgrading to 2.0.29, all pre-upgrade sessions disappeared from the TUI picker. Nothing was lost — three separate migration defects combined to hide them:

  1. A single off-format message ID aborts the whole V1 migration. One row with id='msg-init1' (hyphen instead of msg_...) failed schema validation (Session.Message.ID must start with "msg_") and stopped the migration after ~52 of 3681 sessions.
  2. Migrated sessions keep project_id='global'. The TUI session list filters by the current project (project + subpath params, see packages/tui/src/component/dialog-session-list.tsx), so migrated sessions never match.
  3. Migrated sessions keep the stale path (subpath relative to the old / worktree, e.g. home/user/project) while the TUI requests subpath=''. Zero matches even after fixing (2).

Environment

  • opencode 2.0.29, Linux, background service
  • DB: 12 GB, 3681 V1 sessions / 248k messages / 943k parts

Evidence

  • Log: level=ERROR ... message="V1 migration failed" cause="...Session.Message.ID..." (full trace in guide)
  • SELECT id FROM message WHERE id NOT GLOB 'msg_*'; → exactly one row: msg-init1
  • GET /api/session?project=<id>&subpath= returned 1 session before the fix, old sessions after
  • GET /api/experimental/migration/v1 → {"status":"completed"} only after fixing (1)

Workaround applied (verified)

  1. Renamed the offender to msg_init1 (+ its part.message_id refs), restarted service → migration completed.
  2. Remapped session_v2.project_id from global to the per-directory project (760 rows).
  3. Reset session_v2.path='' where directory == project worktree (798 rows).

Full step-by-step guide (diagnosis queries, rollback notes): https://gist.github.com/marcello-russo/0b3bd4872a9eac4b0c31ebf7dc332c01

Suggested fix

  • Migration should skip-and-log (or auto-normalize) rows failing ID validation instead of aborting.
  • Migration should remap project_id to the per-directory project and recompute path relative to it, so migrated sessions are visible without manual DB edits.

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up and the verified workaround guide!

    I think this is a duplicate of existing reports: it combines two known problems, mainly #54736 for the aborted migration and #49827 for the hidden sessions. Possible duplicates and related issues, ordered by likelihood:

    Your numbers (one bad ID stopping the import after about 52 of 3681 sessions, plus 760 and 798 remapped rows) and your gist would be useful as comments on #54736 and #49827.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. marcello-russo commented on Oct 15, 2026

    @marcello-russo
    Author

    Confirmed duplicate — evidence and recovery steps posted on #54736 (migration abort) and #49827 (hidden sessions, incl. the stale-path finding). Closing this one; tracking continues there and on PR #51935.

  3. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for confirming, and for posting your evidence and recovery steps on #54736 and #49827. Follow those two issues and PR #51935 for progress. This issue will be closed as a duplicate.

  4. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Closing as a duplicate, as you confirmed. The aborted migration is tracked in #54736, the hidden sessions (project_id and the stale path) in #49827, and PR #51935 has the proposed fix for the hidden sessions. Thanks again for the detailed diagnosis and for adding your evidence there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions