anomalyco / anomalyco/opencode
Mixed stable/beta channels sharing one data dir silently split sessions across `session` and `session_v2`
@kitlangton is already working on this.
Since Aug 22, 2026.
- 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, bundledopencode-clialso 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:
- Sessions created in stable after the stamp never appear in the beta (33 stranded rows in my DB).
- 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. - 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
sessionrows created after the one-shot stamp flow intosession_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>.dbpath) plus a clear warning when a second generation opens an existing data dir.
Repro
- Use stable CLI/desktop to create sessions in
~/.local/share/opencode. - Install/run the beta channel (
opencode2/ OpenCode Beta desktop). First run migrates a snapshot intosession_v2. - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.