Repository navigation
Commit f80c972
docs(adapter/copilot): reconcile per-process-snapshot summing vs credit-content-dedup designs
External PR ccusage#1209 code review (10th pass, only actionable item)
flagged that token-bearing rows and credit-only rows encode opposite
beliefs about duplicate shutdowns: token rows trust event ids
(distinct events = distinct charges, sum them), while credit-only
rows distrust event ids (distinct events with same naiu = same
snapshot, collapse them). Reviewer asked for a doc reconciliation
explaining why the asymmetry is deliberate.
Replace the brief 'Resumed sessions' section with a longer
'Resumed sessions and dedup-key design' section that:
- Names the two key shapes explicitly (`shutdown:{session_id}:{event_id}:{model}`
vs `credit-shutdown:{session_id}:{model}:{naiu}`).
- Documents WHY token rows trust event ids: per-process snapshots
commonly produce near-identical counts when a user resumes a
similar workload; event-id keying prevents silent under-count.
- Documents WHY credit-only rows distrust event ids: real-data
ships them in paired snapshots with distinct event ids but
identical naiu (1135875b-… / 76dc438a-… pattern; ~$2.65 of
credits would be double-billed in the local corpus by event-id
keying).
- Names the matching pinning tests for both paths so a future
reader has the contracts at hand.
- Calls out the residual risk: if a future Copilot CLI ships
GENUINE non-coincidental duplicate event ids on credit-only
rows, the over-suppression would surface as a visible under-bill
in `credits` JSON output (the soft signal) rather than silently
doubling the bill.
Also explains the synthetic aggregate-credit key
(`credit-aggregate:{session_id}:{nano_aiu}`) mirrors the same
content-based 'paired snapshot' semantics for consistency.
No code change — pure design-rationale documentation.
Co-authored-by: Copilot <[email protected]>1 parent c5f7afd commit f80c972
1 file changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
89 | 133 | | |
90 | 134 | | |
91 | 135 | | |
| |||
0 commit comments