fix: normalize nested usage details - #16
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 12, 2026, 11:07 AM ET / 15:07 UTC. Summary Reproducibility: yes. from source inspection, though it was not executed locally during this read-only review. Current main has no nested-detail lookup, and the contributor’s exact-head built-package output demonstrates the observable gap and corrected result. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the additive provider-agnostic normalization and aggregation behavior while keeping cached-token pricing as a separate future concern. Do we have a high-confidence way to reproduce the issue? Yes from source inspection, though it was not executed locally during this read-only review. Current main has no nested-detail lookup, and the contributor’s exact-head built-package output demonstrates the observable gap and corrected result. Is this the best way to solve the issue? Yes. Extending the existing best-effort alias normalizer and established tally accumulator is narrower and more maintainable than introducing provider-specific parsing or coupling metadata collection to cached-token pricing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d2a54bb78442. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Added runtime proof for exact head Validation:
Built-library invocation: Output: {
"chatCompletions": {
"inputTokens": 100,
"outputTokens": 20,
"cachedInputTokens": 40,
"reasoningTokens": 7,
"totalTokens": 120
},
"responses": {
"inputTokens": 150,
"outputTokens": 30,
"cachedInputTokens": 25,
"reasoningTokens": 12,
"totalTokens": 180
},
"demoModelUsage": {
"inputTokens": 250,
"outputTokens": 50,
"cachedInputTokens": 65,
"reasoningTokens": 19,
"totalTokens": 300
}
}This shows the built @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
cachedInputTokensthroughtallyCosts()aggregation when providers expose it.Validation
pnpm test— 5 files / 21 tests passedpnpm typecheck— passedpnpm lint— passedpnpm check— passed with coveragegit diff --check— passedNotes
This keeps existing pricing behavior unchanged.
cachedInputTokensis exposed as normalized usage metadata; discounted cached-input billing can stay a separate pricing feature if/when the library adds provider-specific cached-token pricing.