Skip to content

fix: deduplicate proxy request logs and UUID fallback#2085

Open
orangedy wants to merge 1 commit intofarion1231:mainfrom
orangedy:fix/proxy-request-logs-duplicate
Open

fix: deduplicate proxy request logs and UUID fallback#2085
orangedy wants to merge 1 commit intofarion1231:mainfrom
orangedy:fix/proxy-request-logs-duplicate

Conversation

@orangedy
Copy link
Copy Markdown

  • 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

Summary / 概述

Related Issue / 关联 Issue

Fixes #

Screenshots / 截图

Before / 修改前 After / 修改后

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

- 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
@yovinchen
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +423 to +425
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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants