Repository navigation
Read OpenCode 2.x sessions - #27
Merged
Merged
Conversation
OpenCode 2.x keeps sessions in session_v2 and transcripts in session_message, so catchup found no sessions after the upgrade. When session_v2 exists, list, resolve, and read from the 2.x tables, which OpenCode's startup migration fills with every legacy session; older databases keep the legacy path. In 2.x transcripts, injected synthetic and system rows no longer appear as user turns, and a completed compaction carries its summary. A session without a title no longer fails the listing. Fixes #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCode 2.x moved sessions into
session_v2and their transcripts intosession_message, so catchup found no sessions on 2.x databases. catchup now reads those tables whensession_v2exists and keeps the legacysession/message/partpath for 1.x databases. Listing,--id,-q, reading and--since-compactwork on both.On 2.x, user rows and assistant text form the timeline, a tool item with
state.statuserror becomes a failure entry, and a completed compaction row becomes a compaction marker carrying its summary. Synthetic and system rows are injected context and stay off the timeline.Verified against @opencode/cli 2.1.4: fresh sessions, a 1.19.4 database migrated by 2.1.4, and a 291-session database written by the 2.x beta and migrated by 2.1.4. Every session reads without errors or unknown-type warnings. The test fixtures follow those real row shapes, and the list/read/query tests run over both layouts.
Runtime +203/-21, tests +82/-29, docs none.
Fixes #26. Thanks @jiz4oh for the report and the schema details that pinned this down.