You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copilot: usage missing when modelMetrics doesn't cover the whole session #1823
ccusage copilot daily shows about 38% of what GitHub bills me for Oct 1–3 (UTC), comparing its cost with the AI credits on my Copilot usage page at $0.01 each.
The adapter only reads modelMetrics from session.shutdown. That breakdown only covers the running Copilot process, while the session-wide totalNanoAiu on every shutdown and on session.usage_checkpoint events has the whole session:
A session resumed after the app or its process died shuts down with an empty or partial modelMetrics, for example a non-zero totalNanoAiu next to "modelMetrics": {}.
Sessions that are still open, or were killed without a shutdown, only have checkpoints, so they don't show up at all.
Summing the session totals from my local logs gives about 97% of the billed credits.
Steps to reproduce
Use Copilot CLI 1.0.90 or the Copilot app and resume a session after the app restarted, or keep a session open.
On a session.shutdown event, compare data.totalNanoAiu with the sum of data.modelMetrics[*].totalNanoAiu.
Compare ccusage copilot daily --since <date> with the Copilot usage page.
Expected behavior
Credits in totalNanoAiu that modelMetrics doesn't account for still count toward cost. The tokens behind them can't be recovered, but the cost can (1 AIU = 1 AI credit = $0.01).
Pullfrog triage: priority:high
Kind: bug
Maintenance fit: maintainable
Confidence: high
Copilot adapter reports only part of billed credits because modelMetrics can be empty or partial while totalNanoAiu holds the session total, plus checkpoints are ignored. This is a material cost undercount with quantified evidence, squarely within core usage reporting.
Decision: kept open; Pullfrog will attempt a focused implementation PR.
Two things I ran into while testing the fix against my own logs, in case the implementation doesn't take them over from the branch:
Sessions without session.usage_checkpoint events come from older Copilot versions that restart both totalNanoAiu and the per-model metrics on every resume. In my logs, 22 of 32 such sessions have per-model counters that go down between shutdowns, against 0 of 24 sessions with checkpoints. Applying the gap logic to them overcounted June by more than the raw totals add up to, so the branch skips sessions without checkpoints.
A shutdown can carry a breakdown that lags behind the session total, and the next shutdown catches up. One session went from totalNanoAiu 452.1 AIU with modelMetrics at 249.2 AIU to 452.1 / 452.1 twenty minutes later. Taking the gap per shutdown counts those ~203 credits twice: once as unexplained, and again as tokens at the next shutdown. The branch only reports what stays unexplained at every later snapshot.
Both have a test on the branch: leaves_sessions_without_checkpoints_unchanged and does_not_count_credits_that_a_later_shutdown_attributes.
Activity
pullfrog commentedon Oct 3, 2026
github-actions commentedon Oct 3, 2026
Pullfrog triage: priority:high
Kind: bug
Maintenance fit: maintainable
Confidence: high
Copilot adapter reports only part of billed credits because modelMetrics can be empty or partial while totalNanoAiu holds the session total, plus checkpoints are ignored. This is a material cost undercount with quantified evidence, squarely within core usage reporting.
Decision: kept open; Pullfrog will attempt a focused implementation PR.
erwindamsma commentedon Oct 3, 2026
Two things I ran into while testing the fix against my own logs, in case the implementation doesn't take them over from the branch:
Sessions without
session.usage_checkpointevents come from older Copilot versions that restart bothtotalNanoAiuand the per-model metrics on every resume. In my logs, 22 of 32 such sessions have per-model counters that go down between shutdowns, against 0 of 24 sessions with checkpoints. Applying the gap logic to them overcounted June by more than the raw totals add up to, so the branch skips sessions without checkpoints.A shutdown can carry a breakdown that lags behind the session total, and the next shutdown catches up. One session went from
totalNanoAiu452.1 AIU withmodelMetricsat 249.2 AIU to 452.1 / 452.1 twenty minutes later. Taking the gap per shutdown counts those ~203 credits twice: once as unexplained, and again as tokens at the next shutdown. The branch only reports what stays unexplained at every later snapshot.Both have a test on the branch:
leaves_sessions_without_checkpoints_unchangedanddoes_not_count_credits_that_a_later_shutdown_attributes.fix(copilot): report session credits missing from modelMetrics (ccusa…