Skip to content

Sessions present in opencode.db but missing from opencode-stable.db, making them invisible in TUI sidebar #21059

Closed

Description

@14NGiestas

Describe the bug

Active sessions are stored in opencode.db but are not synchronized to opencode-stable.db. The TUI sidebar appears to read from the stable database, so sessions that exist in the main DB become invisible even though they are fully intact and can be opened via opencode -s <session-id>.

Affected databases

File Size Role
opencode.db 44 MB Main active database (WAL mode)
opencode-stable.db 208 KB Stable snapshot copy

Steps to reproduce

  1. Use opencode normally for multiple sessions
  2. Exit and reopen opencode
  3. Observe that some recent sessions are missing from the sidebar
  4. Verify the session still exists in opencode.db:
python3 -c "
import sqlite3
conn = sqlite3.connect('opencode.db')
c = conn.cursor()
c.execute('SELECT id, title, time_created FROM session ORDER BY time_created DESC LIMIT 10')
for row in c.fetchall():
    from datetime import datetime
    print(f'{row[0]} | {row[1]} | {datetime.fromtimestamp(row[2]/1000).isoformat()}')
"
  1. Verify the same session is NOT in opencode-stable.db
  2. Session can still be opened directly: opencode -s <session-id>

Session evidence

  • Session ID: ses_2a7574f8bffe5nU27s1zL3p74y
  • Title: Verificação de código e testes simples
  • Present in opencode.db: YES (created 2026-04-04T10:22, updated 2026-04-04T20:02)
  • Present in opencode-stable.db: NO
  • Storage files intact

Expected behavior

All sessions should be visible in the TUI sidebar. The stable database should either be kept in sync with the main database, or the sidebar should read from the main database.

System metadata

  • opencode version: 1.3.x (nixpkgs, via home-manager)
  • OS: Linux Mint (Nix standalone)

Additional context

The opencode-stable.db is only 208 KB while the main opencode.db is 44 MB, suggesting many sessions are missing from the stable copy. This may be related to the sync mechanism that creates the stable snapshot.

Activity

  1. github-actions commented on Apr 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specifically about the opencode-stable.db snapshot being out of sync (rather than the session-list query filtering), it may be a distinct root cause worth keeping open — but please review the above first to avoid duplicated effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions