Skip to content

Commit dbbdd79

Browse files
committed
fix(all): keep cost-only rows in unified reports
Copilot credit gaps are reported as zero-token rows with a cost, so dropping every zero-token summary hid them from unified daily and monthly reports while focused reports and session still showed them.
1 parent 81d5953 commit dbbdd79

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎rust/crates/ccusage-adapter-all/src/loader.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,8 @@ fn summary_rows(
783783
.or(summary.session_id.as_ref())?
784784
.clone();
785785
let total_tokens = summary.total_tokens();
786-
if total_tokens == 0 {
786+
// Cost-only rows, such as Copilot credits missing from modelMetrics, still bill.
787+
if total_tokens == 0 && summary.total_cost == 0.0 {
787788
return None;
788789
}
789790
let metadata = summary_metadata(&summary, include_project_path);

‎rust/crates/ccusage/tests/snapshots/copilot_cli__unified_monthly_and_session_json.snap‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Monthly JSON
4747
{
4848
"cacheCreationTokens": 0,
4949
"cacheReadTokens": 0,
50-
"cost": 0.06,
50+
"cost": 0.08,
5151
"inputTokens": 0,
5252
"modelName": "unknown",
5353
"outputTokens": 0
@@ -67,7 +67,7 @@ Monthly JSON
6767
],
6868
"outputTokens": 48,
6969
"period": "2026-02",
70-
"totalCost": 0.061049374999999996,
70+
"totalCost": 0.08104937499999999,
7171
"totalTokens": 185
7272
}
7373
],
@@ -76,7 +76,7 @@ Monthly JSON
7676
"cacheReadTokens": 30,
7777
"inputTokens": 275,
7878
"outputTokens": 142,
79-
"totalCost": 0.064411875,
79+
"totalCost": 0.084411875,
8080
"totalTokens": 492
8181
}
8282
}

‎rust/crates/ccusage/tests/snapshots/copilot_cli__unified_monthly_and_session_table.snap‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ Monthly
1212
│ │ - GitHub │ - opus-4.6 │ 163 │ 94 │ 30 │ 20 │ 307 │ $0.00 │
1313
│ │ Copilot CLI │ │ │ │ │ │ │ │
1414
├──────────┼───────────────┼───────────────┼───────────┼───────────┼────────────┼────────────┼────────────┼────────────┤
15-
│ 2026-02 │ All │ │ 112 │ 48 │ 15 │ 10 │ 185 │ $0.06 │
15+
│ 2026-02 │ All │ │ 112 │ 48 │ 15 │ 10 │ 185 │ $0.08 │
1616
├──────────┼───────────────┼───────────────┼───────────┼───────────┼────────────┼────────────┼────────────┼────────────┤
17-
│ │ - GitHub │ - gpt-5.4 │ 112 │ 48 │ 15 │ 10 │ 185 │ $0.06 │
17+
│ │ - GitHub │ - gpt-5.4 │ 112 │ 48 │ 15 │ 10 │ 185 │ $0.08 │
1818
│ │ Copilot CLI │ - unknown │ │ │ │ │ │ │
1919
├──────────┼───────────────┼───────────────┼───────────┼───────────┼────────────┼────────────┼────────────┼────────────┤
20-
│ Total │ │ │ 275 │ 142 │ 45 │ 30 │ 492 │ $0.06 │
20+
│ Total │ │ │ 275 │ 142 │ 45 │ 30 │ 492 │ $0.08 │
2121
└──────────┴───────────────┴───────────────┴───────────┴───────────┴────────────┴────────────┴────────────┴────────────┘
2222

2323

0 commit comments

Comments
 (0)