anomalyco / anomalyco/opencode

Mixed stable/beta channels sharing one data dir silently split sessions across `session` and `session_v2`

Open
#44,028 1 comment 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 22, 2026.

2.0
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Title: Mixed stable/beta channels sharing one data dir silently split sessions across session and session_v2

Body:

Environment

  • macOS arm64, single shared data dir (~/.local/share/opencode, SQLite)
  • Stable generation: CLI 1.18.15 (brew) + Desktop prod bundle (embedded server reports 1.18.21, channel prod)
  • Beta generation: opencode2 v0.0.0-beta-17823 (CLI) + Desktop beta bundle (ai.opencode.desktop.beta, bundled opencode-cli also v0.0.0-beta-17823)

Observed behavior

All generations write to the same opencode.db, but they use different session tables:

Writer Table
stable CLI / desktop-prod embedded server session
beta CLI / desktop-beta opencode-cli session_v2

The beta performs a one-time copy of existing session rows into session_v2, stamped in kv as migration.v1-v2 = {"phase":"completed"}. In my case it copied 73/106 rows.

Consequences observed:

  1. Sessions created in stable after the stamp never appear in the beta (33 stranded rows in my DB).
  2. Sessions created in the beta are invisible to stable CLI and to the desktop-prod embedded server (the prod bundle contains zero references to session_v2) — 41 such rows in my DB.
  3. Nothing warns the user; each surface just shows a different session list against what looks like one workspace history.

Expected behavior

Either:

  • Continuous (or lazy/read-through) migration, so session rows created after the one-shot stamp flow into session_v2; and/or
  • Older readers fall back to reading session_v2 (union view) so beta-created sessions are visible; or
  • Per-channel database files by default (like the existing non-standard-channel opencode-<channel>.db path) plus a clear warning when a second generation opens an existing data dir.

Repro

  1. Use stable CLI/desktop to create sessions in ~/.local/share/opencode.
  2. Install/run the beta channel (opencode2 / OpenCode Beta desktop). First run migrates a snapshot into session_v2.
  3. Create more sessions in stable → they never appear in beta. Create sessions in beta → they never appear in stable/prod-desktop.

Data

DB snapshot at time of writing: session = 106 rows, session_v2 = 112 (73 migrated + 41 beta-native; overlap 73).


Drafted from a live-machine audit; happy to provide anonymized schema dumps if useful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.