Skip to content

Fallback OpenCode CLI import to pre-1.14 JSON storage when opencode.db is missing #977

Closed

Description

@currentbits

OpenCode CLI import (#976) only reads OPENCODE_HOME/opencode.db (SQLite session/message/part). Pre-1.14 OpenCode stored JSON at ~/.local/share/opencode/storage/session//.json plus message/ and part/ trees.

Add a fallback walk of that JSON layout when opencode.db is missing or has no session table.

Constraints:

  • Do not copy the OpenCode store
  • Do not touch reclaim (absorbSessionTurns / setEjected / findOpenCodeSessionFile)
  • Ignore renderer-supplied home on IPC
  • Follow listOpenCodeSessions / importOpenCodeSession in electron/cli-sessions.js
  • Extend electron/test/cli-sessions.test.js with a JSON-only fixture home

Steps:

  1. Failing module tests: list + import from a JSON-only fixture (no opencode.db)
  2. Fallback when db exists but has no session table
  3. Keep SQLite as the source of truth when the session table exists (do not double-count leftover JSON)
  4. Implement the walk without leaving storage/ and without copying files

Activity

  1. added
    plan:todo
    plan:doing
    plan:done
    and removed
    plan:todo
    plan:doing
    on Sep 6, 2026
  2. currentbits commented on Sep 6, 2026

    @currentbits
    OwnerAuthor

    JSON fallback is in listOpenCodeSessions / importOpenCodeSession. When OPENCODE_HOME/opencode.db is missing or has no session table, the scan walks storage/session//.json plus message/ and part/ trees. SQLite remains the source of truth when the session table exists. Store is not copied; reclaim is unchanged; IPC still ignores renderer home. electron/test/cli-sessions.test.js JSON-only fixture + existing SQLite tests: 44 passing; IPC: 2 passing.

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

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions