fix(proxy): keep a failed prisma generate from failing the migration entrypoint - #37947
Merged
yuneng-berri merged 1 commit intoAug 22, 2026
Merged
Conversation
…entrypoint The standalone migration entrypoint re-runs `prisma generate` after the migration completes. That refresh writes into the installed prisma package in site-packages, which an arbitrary non-root uid cannot do, and which no uid can do under a read-only root filesystem. Both are supported configurations of the migrations Job: helm/litellm-helm/tests/migrations-job_tests.yaml asserts runAsNonRoot, runAsUser and readOnlyRootFilesystem all render. The write has always failed there, but the failure used to be swallowed. Making migration failures fatal turned it into a hard exit 1, so a Job that applied every migration correctly now reports Failed and blocks the rollout it was supposed to gate. The refresh is redundant in the shipped images: every Dockerfile generates the client at build time from the same baked schema, copies it into the runtime stage, and asserts it resolves there. It stays load-bearing only for a source checkout, where CircleCI runs the entrypoint under `set +e` and ignores the exit code anyway. So the call stays and only its exit code stops propagating; migration failures are still fatal. image-scan never ran on the change that introduced this, because its path filter did not list the entrypoint it exercises. Add prisma_migration.py and entrypoint.sh so the non-root offline migration test gates them from now on.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Greptile SummaryThis PR makes post-migration Prisma client-generation failures non-fatal while preserving fatal migration failures
Confidence Score: 5/5The PR appears safe to merge because shipped images bake the Prisma client and genuine migration failures remain fatal The changed entrypoint suppresses only the redundant post-migration generation result, while the migration call still fails before generation when enforcement detects a database migration error
|
| Filename | Overview |
|---|---|
| litellm/proxy/prisma_migration.py | Treats post-migration client regeneration as best-effort while leaving migration enforcement unchanged |
| tests/test_litellm/proxy/test_prisma_migration.py | Verifies generation failures return success under both environment configurations and migration failures still propagate |
| .github/workflows/image-scan.yml | Adds the production entrypoint and migration script to image-scan pull-request triggers |
Reviews (1): Last reviewed commit: "fix(proxy): keep a failed prisma generat..." | Re-trigger Greptile
yucheng-berri
approved these changes
Aug 22, 2026
5 tasks
Contributor
yuneng-berri
enabled auto-merge (squash)
August 22, 2026 18:35
yuneng-berri
merged commit Aug 22, 2026
deab367
into
litellm_internal_staging
75 of 76 checks passed
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.
TLDR
Problem this solves:
prisma generatefailedHow it solves it:
prisma generateno longer sets the exit codeUser Flow
Before: a platform engineer upgrading the gateway on a cluster that runs the migrations Job as a non-root uid sees the sync fail even though the database migrated cleanly
securityContext.runAsNonRoot: trueon the chart and let ArgoCD syncAll migrations have been successfully applied.and then aPermissionErroron.../site-packages/prisma/schema.prismaENFORCE_PRISMA_MIGRATION_CHECK=false, which also gives up catching genuinely failed migrationsAfter: the same sync completes, and a genuinely failed migration still stops it
securityContext.runAsNonRoot: trueon the chart and let ArgoCD syncAll migrations have been successfully applied.and a warning that the client baked at image build time is being usedENFORCE_PRISMA_MIGRATION_CHECKRelevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v@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
Shared setup: a Postgres on a
--internal(no egress) Docker network, and the migration entrypoint run as an arbitrary non-root uid in GID 0, which is what OpenShift restricted-v2 assigns. The entrypoint under test is bind-mounted over the one in a released image so both sides run against an identical bakeBefore (7a1afa1)
Migration succeeds, entrypoint reports failure
Unreachable database, default settings
After (9f79218)
Migration succeeds, entrypoint reports success
Unreachable database, default settings
Type
🐛 Bug Fix
Caveats (if any)
image-scangating this entrypoint is new, expect it on more PRsFinal Attestation