Repository navigation
fix(auth): index restricted end-user registry refreshes - #51772
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Merging this PR will not alter performance1 warning
Comparing |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
[Medium impact] The changes reach end-user authentication queries and the database upgrade path. Publish updated extras and update the core pin before merging. Findings
SummaryThe PR adds a partial index for restricted customers and changes registry refreshes to read only their IDs.
Reviews (1) · Last reviewed commit: "test(auth): update end-user registry dat..." · Reviewed by Greptile |
| module: Final = import_module("litellm_proxy_extras.request_log_indexes") | ||
| query: Final = _END_USER_QUERY.validate_python(module.END_USER_RESTRICTED_QUERY) |
There was a problem hiding this comment.
Older extras disable the shortcut
litellm[proxy] still pins litellm-proxy-extras==0.4.116, but this read now requires the newly added END_USER_RESTRICTED_QUERY. If the installed wheel predates this constant, every registry refresh raises AttributeError and falls back to individual customer reads. Publish updated extras and update the core pin before shipping.
There was a problem hiding this comment.
We bump litellm-proxy-extras together with litellm on every release, so a released proxy always installs the extras version that has this query.
There was a problem hiding this comment.
That release coupling addresses the concern for shipped versions. An older extras package would miss the optimization and use the existing per-user fallback, but it would not break auth; since you bump extras alongside LiteLLM, this isn’t a release blocker. I should have framed it as release-packaging coordination, which the PR already documents, rather than as an outstanding issue.
There was a problem hiding this comment.
I overstated this risk. Releases update extras and core together, so no separate publication is needed. I’ll correct the PR description.
|
Image smoke tests reproduce the same connector-schema failure with all three production files restored to their merge-base versions. CI |
…08_x fix(auth): backport #51772 restricted end-user index to lts/1.108.x
fix(auth): backport #51772 restricted end-user index to rc/1.111.0
Backport of BerriAI#51772 to lts/1.108.x, adapted to the line's EndUserRepository (no _selected_database there). Cherry-picked from c4b915b (main). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…1_110_x fix(auth): backport #51772 restricted end-user index to stable/1.110.x for v1.110.4
…1_109_x fix(auth): backport #51772 restricted end-user index to stable/1.109.x for v1.109.5
* fix(auth): index restricted end-user registry refreshes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(auth): retain named database spans for registry reloads Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(auth): update end-user registry database doubles Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit c4b915b)
Handwritten 1-3 sentence description
index for the end user table for the stuff that we care about for the end user table for the registry cache
Details
Link to Devin session: https://app.devin.ai/sessions/6d42f90560c24cdaba679cc474709d6a
Open in Devin Desktop: https://app.devin.ai/desktop/session/6d42f90560c24cdaba679cc474709d6a?variant=devin
Requested by: @ryan-crabbe-berri
TLDR
Problem this solves:
How it solves it:
User Flow
Before, routine requests can trigger expensive database reads even without restricted customers
userAfter, the same requests and restrictions remain, but refresh reads cover restricted customers only
userRelevant issues
Fixes #47413
Fixes #51115
Linear ticket
Resolves LIT-9895
Pre-Submission checklist
Screenshots / Proof of Fix
The database proof used PostgreSQL 14.24 and Prisma 5.4.2 on an isolated local database, not a production database. Two live proxy workers shared Redis on port 6395 in both legs. Both worker PIDs reached application startup in each leg, despite using
--reload. The base wasfa79311dfc7f1661f6950ad1e69c945ffea876e4. The after code is506cd870ce6632434e10c1deff3046f5a610e3a5. The benchmark used the same literal SQL and index definition as this tip. Later cleanup removed unused selector helpers, validated the extras-package boundary, and kept an explicitly named database span around the reload, without changing either SQL expression. Parity and live endpoint checks were rerun after that cleanup atbb99b3e8ef7bff9dff61d1194c31a7758ad87678. The final commit only updates unit database doubles, with no runtime change, so that proof is retained at the current tipThe SQL predicate is defined once in
request_log_indexes.py, then used for both the index and repository query. OnlyLIMITis bound.pg_stat_statementsnormalizes the literal empty array to$2in its displayed query text, which does not mean the sent predicate was parameterizedBefore (
fa79311dfc7f)Restricted-user refresh
pg_stat_statementsandEXPLAIN (ANALYZE, BUFFERS)underautoandforce_generic_planAuto planning
Forced generic planning
/v1/chat/completions
OK, HTTP 403customer_model_access_denied, and HTTP 422budget_exceeded/v1/responses
input,user, andmax_output_tokenscustomer_model_access_denied, and 422budget_exceeded/v1/messages
messagesandmetadata.user_idpermission_error, and 422invalid_request_errorwithbudget_exceededAfter (
506cd870ce6632434e10c1deff3046f5a610e3a5)Restricted-user refresh
Auto planning
Forced generic planning
The empty partial index was 8,192 bytes. A held writer kept the concurrent build in
waiting for writers before build. An independent insert and update completed in 1.823 ms with a one-second lock timeout, before releasing that writer. The build then succeeded/v1/chat/completions
user_id/v1/responses
/v1/messages
Missing index, active build, and overflow
The live state harness dropped the index, created a new model-restricted customer through
/customer/new, then submitted a denied request and an unrestricted provider request. It repeated this while a concurrent build waited on an open writer. Finally, it inserted 5,001 restricted rows and created a restricted customer sorting beyond the first 5,001 IDsThe overflow case proves a customer outside the capped result still reaches the per-user check. Missing or invalid indexes affect performance only. Management-created restrictions were picked up without waiting for TTL expiry
Upgrade and index ownership
Before any implementation, a real PostgreSQL probe created a baseline Prisma schema, manually added the partial index, introduced a pending
ADD COLUMNmigration, deployed it, and ran LiteLLM's actual reconciliation path. Prisma emitted an empty diff, contrary to the expected DROPThe added real-database regressions also apply the repository's pending migrations using both v1 and v2 resolvers and assert the workaround index keeps its OID. The drift filter independently removes a generated DROP of this builder-owned partial index, while leaving spend-log DROP behavior unchanged
The builder keeps the workaround's OID under the managed name. It also renames a matching differently named partial index without rebuilding or making a second copy. Full indexes and partial indexes with
blockedorNOT blockedpredicates are not mistaken for equivalentsIf the build fails, already-applied schema migrations stay applied. The synchronous migration job returns
False, so its process reports failure and the Job can retry. A deployment waiting on that Job can therefore remain held even though the schema upgrade succeeded. The serving proxy's existing daemon-thread path does not wait for the build before readiness. A failed build is retried at the next boot or migration job, not on a new timer introduced hereVerified versus not established
The literal selector matched the previous Prisma OR filter on all 1,458 combinations of blocked false/true/null, four nullable restriction fields with null/empty/non-empty values, and models null/empty/empty-string/non-empty/null-element/mixed arrays. This was checked before and after index creation. The old selector now lives as the fixed reference filter in the integration test rather than unused production helpers
Model and budget enforcement were proven through all three live endpoints. Blocked-flag inclusion was proven through database parity, but end-to-end blocked-callback denial was not established. This PR makes no claim to repair that separate behavior
The proxy was tested with the workspace extras package. The normal release process bumps extras with LiteLLM and updates core's pin, so released proxies include the updated query and index. An older package lacking the query keeps the existing registry-error per-user fallback but does not receive this optimization. Cross-version PostgreSQL predicate deparsing, real deployment-Job retry policy, and production latency were not measured
Full captured plans and statement statistics
{ "rows": 2100000, "before_auto": { "pg_stat_statements": [ [ "SELECT \"public\".\"LiteLLM_EndUserTable\".\"user_id\", \"public\".\"LiteLLM_EndUserTable\".\"alias\", \"public\".\"LiteLLM_EndUserTable\".\"spend\", \"public\".\"LiteLLM_EndUserTable\".\"allowed_model_region\", \"public\".\"LiteLLM_EndUserTable\".\"default_model\", \"public\".\"LiteLLM_EndUserTable\".\"models\", \"public\".\"LiteLLM_EndUserTable\".\"budget_id\", \"public\".\"LiteLLM_EndUserTable\".\"object_permission_id\", \"public\".\"LiteLLM_EndUserTable\".\"blocked\" FROM \"public\".\"LiteLLM_EndUserTable\" WHERE (\"public\".\"LiteLLM_EndUserTable\".\"blocked\" = $1 OR \"public\".\"LiteLLM_EndUserTable\".\"budget_id\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"allowed_model_region\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"default_model\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"object_permission_id\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"models\" <> $4) ORDER BY \"public\".\"LiteLLM_EndUserTable\".\"user_id\" ASC LIMIT $2 OFFSET $3 /* traceparent=00-00000000000000000000000000000000-0000000000000000-01 */", 10, 0, 2518.4053080000003, 251.84053079999998, 82511, 155492 ] ], "explain": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 31564.61, "Total Cost": 31564.61, "Plan Rows": 1, "Plan Width": 197, "Actual Startup Time": 91.333, "Actual Total Time": 94.145, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 11733, "Shared Read Blocks": 8195, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Sort", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 31564.61, "Total Cost": 31564.61, "Plan Rows": 1, "Plan Width": 197, "Actual Startup Time": 91.332, "Actual Total Time": 94.144, "Actual Rows": 0, "Actual Loops": 1, "Sort Key": [ "user_id" ], "Sort Method": "quicksort", "Sort Space Used": 25, "Sort Space Type": "Memory", "Shared Hit Blocks": 11733, "Shared Read Blocks": 8195, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Gather", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 1000.0, "Total Cost": 31564.6, "Plan Rows": 1, "Plan Width": 197, "Actual Startup Time": 91.304, "Actual Total Time": 94.116, "Actual Rows": 0, "Actual Loops": 1, "Workers Planned": 2, "Workers Launched": 2, "Single Copy": false, "Shared Hit Blocks": 11730, "Shared Read Blocks": 8195, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Seq Scan", "Parent Relationship": "Outer", "Parallel Aware": true, "Async Capable": false, "Relation Name": "LiteLLM_EndUserTable", "Alias": "LiteLLM_EndUserTable", "Startup Cost": 0.0, "Total Cost": 30564.5, "Plan Rows": 1, "Plan Width": 197, "Actual Startup Time": 89.103, "Actual Total Time": 89.104, "Actual Rows": 0, "Actual Loops": 3, "Filter": "(blocked OR (budget_id IS NOT NULL) OR (allowed_model_region IS NOT NULL) OR (default_model IS NOT NULL) OR (object_permission_id IS NOT NULL) OR (models <> '{}'::text[]))", "Rows Removed by Filter": 700000, "Shared Hit Blocks": 11730, "Shared Read Blocks": 8195, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Workers": [] } ] } ] } ] }, "Planning": { "Shared Hit Blocks": 72, "Shared Read Blocks": 19, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.324, "Triggers": [], "Execution Time": 94.178 } ] }, "before_generic": { "pg_stat_statements": [ [ "SELECT \"public\".\"LiteLLM_EndUserTable\".\"user_id\", \"public\".\"LiteLLM_EndUserTable\".\"alias\", \"public\".\"LiteLLM_EndUserTable\".\"spend\", \"public\".\"LiteLLM_EndUserTable\".\"allowed_model_region\", \"public\".\"LiteLLM_EndUserTable\".\"default_model\", \"public\".\"LiteLLM_EndUserTable\".\"models\", \"public\".\"LiteLLM_EndUserTable\".\"budget_id\", \"public\".\"LiteLLM_EndUserTable\".\"object_permission_id\", \"public\".\"LiteLLM_EndUserTable\".\"blocked\" FROM \"public\".\"LiteLLM_EndUserTable\" WHERE (\"public\".\"LiteLLM_EndUserTable\".\"blocked\" = $1 OR \"public\".\"LiteLLM_EndUserTable\".\"budget_id\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"allowed_model_region\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"default_model\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"object_permission_id\" IS NOT NULL OR \"public\".\"LiteLLM_EndUserTable\".\"models\" <> $4) ORDER BY \"public\".\"LiteLLM_EndUserTable\".\"user_id\" ASC LIMIT $2 OFFSET $3 /* traceparent=00-00000000000000000000000000000000-0000000000000000-01 */", 10, 0, 4407.154369, 440.71543690000004, 96, 276654 ] ], "explain": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 9398.63, "Total Cost": 18796.83, "Plan Rows": 210000, "Plan Width": 197, "Actual Startup Time": 393.04, "Actual Total Time": 393.041, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 3, "Shared Read Blocks": 27675, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Index Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Scan Direction": "Forward", "Index Name": "LiteLLM_EndUserTable_pkey", "Relation Name": "LiteLLM_EndUserTable", "Alias": "LiteLLM_EndUserTable", "Startup Cost": 0.43, "Total Cost": 93982.43, "Plan Rows": 2100000, "Plan Width": 197, "Actual Startup Time": 393.038, "Actual Total Time": 393.038, "Actual Rows": 0, "Actual Loops": 1, "Filter": "((blocked = $1) OR (budget_id IS NOT NULL) OR (allowed_model_region IS NOT NULL) OR (default_model IS NOT NULL) OR (object_permission_id IS NOT NULL) OR (models <> $4))", "Rows Removed by Filter": 2100000, "Shared Hit Blocks": 3, "Shared Read Blocks": 27675, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 66, "Shared Read Blocks": 19, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.377, "Triggers": [], "Execution Time": 393.07 } ] }, "concurrent_writes": { "phase": [ [ "waiting for writers before build" ] ], "insert_update_ms": 1.8230530000096223 }, "after_auto": { "pg_stat_statements": [ [ "SELECT user_id FROM \"LiteLLM_EndUserTable\" WHERE (blocked OR (budget_id IS NOT NULL) OR (allowed_model_region IS NOT NULL) OR (default_model IS NOT NULL) OR (object_permission_id IS NOT NULL) OR (models <> $2::text[])) ORDER BY user_id LIMIT $1", 10, 0, 0.047097, 0.0047097, 10, 0 ] ], "explain": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.12, "Total Cost": 4.14, "Plan Rows": 1, "Plan Width": 15, "Actual Startup Time": 0.006, "Actual Total Time": 0.007, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 1, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Index Only Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Scan Direction": "Forward", "Index Name": "LiteLLM_EndUserTable_restricted_idx", "Relation Name": "LiteLLM_EndUserTable", "Alias": "LiteLLM_EndUserTable", "Startup Cost": 0.12, "Total Cost": 4.14, "Plan Rows": 1, "Plan Width": 15, "Actual Startup Time": 0.006, "Actual Total Time": 0.006, "Actual Rows": 0, "Actual Loops": 1, "Heap Fetches": 0, "Shared Hit Blocks": 1, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 104, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.239, "Triggers": [], "Execution Time": 0.017 } ] }, "after_generic": { "pg_stat_statements": [ [ "SELECT user_id FROM \"LiteLLM_EndUserTable\" WHERE (blocked OR (budget_id IS NOT NULL) OR (allowed_model_region IS NOT NULL) OR (default_model IS NOT NULL) OR (object_permission_id IS NOT NULL) OR (models <> $2::text[])) ORDER BY user_id LIMIT $1", 10, 0, 0.053526000000000004, 0.0053526, 10, 0 ] ], "explain": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.12, "Total Cost": 4.14, "Plan Rows": 1, "Plan Width": 15, "Actual Startup Time": 0.007, "Actual Total Time": 0.007, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 1, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Index Only Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Scan Direction": "Forward", "Index Name": "LiteLLM_EndUserTable_restricted_idx", "Relation Name": "LiteLLM_EndUserTable", "Alias": "LiteLLM_EndUserTable", "Startup Cost": 0.12, "Total Cost": 4.14, "Plan Rows": 1, "Plan Width": 15, "Actual Startup Time": 0.006, "Actual Total Time": 0.006, "Actual Rows": 0, "Actual Loops": 1, "Heap Fetches": 0, "Shared Hit Blocks": 1, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 104, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.226, "Triggers": [], "Execution Time": 0.017 } ] }, "index_size": "8192 bytes" }Regression checks
Focused unit tests passed, 1,745 tests, including request-flow and custom-auth budgets, the Prisma span inventory, and database-span behavior tests. Real PostgreSQL adoption and upgrade tests passed, seven cases. Build-failure, concurrency, and selector parity tests passed, three cases. The failed-build upgrade case also passed again on the final tree. The final parity and generic-plan run passed, two cases. Spend-log upgrade, adoption, duplicate-index, and generic-plan regressions passed, 14 cases.
make checkpassed, including formatting, strict Ruff, type discipline, basedpyright, test quality, OpenAPI documentation, and generated dashboard API type checksTwo deliberate mutations were killed. Removing partial-index DROP protection fails the drift regression. Broadening the literal query to include
NOT blockedfails the forced-generic-plan regression, which observes a sequential scan instead of the partial indexReproduce the live proxy cases
Set
DATABASE_URL,LITELLM_MASTER_KEY,ANTHROPIC_API_KEY, andLITELLM_LOCAL_MODEL_COST_MAP=True. These examples replace the local QA database URL and artifact paths with environment variables and local filenames. Use an isolated database with the repository schema applied and dedicated Redis on port 6395Start the base and tip in their respective checkouts. The first before chat leg used port 4195, then the after leg used 4195. The sibling-endpoint comparison ran base at 4196 and tip at 4195
The database had these isolated customers, created with the management API
Save the following as
live.pyand runpython live.py beforeagainst the base, thenpython live.py afteragainst the tip. The blocked-row request records existing behavior, not a successful denial assertionSave and run the sibling-endpoint client with both proxies available
Reproduce 2.1M-row plans, statistics, and concurrent writes
Use a fresh isolated database with the schema applied, no restricted customers, no restricted partial index, and
pg_stat_statementspreloaded and created. The code below is the recorded harness with local paths and credentials replaced, and the previous Prisma filter inlined because the unused production helper was removedThe statistics columns are
query,calls,rows,total_exec_time,mean_exec_time,shared_blks_hit,shared_blks_read. The plan captures usePREPAREandEXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) EXECUTEunder the same planning mode as the ten Prisma or repository reloadsReproduce missing-index, building-index, and overflow requests
Run after the live customers exist and the partial index is present, with the tip proxy on port 4195. Save as
states.pyFocused database regression commands
These integration cases run locally here and in the existing scheduled integration group. They are not enabled on this PR by adding
run-ciType
Bug Fix
Caveats
Release packaging
The normal release process bumps
litellm-proxy-extraswith LiteLLM and updates core's extras pin. Released proxies therefore include this query and index without a separate publication or manual pin change for this PR. QA used the updated workspace packageCI image smoke investigation
The
verify (migrations)andverify (backend)image checks fail in the admin MCPtools/listprobe withKeyError: 'result'. Database migration itself passed. Two CI reruns were requested, with no test disabled or weakenedThe downloaded runtime image reproduces the failure both at the tip and after mounting merge-base versions of all three changed production files,
auth_checks.py,table_repositories.py, andrequest_log_indexes.py. Both unified and backend startup reproduce it with the merge-base files. A diagnostic print reveals the same RPC error in each caseThis isolates the connector-schema mismatch from this PR's runtime changes. The source, registry, auth, index-builder, type, lint, unit, and build checks pass. See the image workflow for the final retry status
Medium
Low
Final Attestation