Skip to content

ccusage opencode hangs on long-lived installs because --since/--until are ignored #1189

@justi

Description

@justi

What happened?

The opencode adapter accepts --since / --until at the CLI but ignores them in the loader. The SQLite query has no WHERE clause and the storage/message/*.json loop reads every file. On my install (large opencode.db, a lot of legacy JSON files from before the SQLite migration) ccusage opencode never returns; even bare ccusage gets stuck on the OpenCode loader step.

Steps to reproduce

ccusage opencode --since 2026-05-04 --until 2026-05-10
# never returns

A raw sqlite3 query with WHERE time_created BETWEEN ? AND ? against the same DB returns immediately. The message table already has a time_created index.

Expected behavior

With --since / --until set, the loader should only look at rows/files in that range and return in seconds.

Version

20.0.6

I have a patch + tests ready (it was auto-closed at #1188). Happy to wait for an OK before resubmitting it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions