codex-usage v2.6.3
修复 v2.6.0–v2.6.2 在历史重扫中可能大幅多计 Token 的累计范围回归。
- 逐个 Turn 核对累计边界:一次重置不再使后续所有 Turn 都从零计数;连续累计和新 Turn 重发的旧快照均保留正确基线。
100/100 → 20/20 → 50/30(累计值/本次增量)现在合计 150,修复旧版算成 170 的问题。 - 跨扫描一致性:即使记录没有新增 Token,也保存其累计解释,避免下一次扫描重新继承旧范围;分类修正仍回到原有事件。
- 明确不确定边界:重置后若缺少快照,无法区分连续累计与再次重置,保守按差值计量并提示可能缺少用量,不再仅凭旧范围推断。
- 旧账修复提示:schema v9 的现有统计升级到 v10 后保留事件和游标、立即显示核对提示并暂停增量扫描,等待显式重建。空数据库无需修复;从 v2.5.0 直接升级保留原有迁移行为。
- 更新中英文 README、重建对话框和计量技术说明,保留 v2.6.2 的更新包下载目录设置。
升级后修正历史: 先备份并确认源 JSONL 仍齐全,再在 Dashboard 点击“重新扫描 → 同意并重建”,或运行 codex-usage scan --rebuild。仅更新程序不会自动消除已入库的多计记录;已删除源文件的历史无法通过重建恢复。
验证: 固定同一时点的 766 个 rollout,提取计量所需的数值、metadata 和 Turn 边界后在隔离目录重建;742 个有用量会话与逐会话参考值完全匹配,总量由 19,646,071,899 修正到 14,941,760,325,消除 23 个会话的 4,704,311,574 重复 Token。独立核对覆盖了变化会话的原始记录,未变化会话沿用快照参考值;这不是所有历史的独立审计或账单验证。再次扫描新增事件为 0,总量不变。
回归覆盖真实数值向量、混合累计、重复快照、分类修正、扫描重启、缺失快照、旧库保留和 API 确认重建。完整平台及 Dashboard 检查通过后发布六个平台程序与 SHA256SUMS。
Fix a counter-scope regression in v2.6.0–v2.6.2 that could substantially overcount tokens during historical rescans.
- Evaluate each turn boundary independently. One reset no longer causes every later turn to count the entire cumulative total again. Continuations and repeated old snapshots retain their baseline. The
total/lastsequence100/100 → 20/20 → 50/30now correctly totals 150 instead of 170. - Persist the interpretation of duplicate snapshots across scans and keep classification corrections attached to the original usage.
- Mark incomplete boundary evidence conservatively instead of inferring another reset from an earlier one.
- Migrate schema v9 to v10 without deleting history. Existing JSONL ledgers immediately show a rebuild notice and pause incremental ingestion until an explicit rebuild. Empty stores need no repair; direct v2.5.0 upgrades retain the earlier migration behavior.
- Update both READMEs, the rebuild dialog, and accounting documentation. Retain v2.6.2 download-directory settings.
Repair stored history after upgrading: back up and verify retained JSONL coverage, then choose Rescan → Approve and rebuild or run codex-usage scan --rebuild. Updating the binary alone does not fix stored overcounts, and rebuilding cannot recover deleted source files.
Validation: an isolated rebuild of accounting-only projections from 766 frozen rollouts matched reference totals for all 742 sessions with usage. The total changed from 19,646,071,899 to 14,941,760,325, removing 4,704,311,574 repeated tokens across 23 sessions. Changed sessions were independently reconciled against their source records; unchanged sessions retained snapshot reference totals. This is not an independent audit of all history or a billing reconciliation. A repeated scan inserted zero events and left totals unchanged. Regression coverage includes mixed counters, duplicate snapshots, corrections, restarts, missing evidence, migration preservation, and the API approval flow.