It says 1.6 billion used — usage statistics spiking - Codex
Quick fix
Upgrade cc-switch to v3.18.0 to fix the sub-agent history replay double-count bug; it rebuilds the polluted Codex usage data automatically.
Symptom
Section titled “Symptom”结果显示用了16亿。模型由5.6 sol切换为5.6terra开始执行任务,然后触发压缩上下文,用量统计那里从16亿肉眼可见的飙升到19亿It says 1.6 billion used. I switched the model from 5.6 sol to 5.6 terra and started the task, then context compaction triggered, and the usage statistics visibly spiked from 1.6 billion to 1.9 billion.
In v3.17.0, the Codex session parser recognises the sub-agent history replay boundary too early. When a long task or context compaction makes a sub-agent rollout copy several turns of parent thread history, the parser returns as soon as it hits the first thread_settings_applied — so token_count values from the parent history are written to the database again under the new sub-thread request ID, double-counting tokens into the billions. The cluster also holds other usage anomaly variants: the claude-mem plugin quietly burning Claude Code quota in the background (unrelated to cc-switch); the v10 database migration losing old aggregate rows; and file mtime not updating on Windows leaving sync stuck at deferred.
Upgrade cc-switch to v3.18.0 or newer.
Restart the app: it backs up and rebuilds the polluted Codex usage data automatically, and the dashboard numbers gradually settle back to the real values.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 5 real issues
- Is cc-switch responsible for the Claude Code model quietly burning quota in the background?
- No. That usually relates to data sync requests from third-party Claude plugins such as claude-mem — investigate or disable the plugin.
- After upgrading to a version with the v10 migration, billions of tokens vanished from my Codex history statistics. What now?
- The migration rebuild discarded old aggregate rows whose detail had already been compacted. You can export and restore the usage_daily_rollups table by hand from an automatic backup database under ~/.cc-switch/ (db_backup_*.db).
- Codex usage sync keeps importing 0 records and stays deferred. What now?
- That is a bug where session file mtime does not update on Windows, so the syncer skips a file being written. Wait for a later version containing the last_size double-check fix (PR #6027).
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.