anomalyco / anomalyco/opencode

Desktop: session row silently deleted from opencode.db after app restart (no deletion event, data recoverable from event log)

Open
#47,509 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 5, 2026.

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

Description

Description

A session with ~90 messages vanished from the session list after an app restart. ~2.5 h of active work.

What I found in ~/.local/share/opencode/opencode.db (read-only queries):

  • the session row is gone: 207 session.created.1 events vs 206 rows in the session table
  • the event table has no deletion event type at all (only session.created / session.updated / message.updated / message.part.updated / message.removed), so a deletion leaves no audit trail
  • all 787 events of that session are still present, so the full conversation (messages, tool calls, per-message cost) is recoverable from the event log

Context that may matter:

  • Desktop app 1.18.5, macOS 15.6, arm64; the session had already survived 4 app restarts earlier the same day
  • it disappeared at the 5th restart, ~30 s after the last assistant message, which was still streaming when the app was quit
  • the auto-updater was in ready state (1.18.29 downloaded) at that moment
  • a CLI instance was running concurrently against the same DB

I rebuilt the whole conversation from the event log (last message.part.updated.1 per part id, grouped by messageID, ordered by info.time.created), so nothing was ultimately lost, but from the user's perspective the session silently vanished with no error and no recovery path.

Suggestions: log a session.deleted event (user / cleanup / migration), and consider a startup reconciliation that restores rows for any session.created id missing from the session table.

Plugins

No response

OpenCode version

1.18.5 (Desktop app, macOS arm64)

Steps to reproduce

Not fully deterministic, best guess:

  1. In the Desktop app, work in a session until an assistant message is streaming
  2. Quit the app while the message is still in flight
  3. Reopen: the session is gone from the list; its row is deleted from the session table while all its events remain in the event table
Screenshot and/or share link

No response

Operating System

macOS 15.6

Terminal

n/a (Desktop app)

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.