fix(proxy/batches): make managed-file resolution additive, restore fall-back for missing-row and lookup errors - #34584
Merged
yucheng-berri merged 1 commit intoJul 25, 2026
Conversation
…, fall back like base Restore the original PR's behavior on every path that did not already resolve: no database, a lookup error, a missing managed-file row, or a row without a storage_url all fall back to dispatching the original id, which the managed-files deployment hook still maps. This drops the 404 and 503 fail-closed responses I had added, which were the only behaviors that diverged from litellm_internal_staging. The change is now strictly additive: when a managed-file row with a storage_url exists, the unified batch branch substitutes it so providers like Vertex receive a real gs:// path instead of the opaque token; every other path behaves exactly as before. Verified live that non-managed, managed-owner, multi-model load-balanced, and missing-row requests are byte-identical to base
Contributor
Author
Contributor
Greptile SummaryRestores best-effort managed-file resolution behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains within the scope of the previous review thread.
|
| Filename | Overview |
|---|---|
| litellm/proxy/batches_endpoints/endpoints.py | Changes managed-file lookup failures and missing rows from fail-closed HTTP responses to additive fallback behavior. |
| tests/test_litellm/proxy/batches_endpoints/test_endpoints.py | Updates missing-row and lookup-error tests to assert dispatch with the original unified file ID. |
Reviews (2): Last reviewed commit: "refactor(proxy/batches): make managed-fi..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
5 tasks
Contributor
Author
|
bugbot run |
tin-berri
approved these changes
Jul 25, 2026
Contributor
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 cf71afd. Configure here.
yucheng-berri
merged commit Jul 25, 2026
fc5ab31
into
litellm_internal_staging
85 of 86 checks passed
Contributor
Ericcwang23
pushed a commit
to Ericcwang23/litellm
that referenced
this pull request
Jul 27, 2026
…, fall back like base (BerriAI#34584) Restore the original PR's behavior on every path that did not already resolve: no database, a lookup error, a missing managed-file row, or a row without a storage_url all fall back to dispatching the original id, which the managed-files deployment hook still maps. This drops the 404 and 503 fail-closed responses I had added, which were the only behaviors that diverged from litellm_internal_staging. The change is now strictly additive: when a managed-file row with a storage_url exists, the unified batch branch substitutes it so providers like Vertex receive a real gs:// path instead of the opaque token; every other path behaves exactly as before. Verified live that non-managed, managed-owner, multi-model load-balanced, and missing-row requests are byte-identical to base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant issues
Follow-up to #34474
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
#34474resolved a managed (unified) batchinput_file_idto its backendstorage_urlbefore dispatch so providers like Vertex AI receive a realgs://path instead of the opaque token. Alongside that it added two fail-closed responses that were not in the original change and were not present before it: a 404 when the managed-file row is missing and a 503 when the lookup errors. Those two are backward-incompatible against the prior behavior, where the same requests fell through and dispatched the original id (the managed-files deployment hook maps it)Verified live, base vs the merged
#34474behavior, real Vertex GeminibatchPredictionJobs, no mocks: the missing-row case returns 200 on the prior behavior when the deployment hook serves the mapping from cache, and 404 after#34474. This PR restores the prior response for that caseThis change keeps the resolution and removes only the two added fail-closed responses, so the managed-file handling becomes strictly additive: when a row with a
storage_urlexists it is substituted, and every other path (no database, lookup error, missing row, row without astorage_url) falls back to dispatching the original id exactly as before#34474Type
🧹 Refactoring
Changes
_resolve_managed_input_file_storage_urlnow returns None on a lookup error and on a missing row instead of raising 503 and 404, matching the no-database and no-storage_url paths. The result: resolution is applied when it can be, and no request that previously dispatched now fails. The two mapped tests assert the fall-back for the missing-row and lookup-error cases; the resolution, legacy-row, and load-balancing tests are unchangedBehavior changes
QA runbook
target_model_namesset (managed files, enterprise) against avertex_aimodel, create a batch with the owning key: the Vertex job still receives the resolvedgs://pathLiteLLM_ManagedFileTablerow and repeat: the request dispatches the original id (deployment-hook mapping) rather than returning 404, matching the behavior before fix(proxy/batches): resolve managed unified input_file_id to storage_url with ownership check before dispatch #34474Note
Medium Risk
Changes batch-create behavior for unified file ids when the DB lookup fails or the row is missing—requests proceed instead of failing fast, which restores compatibility but may send opaque ids to providers if the deployment hook does not map them.
Overview
Follow-up to managed-file
storage_urlresolution for batch create: substitution when a row hasstorage_urlis unchanged, but 503 (DB lookup error) and 404 (missing row) are removed so those cases behave like before #34474._resolve_managed_input_file_storage_urlnow returnsNoneon lookup exceptions and when no managed-file row exists, instead of raising. Batch create then dispatches the original unifiedinput_file_id, relying on the managed-files deployment hook as before. Tests were updated to assert router dispatch with the raw id for DB errors and missing rows rather than expecting fail-closed HTTP errors.Reviewed by Cursor Bugbot for commit cf71afd. Bugbot is set up for automated code reviews on this repo. Configure here.