Skip to content

feat: support static catalog prices - #21

Closed
MuncleUscles wants to merge 1 commit into
mainfrom
codex/static-catalog-prices
Closed

feat: support static catalog prices#21
MuncleUscles wants to merge 1 commit into
mainfrom
codex/static-catalog-prices

Conversation

@MuncleUscles

@MuncleUscles MuncleUscles commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • allow static served_by rows to carry operator price metadata
  • validate catalog prices and expose them on static candidates
  • cover routing without metrics seed for catalog-priced providers

Tests

  • lua tests/run_lua.lua
  • uv run --with-requirements ../requirements.txt --with-requirements ../requirements-dev.txt pytest ../tests/test_live_wiring.py ../tests/test_sources.py
  • uv run --with-requirements ../requirements.txt --with-requirements ../requirements-dev.txt pytest

Summary by CodeRabbit

  • Bug Fixes
    • Improved model pricing handling by accepting either legacy or new pricing fields and consistently normalizing them for use in candidate selection.
    • Added validation to ensure input and output prices are provided together, are numeric, and are non-negative.
    • Candidates now respect catalog-based pricing during routing and filtering, even when metrics data is unavailable.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5b3f5095-af4f-47e3-8cea-90bdf89d82ad

📥 Commits

Reviewing files that changed from the base of the PR and between ee31e81 and f698982.

📒 Files selected for processing (2)
  • llm_policy/candidate.lua
  • tests/unit/price_enrichment.lua

📝 Walkthrough

Walkthrough

Model validation now accepts paired per-served-model pricing fields, static candidates emit normalized price_in/price_out values from catalog prices, and a unit test verifies routing and rejection behavior when metrics are unavailable.

Changes

Catalog price normalization

Layer / File(s) Summary
Price validation
llm_policy/candidate.lua
validate_model accepts paired input and output price fields from either the new or legacy naming and rejects incomplete, non-numeric, or negative pairs.
Static candidate pricing
llm_policy/candidate.lua, tests/unit/price_enrichment.lua
build_candidate_matrix normalizes served-model prices into candidate entries, and the new unit test covers catalog-priced routing with and without metrics.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • jmlago

Poem

A bunny hopped through priceful lanes,
With catalog carrots and metric-free gains.
Two prices in, two prices out,
And rejected hops still leave a route. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. 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 matches the main change: adding support for static catalog prices.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/static-catalog-prices

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.

@MuncleUscles

Copy link
Copy Markdown
Member Author

Closing this: the parent PR was corrected to keep operator pricing in a parent-side source instead of changing the engine/static candidate builder. No engine change is needed for this stopgap.

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.

1 participant