opencode session store migration to session_v2 breaks opencode-session ingest #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
opencode v2.0.24 migrated its session store on 2026-11-01 21:01:20 UTC. Session data now lives in
session_v2+session_message; the tables knox reads (session,message,part) are no longer written to. The ingest does not error — it silently reports0 newforever.Evidence
logged every ~90s while a live session existed.
session/message/partsession_v2/session_messagesession_v2, 0 insession. Sessions updated since: 1 in v2, 0 insession. No dual-write.~/.local/share/knox/index.dbhas 965opencode-sessionentries, newest 2026-11-01 = the last pre-migration session.Schema change
Impact
loadOCSessions,loadOCTranscripts,loadOCPartCountsall read the frozen tables.Fix
session_v2/session_message, reconstructing text fromdata.text(user/system/synthetic) anddata.content[].text(assistant), ordered bytime_created, seq.<system-reminder>text: reminders are now stored assyntheticmessages and would consume the 4000-byte summary budget.IngesterVersiontoopencode-db/v2.watch.goskips any entry whoseCreatedAtmatches, so a fixed adapter would not refresh old entries or resumed sessions. Replace that shortcut with an extent/content comparison.Acceptance criteria
go test ./internal/ingest/covers both message shapes against a temp SQLite DB.opencode.db: N newwith N >= 1 after restart.knox search.