Skip to content

fix(catalog): account for auxiliary model charges - #4993

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:agent/catalog-aux-charges-20260918
Sep 18, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:agent/catalog-aux-charges-20260918

Conversation

@luvs01

@luvs01 luvs01 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Discovered pricing classification in discoveredPricingStatus only inspected the prompt/input and completion/output pair, so a model whose token rates are zero but that publishes a positive auxiliary charge (request, image, web_search, ...) could classify as free and appear under a free-only filter.
  • The classifier now scans every published component of the provider pricing object through discoveredPricingRate: any positive numeric rate is paid, any unusable component is unknown, and free still requires the complete zero prompt/completion pair.
  • Regression tests cover a positive per-request auxiliary charge, fully-zero auxiliary dimensions, and unsupported/malformed auxiliary pricing shapes.

Verification

  • Head: 8694d6cc6e6b791d720a0d0d20ffbe927138ccf3 (tree 0e72c21e033f4fc14742c73dc33608170378d395), based on dev ad9eab393b1125ca7bdfa3e83ed4fa0e0b0475e9.
  • bun test tests/codex-integration/catalog-free-pricing-status.test.ts - 13 pass / 0 fail, including the two new auxiliary-charge cases.
  • bun x tsc --noEmit - clean.
  • bun run structure:check - passed.
  • bun run privacy:scan - passed.
  • bun scripts/file-size-ratchet.ts - passed.

Remaining gates

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
  • All CI tests are green on my local testing. Local gates passed (see Verification); fork run 35289987101 dispatched on the exact head.
  • I pushed my PR to the latest dev commit.
  • I resolved all correct Codex and CodeRabbit findings.
  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes

    • Pricing status now accounts for all published pricing components, including auxiliary charges.
    • Models with any positive charge are correctly classified as paid.
    • Models with unsupported or invalid pricing values are classified as unknown instead of free.
    • Models are marked free only when all supported pricing components are zero and required pricing details are present.
  • Tests

    • Added coverage for auxiliary charges, zero-cost models, and unsupported pricing formats.

Discovered pricing classification only inspected the prompt/completion pair, so a model with zero token rates but a positive auxiliary charge (request, image, web_search, ...) could classify as free. Scan every published pricing component: any positive rate is paid, any unusable component is unknown, and free still requires the complete zero pair.
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0a7075d1-26a0-491e-8752-7651f4dbfee7

📥 Commits

Reviewing files that changed from the base of the PR and between 6467235 and 8694d6c.

📒 Files selected for processing (2)
  • src/codex/catalog/model-hints.ts
  • tests/codex-integration/catalog-free-pricing-status.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Pricing status classification

Layer / File(s) Summary
Fail-closed pricing classification and regression coverage
src/codex/catalog/model-hints.ts, tests/codex-integration/catalog-free-pricing-status.test.ts
discoveredPricingStatus now scans all pricing components. Positive numeric rates classify a model as paid; unsupported values classify it as unknown; a complete all-zero pricing set classifies it as free. Tests cover auxiliary charges and unsupported pricing shapes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8694d

No actionable merge-blocking risk remains after the targeted pricing checks and regression coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating catalog pricing classification to account for auxiliary model charges.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@github-actions github-actions Bot added the bug Something isn't working label Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

@github-actions
github-actions Bot marked this pull request as ready for review September 18, 2026 00:24
@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 73 / 80

이 PR은 카탈로그 Free 필터용 discoveredPricingStatus가 prompt/completion(또는 input/output)만 보고 보조 요금을 무시하던 구멍을 막습니다. 지금 tip(e80e571f63, package 2.59.0)의 src/codex/catalog/model-hints.ts는 쌍이 모두 0이면 free입니다. 토큰 단가는 0인데 request/image/web_search 같은 양수 보조 요금이 있으면 Free 목록에 올라가 사용자 돈을 쓰게 됩니다. #3666 계약의 "유료를 Free에 넣지 말 것(fail-closed)"과 정면으로 어긋납니다.

고침은 Object.values(pricing)discoveredPricingRate로 훑어, 양수가 하나라도 있으면 paid, 파싱 불가 성분이 있으면 unknown, 전부 비음수 0이고 prompt/completion 쌍이 완전할 때만 free입니다. 기존 문자열/숫자 0·OpenRouter 소수 문자열·input/output 별칭·metadata.pricing 경로는 유지됩니다. tests/codex-integration/catalog-free-pricing-status.test.ts에 보조 요금 paid, 전 차원 0 free, 객체/음수 보조 → unknown 케이스가 추가됩니다. review-ready이고 checklist도 채워져 있습니다. types/config 스플릿과 무관하고, 중복 PR은 없습니다. Preview deploy는 계획에 없습니다.

점수는 높게 잡습니다. tip 버그가 코드로 확인되고, fail-closed 방향·회귀 테스트가 한 축입니다. 다만 모든 pricing 값을 rate로 해석하므로, 숫자/소수 문자열이 아닌 형제 키(예: 통화 표기 문자열)가 섞이면 예전엔 free/paid였던 행이 unknown으로 떨어질 수 있습니다. 의도된 보수성이지만, 실제공자 payload에 비요금 키가 있는지는 랜딩 후 Free 필터 표본으로 한 번 보면 좋습니다.

src/codex/catalog/model-hints.ts (discoveredPricingStatus) - tip은 prompt/completion만 판단. PR은 양수 성분 우선 paid → 미지원 성분 unknown → 완전 0쌍만 free. 주석도 계약에 맞게 고쳐졌습니다.
tests/codex-integration/catalog-free-pricing-status.test.ts - request 0.05 → paid, 전 차원 0 → free, request 객체/image -1 → unknown. 기존 OpenRouter free 문자열 케이스와 충돌 없습니다.
경로/심볼 discoveredPricingRate - 음수·비숫자·빈 문자열은 계속 undefined. 보조 키에도 같은 파서를 쓰는 선택이 일관됩니다.

메인테이너의 판단이 필요한 지점

너의 추천

머지하세요. Free 필터 금액 사고 방지라 가치가 분명하고 변경 표면이 작습니다. tip에 올린 뒤 카탈로그 Free 표본만 한번 훑으면 됩니다. 라벨은 바꾸지 마세요.

이 댓글은 grok-bot이 작성했습니다

@lidge-jun

Copy link
Copy Markdown
Owner

Merging with one macOS red that is a known dev regression rather than anything in this change.

The only failure at this head is Codex history injection preflight on a WAL store with no live writer > reaches a verdict on a cleanly-closed WAL store rather than the catch-all refusal, an 8ms assertion on macos 1/2. It comes from #4957, which landed with full Linux and all-nine-Windows-shard evidence and a macOS gap in its one platform-dependent case. A dedicated lane owns the fix. Everything else at this head is green.

That failure is deterministic and fast, so it is distinguishable from the timeout and cancellation pattern tracked in #4956; I am treating fast assertions as real results and timeouts as the known defect, rather than waving both through.

@lidge-jun
lidge-jun merged commit 1cf3c29 into lidge-jun:dev Sep 18, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants