OpenCode V2 Usage Collection Stops Updating
Quick fix
Upgrade CC Switch to a version containing the PR #7541 fix so the collector reads OpenCode V2 tables.
Symptom
Section titled “Symptom”升级后新产生的 OpenCode 会话用量继续被采集。After upgrading, usage from newly created OpenCode sessions continues to be collected.
The collector in CC Switch 3.20.3 queries only the OpenCode V1 `session`, `message`, and `part` tables. After migration to OpenCode V2, it uses `session_v2` and `session_message`; the old tables are no longer updated or may not exist, so the collector cannot import new usage. On macOS, the scanned session count remains at its old value and `[OPENCODE-SYNC]` logs disappear. On Windows, `no such table: message` and synchronization errors were also reproduced.
Upgrade to a version of CC Switch that includes the PR #7541 fix. The fix detects the database layout and reads the V2 tables when present, while continuing to read V1 if migration has not occurred. The issue does not specify a fixed version number.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Why does usage tracking stop at the pre-upgrade amount after upgrading to OpenCode V2?
- OpenCode V2 uses `session_v2` and `session_message`, while the collector in CC Switch 3.20.3 still reads V1 tables, so usage from new sessions cannot be imported.
- What causes `no such table: message` on Windows?
- After migration to OpenCode V2, the database may no longer contain the `message` table; the collector in CC Switch 3.20.3 still queries that V1 table.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.