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.
What happened?
The opencode adapter accepts
--since/--untilat the CLI but ignores them in the loader. The SQLite query has noWHEREclause and thestorage/message/*.jsonloop reads every file. On my install (largeopencode.db, a lot of legacy JSON files from before the SQLite migration)ccusage opencodenever returns; even bareccusagegets stuck on the OpenCode loader step.Steps to reproduce
ccusage opencode --since 2026-05-04 --until 2026-05-10 # never returnsA raw
sqlite3query withWHERE time_created BETWEEN ? AND ?against the same DB returns immediately. Themessagetable already has atime_createdindex.Expected behavior
With
--since/--untilset, 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.