@@ -104,36 +104,23 @@ shutdown means** — because real-data shapes differ between the two paths:
104104 ` treats_resumed_session_shutdowns_as_distinct_entries ` .
105105- ** Credit-only zero-token rows** key on
106106 ` credit-shutdown:{session_id}:{model}:{naiu} ` — ** deliberately omitting
107- ` event_id ` ** . Real session-state data ships credit-only rows in
108- duplicate pairs with distinct event ids but identical ` totalNanoAiu `
109- values (observed pattern in ` 1135875b-… ` and ` 76dc438a-… ` ; the local
110- 200-file corpus shows roughly $2.65 of credits would be double-counted
111- by event-id-based keying). Two such rows are treated as duplicates of
112- the same snapshot, not distinct charges. Pinned by
107+ ` event_id ` ** . The loader's ` HashMap::insert ` collapse is last-wins, so
108+ duplicate AIU snapshots with identical ` totalNanoAiu ` collapse instead of
109+ double-counting. Pinned by
113110 ` auto_mode_dedupes_duplicate_credit_only_rows_within_same_session ` and
114111 ` credit_only_rows_with_identical_naiu_but_distinct_event_ids_are_treated_as_duplicates ` .
115112
116113** The asymmetry is intentional.** Token rows trust event ids because their
117114data shape (per-process snapshots) makes coincidence-collision a far more
118115likely failure mode than missed-duplicate. Credit-only rows distrust event
119- ids because their data shape (paired snapshots) makes the opposite true.
120- Both choices accept a small known under/over-count risk in the unlikely
121- forward-compat case (token counts coincidentally identical across resumes;
122- or distinct genuine credit charges that happen to share the same naiu) in
123- exchange for correctness on the observed real-data shape.
116+ ids because paired snapshots make the opposite true.
124117
125118The aggregate-credit synthetic entry (emitted only when no per-model row
126119carries a priced billing signal — see ` parse_session_state_file ` 's
127120suppression guard) uses the same content-based key family
128121(` credit-aggregate:{session_id}:{nano_aiu} ` ) to mirror the credit-only
129122"paired snapshot" semantics.
130123
131- If a future Copilot CLI ships genuine non-coincidental duplicate event ids
132- on credit-only rows, the over-suppression would surface as a visible
133- under-bill in ` credits ` JSON output (which is always populated regardless
134- of mode) — a soft signal that surfaces the schema change rather than
135- silently doubling the bill.
136-
137124### Date filter must run before dedup
138125
139126The credit-only key shape above (which deliberately omits ` event_id ` ) makes
0 commit comments