Skip to content

Fix session token totals and breakdown - #9

Merged
SmartAI merged 1 commit into
mainfrom
fix/session-metrics
Sep 11, 2026
Merged

SmartAI merged 1 commit into
mainfrom
fix/session-metrics

Conversation

@SmartAI

@SmartAI SmartAI commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Changes

  • Include separately recorded reasoning tokens in output and total usage without double-counting Anthropic output.
  • Show exact token counts so the breakdown adds up to the total card.
  • Distinguish unreported cache writes from explicitly reported zero; show reporting coverage for partial data.
  • Rebuild stale daily aggregates without replaying logs and normalize reports from older remote backends.
  • Document the accounting rules and add provider-to-log-to-analytics regression coverage.

Verification

  • Reproduced the reasoning-token undercount in the desktop flow before the fix.
  • 82 tests passed across analytics, provider adapters, Codex, web routes, and desktop integration, including the million-event benchmark.
  • Three follow-up desktop checks passed, including the analytics flow.
  • Ruff, focused mypy checks, and git diff --check passed. Fixed one existing quick-chat type annotation exposed by mypy.

Provider fixtures cover Anthropic, OpenAI, Codex, DeepSeek, and custom/local protocol variants, including reasoning, caching, missing/partial usage, and repeated attempts. These are controlled fixtures, not live billing reconciliation for every model.

@SmartAI
SmartAI merged commit 0cd1789 into main Sep 11, 2026
1 check passed
@SmartAI
SmartAI deleted the fix/session-metrics branch September 26, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant