fix: deduplicate proxy request logs and UUID fallback#2085
fix: deduplicate proxy request logs and UUID fallback#2085orangedy wants to merge 1 commit intofarion1231:mainfrom
Conversation
- Allow parser to return usage with 0 tokens if message_id is present to avoid UUID generation - Update existing zero-usage proxy records with actual token counts from session sync
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0200cdbb5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input_tokens = ?1, output_tokens = ?2, cache_read_tokens = ?3, cache_creation_tokens = ?4, | ||
| input_cost_usd = ?5, output_cost_usd = ?6, cache_read_cost_usd = ?7, cache_creation_cost_usd = ?8, total_cost_usd = ?9 | ||
| WHERE request_id = ?10", |
There was a problem hiding this comment.
Apply stored multiplier when backfilling proxy costs
The new update path rewrites input_cost_usd/output_cost_usd/total_cost_usd for existing proxy rows, but those values are computed earlier in this function with a hardcoded Decimal::from(1) and the row’s existing cost_multiplier is neither read nor updated. When a provider uses a non-1.0 multiplier and a zero-usage placeholder row is later backfilled, this underreports costs while leaving cost_multiplier unchanged, creating inconsistent and incorrect billing/usage totals.
Useful? React with 👍 / 👎.
Summary / 概述
Related Issue / 关联 Issue
Fixes #
Screenshots / 截图
Checklist / 检查清单
pnpm typecheckpasses / 通过 TypeScript 类型检查pnpm format:checkpasses / 通过代码格式检查cargo clippypasses (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)