Skip to content

fix(cost): prefer authoritative batch item usage - #1065

Open
seonghobae wants to merge 1 commit into
mainfrom
codex/commercial-loop-20260905-issue1016
Open

fix(cost): prefer authoritative batch item usage#1065
seonghobae wants to merge 1 commit into
mainfrom
codex/commercial-loop-20260905-issue1016

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • prefer authoritative batch-item usage when trace or race bookkeeping exists but carries no provider usage
  • keep per-step accounting unchanged when any billable step reports usage
  • add a regression covering both trace and race_usage paths

Testing

  • uv run pytest tests/test_cost_router.py -k 'batch_item_usage_wins_when_trace_and_race_steps_lack_usage or batch_completion_records_on_retrieve or invalid_batch_usage or provider_confirmed_zero_usage_stays_measured_and_price_known' -q
  • uv run pytest tests/test_cost_router.py tests/test_cost_router_boundaries.py -q

Closes #1018

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 91f63070-8c70-4452-a0a8-2e6c2821f445

📥 Commits

Reviewing files that changed from the base of the PR and between 2e414d1 and 9158a7c.

📒 Files selected for processing (2)
  • contextual_orchestrator/cost_router.py
  • tests/test_cost_router.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@opencode-agent

opencode-agent Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Scheduled review-feedback autofix for this PR head.

  • Head SHA: 9158a7c2ceb5812faef3d3c659d8cf4f3c0ed7c1

@seonghobae seonghobae added bug Something isn't working priority: high status: needs-review Open pull request requiring current-head review or checks type: bug Defect or incorrect behavior labels Sep 7, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: high status: needs-review Open pull request requiring current-head review or checks type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cost): batch usage 우선순위 정책 정의 및 회귀 방지

1 participant