Repository navigation
fix(proxy): estimate auto-router baseline costs from durable cache history - #41177
Conversation
|
bugbot run Please review baseline cache prefix matching, expiry, retry uncertainty, and savings coverage on this draft's current commit |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
16f151f to
bec8a42
Compare
|
@greptileai Please review bec8a42, including baseline prefix matching, expiry, estimate coverage, and reservation cleanup after estimator failures |
|
bugbot run Please review bec8a42 for baseline cache prefix matching, expiry, estimate coverage, and reservation cleanup after estimator failures |
|
bec8a42 to
146d1ab
Compare
|
The quoted documentation rule explicitly exempts README.md; this change updates the existing router README with estimator behavior and coordination Redis requirements |
|
@greptileai Please review 146d1ab, including atomic reservation recovery, active versus terminal retries, original-error preservation, and documented unavailable prefix counts |
|
bugbot run |
146d1ab to
0e4f2c7
Compare
|
bugbot run |
|
@greptileai Please review 0e4f2c7, which retires baseline reservations at the proxy terminal failure boundary while preserving per-attempt retry uncertainty |
0e4f2c7 to
1250ee5
Compare
|
@greptileai Please review 1250ee5, including explicit invalidation cutoffs, late success ordering, and prompt recovery after terminal failures |
|
bugbot run |
be0474b to
64610c1
Compare
|
@greptileai Please review 64610c1: duplicate tag attribution is fixed through the shared identity resolver, and the handwritten catalog schema is updated. |
|
bugbot run Please review 64610c1: duplicate tag attribution now uses one shared resolver, with nonzero PostgreSQL regression coverage and a killed multiplicity mutation. |
|
@veria-ai Please review 64610c1, including asynchronous baseline observations, bounded counting, retained-history retirement, and shared identity deduplication for daily attribution. |
64610c1 to
e103981
Compare
|
@greptileai Please review e103981 after rebasing onto current main, focusing on logging finalization and trusted spend metadata integration |
|
bugbot run Please review e103981 after the rebase, especially logging finalization, baseline accounting, and preservation of upstream metadata fields |
|
@veria-ai Please review e103981 after the rebase and reassess previous findings against the current baseline accounting and logging integration |
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
e103981 to
ed40241
Compare
|
@greptileai Please review ed40241. Removed the product documentation from the implementation README and moved it into the litellm-docs guide |
|
bugbot run Please review ed40241. This revision only removes product documentation from the implementation README; runtime code is unchanged |
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 ed40241. Configure here.
|
@greptileai review |
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a conversation can report losses from unsupported baseline cache reads
POST http://localhost:47998/v1/messagesthrough the auto-router with a session ID and cache controlsAfter: each comparison requires observed costs or usable prefix history
POST http://localhost:47999/v1/messagesthrough the auto-router with a session ID and cache controlsRelevant issues
Changes
Affected release
Linear ticket
Pre-Submission checklist
make check, static scanners and cost-map guard passedScreenshots / Proof of Fix
Fresh paid native-message requests on the current base and tip, with isolated PostgreSQL, unique prefixes and uncached suffixes. Every streamed request ended with
message_stopThe final revision only removes misplaced product documentation; runtime and test files are byte-identical to the locally tested e103981. The requests below were rerun after that revision. The expiry case resumes a session seeded on the identical runtime before the documentation move, after more than five minutes
First-turn equality and cold-write pricing after the five-minute window passed. Gateway token counting exceeded the three-second deadline on seed requests, so the one-hour cases remain unknown. This run does not establish a successful live warm-prefix hit; the matching-prefix cases pass controlled regression tests
Shared setup and reproducible requests
Run each revision with the same isolated PostgreSQL database, gateway credentials and model configuration. The before proxy uses port 47998; after uses 47999. Apply the schema migrations before starting after
Generate a fresh payload for each side and TTL. Keep the session ID and cached block unchanged for the follow-up; append an assistant turn and a user turn requesting
USE_SONNET. For the changed-prefix case, prepend a fresh UUID inside the cached block. For five-minute expiry, wait at least 320 seconds before sending the follow-upAllow asynchronous accounting to flush before reading costs. The request cases below isolate this run. The five-minute initial request uses
stream: false; all other requests streamBefore (
b946d12ffdbd3a8379a78ed835bada22b9096207)Baseline-identical first turn, nonstreaming
POST http://localhost:47998/v1/messages; requestmsg_bdrk_bldf47nnemk3yrryrjnwbkxiupthzmhuojwnaa7pitfdspy57mkqcompletedGET http://localhost:47998/spend/logs?request_id=msg_bdrk_bldf47nnemk3yrryrjnwbkxiupthzmhuojwnaa7pitfdspy57mkq: actual $0.10216125, savings $+0.00000000Baseline-identical first turn, streaming
POST http://localhost:47998/v1/messages; requestmsg_bdrk_zxm5ntidn6h3utg567yoxeoy6sejdnpphrvwglwj6xopuw3efc7qcompletedGET http://localhost:47998/spend/logs?request_id=msg_bdrk_zxm5ntidn6h3utg567yoxeoy6sejdnpphrvwglwj6xopuw3efc7q: actual $0.16294500, savings $+0.00000000Matching one-hour prefix
POST http://localhost:47998/v1/messages; requestmsg_011CfDMZbczbz3fBG9rpWgeTcompletedGET http://localhost:47998/spend/logs?request_id=msg_011CfDMZbczbz3fBG9rpWgeT: actual $0.06521800, savings $-0.05664300Changed one-hour prefix
POST http://localhost:47998/v1/messages; requestmsg_011CfDMadF17pGRnvJfDttbycompletedGET http://localhost:47998/spend/logs?request_id=msg_011CfDMadF17pGRnvJfDttby: actual $0.06533400, savings $-0.05672550Expired five-minute prefix
POST http://localhost:47998/v1/messages; requestmsg_011CfDMwktxzMvt2suVbYRsHcompletedGET http://localhost:47998/spend/logs?request_id=msg_011CfDMwktxzMvt2suVbYRsH: actual $0.04085250, savings $-0.03224500After (
ed40241d26f6a23048c51d39bbb862a5e3a92de0)Baseline-identical first turn, nonstreaming
POST http://localhost:47999/v1/messages; requestmsg_bdrk_zxdz7r2x5dh2sze3ctjz2e7jem2oq2bbifyfjsggalkjslh3yc3acompletedGET http://localhost:47999/spend/logs?request_id=msg_bdrk_zxdz7r2x5dh2sze3ctjz2e7jem2oq2bbifyfjsggalkjslh3yc3a: actual $0.10222375, savings $+0.00000000,identical_baseline_path, baseline $0.10222375Baseline-identical first turn, streaming
POST http://localhost:47999/v1/messages; requestmsg_bdrk_zj3mwsxxqic6rbi3es2ofnrurxaa2skjcxwolbayyp6gajguexlqcompletedGET http://localhost:47999/spend/logs?request_id=msg_bdrk_zj3mwsxxqic6rbi3es2ofnrurxaa2skjcxwolbayyp6gajguexlq: actual $0.16304500, savings $+0.00000000,identical_baseline_path, baseline $0.16304500Matching one-hour prefix
POST http://localhost:47999/v1/messages; requestmsg_011CfDNfwDzajr5TpXPhfYANcompletedGET http://localhost:47999/spend/logs?request_id=msg_011CfDNfwDzajr5TpXPhfYAN: actual $0.06527800, savings unknown,token_count_timeout; comparison costs are nullChanged one-hour prefix
POST http://localhost:47999/v1/messages; requestmsg_011CfDNgx1A614LdpAJq2GSscompletedGET http://localhost:47999/spend/logs?request_id=msg_011CfDNgx1A614LdpAJq2GSs: actual $0.06539400, savings unknown,history_unavailable; comparison costs are nullExpired five-minute prefix
POST http://localhost:47999/v1/messages; requestmsg_011CfDNhHJGK1iuq64KZ5CLjcompletedGET http://localhost:47999/spend/logs?request_id=msg_011CfDNhHJGK1iuq64KZ5CLj: actual $0.04087900, savings $+0.06131975,cache_prefix_cold, baseline $0.10219875Python additions: 1,544 test lines / 2,442 runtime lines = 0.63:1
Type
Bug Fix
Caveats
Medium
Low
Final Attestation