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
Trace: define cache accounting and prevent token overcounting across providers #3706
Chainloop Trace reports inflated token usage and estimated cost for a Codex session. Review cache reporting and token accounting across all supported providers. Define and test the rules so this error cannot recur.
The response sums match the final token_usage_record.thread_token_usage counters. Replaying the current parser reproduces the reported numbers exactly, with 147 reset warnings.
The Codex parser consumes two cumulative streams: token_usage_record.thread_token_usage and event_msg.token_count.info.total_token_usage. They diverge after compaction in this transcript. Lower snapshots trigger the reset branch, which adds entire cumulative totals again. The artifact's $900.8926 cost estimate also uses inflated counts. It does not establish billed spend.
Scope and acceptance criteria
Decide whether cache usage belongs in the reported total, separate metrics, or both. Document the decision and metric names.
Audit Codex, Claude, Cursor, Pi, and OpenCode. Record whether input includes cache reads or writes, and whether output includes reasoning tokens.
Encode each provider's semantics in parsing and normalization. Count cache and reasoning subsets only once.
Define how to handle duplicate events, multiple usage streams, cumulative counters, per-response usage, compaction, resets, and resumed sessions.
Add regression fixtures and assertions for those cases. The supplied artifact must produce the response totals above, without false reset warnings.
Verify cost calculations use the same normalized counts and each provider's cache semantics.
Document any required evidence-schema or display changes, including the treatment of existing inflated records.
Activity