Repository navigation
Conversation
|
bugbot run Please review this fresh implementation for creator billing, budget admission, cancellation, concurrent settlement, and receipt attribution regressions. |
|
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
c8d26d1 to
d4b2c44
Compare
|
@greptileai Please re-review the fixes: complete evaluation responses, verified creator accounts, window-aligned counter expiry, and independent admission for each fallback attempt |
|
bugbot run Please review the updated creator billing implementation, including global fallback admission, complete evaluation responses, missing creators, and budget expiry |
d4b2c44 to
ddcfa3c
Compare
|
@greptileai Please review the updated Messages admission and SDK judge fallback fixes, including native calls, translated attempts, cached receipts, and creator budgets |
|
bugbot run Please review the latest complete implementation, especially Messages fallback admission, native budgets, receipt isolation, and fallback-free judge calls |
ddcfa3c to
d30808f
Compare
|
@greptileai Please review the final callback isolation fix and overall creator billing design, including cached receipts, delayed failures, and budget settlement |
|
bugbot run Please review the final creator billing implementation, especially queued synchronous callbacks, receipt ownership after reuse, and budget settlement |
d30808f to
5613f70
Compare
|
@greptileai Please review the final provider helper placement and confirm the creator billing and receipt isolation design has no remaining issues |
|
bugbot run Please review the final creator billing implementation after relocating Messages provider selection. Verify callback isolation, admission, and settlement remain correct |
5613f70 to
b3029cf
Compare
|
@greptileai Please review the latest commit, including detached routing metadata in deferred receipts and evaluation streaming rejection before deployment hooks |
|
bugbot run Please review the latest commit, focusing on receipt isolation, pre-hook streaming rejection, creator billing, and budget settlement |
b3029cf to
5c76148
Compare
|
@greptileai Please review the Chat/Messages receipt regression and reassess shared dictionary concerns; copying produces duplicate synchronous exports, while current behavior passes |
|
bugbot run Please review the final test amendment verifying receipt ownership, routing metadata, and exactly one synchronous export per bridged call |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5c76148. Configure here.
TLDR
Problem this solves:
How it solves it:
Intentional product change: evaluations consume their creator’s total and per-model budgets. Exhausted or unverifiable budgets withhold evaluation work while source requests continue. Missing creator accounts, including legacy admin jobs, also withhold work. Evaluation calls require complete responses and override deployment streaming defaults
This is a fresh implementation from
main, replacing the approach in #44356. The original PR remains open for referenceUser Flow
Before: an administrator evaluates a router, and sampled application users pay for the extra calls
POST http://localhost:55183/auto_router/shadow_eval/startPOST http://localhost:55183/v1/chat/completionsand receives HTTP 200After: the administrator pays for evaluations, and their budgets limit the additional calls
POST http://localhost:55183/auto_router/shadow_eval/startPOST http://localhost:55183/v1/chat/completionsand receives HTTP 200Design
A captured creator context leaves source routing and authorization metadata intact. Logging creates detached billing receipts for downstream consumers. Queued synchronous success and failure handlers capture their evaluation receipt and detach nested routing metadata before logger reuse. One evaluation attempt reserves and settles budgets, including nested calls, cached responses, cancellation and late receipts
Total budgets reuse the existing reservation engine. Per-model budgets retain their existing fixed windows and numeric spend keys, with atomic expiring holds for concurrent evaluation calls. Ordinary spend writers recognize centrally settled reservations and skip those counters. Settlement preserves the full model-budget window. Explicit empty fallback lists disable inherited fallbacks so each paid attempt receives its own admission and receipt. Messages uses the dispatcher’s provider selection to admit native requests directly and reserve bridged provider calls independently. Judge calls disable fallbacks in both dispatch paths
Pre-Submission checklist
Validation
Commit
5c76148f717c8037c614b605deef6a679c168f4fadds 894 production lines and 933 test lines, with 106 deletions across 29 files in one commit. The production diff is 995 changed lines (+894/-101). No workflow, migration or lint-budget files changemake checkpasses for the final changes; the unchanged areas passed the full PR checks previously. All 1,161 affected tests pass: 422 Logging tests and 739 SDK, cache, shadow-evaluation and Messages tests. Logging passed again after the final formatting change. The wider 2,208-test corpus passed before the callback amendments. Changed executable Python coverage is 355/390 lines (91.0%), using fresh coverage for the changed modules and verified unchanged-source coverage elsewhereTargeted mutations caught 36 of 38 faults (94.7%), with no setup or import errors. Both new regressions fail before their fixes and pass afterward. The dictionary-copy suggestion from review is caught by the new Messages regression: two provider calls produce four synchronous exports instead of two. The retained implementation produces exactly two asynchronous and two synchronous receipts, with the original creator, routing metadata and cost
The two surviving probes remove the later streaming guard, masked by early rejection in tested scenarios, and the logger-parameter rebind, masked by deployment IDs in chat responses. Both retained protections have narrower paths outside those tests. The parameter-rebind probe was rerun against both Chat and Messages and still survives. The final formatting change has an identical syntax tree, and the formatting-sensitive probe was rerun. Recorded source hashes match the final code
Delayed callback regressions use real Router and SDK calls, real asynchronous dispatch and synchronous S3 serialization, with only external transports doubled. They verify each receipt retains its original model group, deployment, creator and cost after logger reuse. Streaming regressions exercise the real code-interpreter hook and preserve the existing internal-call boundary
Real Redis verification covers concurrent admission across four processes, repeated cancellation after writes, atomic settlement, fixed windows, namespaces and Redis Cluster key placement. The real Logging and spend-writer counter path preserves unrelated spend and applies late costs once
Logging tests run separately because two unchanged test pairs leak callbacks into later tests and fail identically on the merge base. No selected tests were skipped
Production is byte-identical to
b3029cf; the final amendment adds the Messages case to the existing regression. The prior production checks and 739-test result remain applicable, and all 422 Logging tests were rerun. The exact-tip paid replay passed: six successful source requests and twelve paid receipts totaling $0.0041673. Six evaluation receipts bill the correct creator, and both exhausted creator budgets withhold evaluation calls at zero shadow/judge costAll ten required CI checks pass on this commit. Greptile reviewed it at 5/5, Bugbot reported no issues, Veria found no security issues, and all review threads are resolved
CodeQL is red for existing alert #9134, created August 17, 2026, at
hash_tokeninlitellm/proxy/utils.py:7141. The annotated module is byte-identical to the merge base. The earlier inherited Lens failure has cleared in the current CI run. Some additional CI jobs are still running; they are not counted as passesScreenshots / Proof of Fix
The same six cases ran against isolated PostgreSQL databases and a local proxy, with real paid Together DeepSeek-V4.1-Flash source/shadow calls and Moonshot Kimi-K3 judge calls. Keys below are placeholders.
<source-agent>in the receipt output represents the generated agent UUIDShared proxy configuration:
Start the proxy on port 55183 with this configuration, provider credentials, and a fresh QA database for each commit. Create a separate evaluation owner and an agent-bound source key, then enable 100% shadow sampling:
The setup returned HTTP 200 for users/agent/key creation and HTTP 201 for evaluation creation. Run cases in the listed order. New evaluation jobs propagate through the existing active-job cache within about ten seconds. For replay, wait eleven seconds after creating a job before sending its first sample. After each source response, wait for the evaluation receipts, then inspect the new rows with:
Before (d306d6d)
Chat billing
Run:
Observed response and new receipts:
Creator total budget
Run:
Observed response and new receipts:
Creator per-model budget
Run:
Observed response and new receipts:
Responses billing
Run:
Observed response and new receipts:
The matching active job classified this bridged Responses sample as unjudgeable. This case verifies the paid source request only; evaluation billing is unverified for this bridge
Messages billing
Run:
Observed response and new receipts:
Configured deployment pricing
Run:
Observed response and new receipts:
The shadow deployment uses the real Together endpoint through its OpenAI-compatible API. Its provider-qualified model has no built-in price entry; the proxy config supplies input/output prices of $1/$2 per million tokens. The evaluation succeeds under the creator’s $1 total limit. The configured $0.01 hourly
qa-pricedcap is not exercised because this routed request uses theqa-priced-routerbudget identity; focused tests separately cover configured per-model pricingAfter (5c76148)
Chat billing
Run:
Observed response and new receipts:
Creator total budget
Run:
Observed response and new receipts:
Creator per-model budget
Run:
Observed response and new receipts:
Responses billing
Run:
Observed response and new receipts:
The matching active job classified this bridged Responses sample as unjudgeable. This case verifies the paid source request only; evaluation billing is unverified for this bridge
Messages billing
Run:
Observed response and new receipts:
Configured deployment pricing
Run:
Observed response and new receipts:
The shadow deployment uses the real Together endpoint through its OpenAI-compatible API. Its provider-qualified model has no built-in price entry; the proxy config supplies input/output prices of $1/$2 per million tokens. The evaluation succeeds under the creator’s $1 total limit. The configured $0.01 hourly
qa-pricedcap is not exercised because this routed request uses theqa-priced-routerbudget identity; focused tests separately cover configured per-model pricingPaid nested evaluation-owned Messages/compaction remains unverified: native compaction requires Anthropic, whose account rejected the earlier probe for exhausted credits. The Messages case above tests a public Messages source request; focused provider-transport regressions separately exercise evaluation-owned nested calls
Type
Bug Fix
Caveats
Severe
Medium
Low
Screenshot and recording tools are unavailable in this session
CodeQL flags unchanged API-token hashing