Commit graph

41139 commits

Author SHA1 Message Date
yuneng-jiang
065bf83f0c
Merge pull request #35277 from BerriAI/litellm_/backport-35271-1-94-x-ba1512
chore(release): backport #35271 to stable/1.94.x and cut 1.94.1
2026-07-30 15:51:10 -07:00
Yuneng Jiang
733a2745ec
chore: refresh uv.lock for 1.94.1 2026-07-30 13:58:17 -07:00
Yuneng Jiang
0e23332394
bump: version 1.94.0 → 1.94.1 2026-07-30 13:57:43 -07:00
yuneng-jiang
87c1fc3f41
revert(proxy)!: stop enforcing user budget on team keys (#35271)
Reverts #32005. Team-scoped keys are governed by the team and team-member
budgets only; the key owner personal max_budget no longer applies to them,
restoring the hierarchy that existed before that PR.

The skip_user_budget_on_team_key opt-out existed solely to turn the new
behavior back off, so it is removed along with the behavior: the
ConfigGeneralSettings field, the /config/list allowed_args entry that
surfaced it as an Admin UI toggle, and the argument threaded through
reserve_budget_for_request and _get_budget_counters.

Regression tests cover both enforcement points in the restored direction:
test_common_checks_personal_user_budget_skipped_for_team_key for the
read-time check and test_should_not_reserve_user_budget_counter_for_team_key
for the optimistic reservation path.

(cherry picked from commit 6f1625d23b)
2026-07-30 13:50:59 -07:00
yuneng-jiang
38f2e023f1
Merge pull request #34995 from BerriAI/litellm_/cost-optimization-savings-pr-0a22b6
chore: rebuild Admin UI bundle for rc/1.94.0
2026-07-28 13:00:13 -07:00
Yuneng Jiang
4d06852664
chore: update Next.js build artifacts (2026-07-28 19:58 UTC, node v20.20.2) 2026-07-28 12:58:24 -07:00
yuneng-jiang
7880e61200
Merge pull request #34994 from BerriAI/litellm_/cost-optimization-savings-pr-0a22b6
fix(cost-optimization): backport the savings chart axis fix and methodology popovers to rc/1.94.0
2026-07-28 12:55:28 -07:00
Tin Chi Lo
99618fb392
feat(cost-optimization): anchor the savings line at a $0 range start
The "Savings over time" chart plotted a single floating dot for short
ranges: the daily rollup keys spend by YYYY-MM-DD, so a one-day range is
one point by construction. Rather than stand up an hourly SpendLogs data
source, read that same daily rollup and make the cumulative line legible.

- Cumulative | Per day toggle. Cumulative accumulates within the range;
  Per day shows the raw stacked bars.
- Cumulative prepends a synthetic $0 point at the range start
  (withStartAnchor) so the line rises from zero to the running total
  instead of floating. An empty series is left untouched so the chart's
  own "No data" state shows.
- Order the daily series oldest-first (the rollup arrives newest-first)
  so the axis reads left to right and the total accumulates forward.
- Header legend, dots on small series, and a "No data" guard on BarChart.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 1fa40bd168)
2026-07-28 12:45:09 -07:00
Tin Chi Lo
3322f24783
fix(cost-optimization): replace savings methodology Collapse with per-card info popovers
Swap the antd Collapse "How savings are calculated" panel for click-triggered
shadcn Popovers on each SummaryCard, so the explanation sits next to the
metric it describes instead of in one combined block.

(cherry picked from commit 3c287576b2)
2026-07-28 12:42:46 -07:00
yuneng-jiang
d3c8e5aae6
Merge pull request #34982 from BerriAI/litellm_/release-ui-build-1-94-0-ff6e5a
chore: rebuild Admin UI bundle for v1.94.0
2026-07-28 12:25:53 -07:00
Yuneng Jiang
1e857943c0
chore: update Next.js build artifacts (2026-07-28 19:23 UTC, node v20.20.2) 2026-07-28 12:23:10 -07:00
yuneng-jiang
96103c9788
Merge pull request #34987 from BerriAI/litellm_/cherry-pick-34984-rc-1-94-0-765f0f
feat(ui): mark Cost Optimization as beta in the left nav (#34984)
2026-07-28 12:21:19 -07:00
yuneng-jiang
3db78a88ed
feat(ui): mark Cost Optimization as beta in the left nav (#34984)
(cherry picked from commit f4a68a75ff)
2026-07-28 12:05:46 -07:00
yuneng-jiang
81ab74e307
Merge pull request #34967 from BerriAI/litellm_rc194_cost_optimization_page_metadata
fix(ui): add missing cost-optimization page description on rc/1.94.0
2026-07-28 10:36:08 -07:00
Yuneng Jiang
6204fa0648
fix(ui): add missing cost-optimization page description on rc/1.94.0
The cost-optimization page was backported onto this line with its leftnav
entry but without its pageDescriptions entry, so page_utils.test.ts failed
two assertions: the page fell back to the "No description available"
placeholder, and it showed up in missingDescriptions.

Restores the entry verbatim from litellm_internal_staging, which makes
page_metadata.ts byte-identical to staging.
2026-07-28 10:35:03 -07:00
yuneng-jiang
fb4468904a
Merge pull request #34964 from BerriAI/litellm_/cherry-pick-34885-rc-1-94-0-d64437
fix(ui): backport cache leakage card layout fix to rc/1.94.0
2026-07-28 10:30:33 -07:00
Yuneng Jiang
9f3c51fef6
style(ui): format cache leakage card after cherry-pick
Dropping className="mt-3" from <Tabs> in #34885 shortened the line
enough that prettier wants the props back on one line; the PR merged
with frontend-lint red, so the pick inherits the violation.
2026-07-28 10:19:39 -07:00
tin-berri
cf2ff4c63b
Fix cache leakage card layout to keep date picker on right (#34885)
* Fix cache leakage card layout to keep date picker on right and prevent content overlap

Removes flex-wrap and mt-3 to ensure date picker stays pinned to the right side of the card header regardless of zoom level, preventing it from covering card content below

* Remove overflow-hidden from Card to allow dropdowns and overlays to display fully

Fixes date picker dropdown being clipped when opened in cards like the Cache Leakage Card. By removing overflow-hidden from the Card container, popovers, dropdowns, and other overflow content can now display properly without being clipped by the card boundaries.

* Make cache leakage card descriptions consistent with line clamping

Adds line-clamp-2 to ensure both 'by model' and 'by virtual key' cards maintain consistent height. Removes conditional anthropic-specific text that caused height variations between dimensions.

(cherry picked from commit d91fd084f7)
2026-07-28 10:16:57 -07:00
tin-berri
fca0ad7c05
Merge pull request #34439 from BerriAI/litellm_cache_leakage_header_layout
fix(ui): keep cache leakage time range picker inline at narrow widths

(cherry picked from commit c93c3f7582)
2026-07-28 10:16:57 -07:00
yuneng-jiang
47eae0d23e
Merge pull request #34855 from BerriAI/litellm_backport_rc194_toolspend_0727
chore(release): backport #33899, #33978, #34582, #34675 to rc/1.94.0 and bump litellm-proxy-extras to 0.4.79.post2
2026-07-27 19:11:40 -07:00
Yuneng Jiang
7fec728c7f
chore: bump litellm-proxy-extras to 0.4.79.post2
Ships the 20260724000000_add_spend_log_tool_index_start_time_idx and
20260725000000_add_daily_tool_spend migrations, which live in that package
2026-07-27 17:01:16 -07:00
Yuneng Jiang
81d0e8c112
chore: update Next.js build artifacts (2026-07-28 00:00 UTC, node v20.20.2) 2026-07-27 17:00:05 -07:00
tin-berri
0acc934c9a
Merge pull request #34675 from BerriAI/litellm_tool_spend_rollup
fix(proxy): roll up tool spend daily instead of scanning SpendLogs

(cherry picked from commit 9bb75d67af)
2026-07-27 16:58:06 -07:00
tin-berri
30f3dbc183
Merge pull request #34582 from BerriAI/litellm_toolspend_30d_bound
fix(proxy): cap /v1/tool/spend window at 30 days and bound every SpendLogs read

(cherry picked from commit b9b27c2beb)
2026-07-27 16:47:34 -07:00
tin-berri
e055f94401
Merge pull request #33978 from BerriAI/litellm_cost_optimization_tools
feat(cost-optimization): add spend-by-tool and cache leakage views

(cherry picked from commit 43e7b96b83)
2026-07-27 16:47:34 -07:00
devin-ai-integration[bot]
0b8c13fa9c
feat(ui): add configuration tabs to the Cost Optimization page (#33899)
* feat(ui): add configuration tabs to Cost Optimization page

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(ui): reuse AutoRouter v2 and Router Settings prompt-caching panel in Cost Optimization; clarify Headroom compression

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(ui): add experimental dashboard banner with feedback discussion link to Cost Optimization

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(ui): add savings methodology note and per-key/team compression enterprise callout to Cost Optimization

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(ui): assert active tab state in Cost Optimization tab-switch test

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 34561482ed)
2026-07-27 16:47:34 -07:00
yuneng-jiang
5d66f1cbd1
Merge pull request #34640 from BerriAI/litellm_backport_rc194_auth_guard_0725
chore(release): backport auth, CLI SSO and guardrail fixes to rc/1.94.0 and refresh flagged dependencies
2026-07-25 13:39:16 -07:00
Yuneng Jiang
71a59c6e80
chore: update Next.js build artifacts (2026-07-25 18:06 UTC, node v20.20.2) 2026-07-25 11:18:20 -07:00
Yuneng Jiang
0c5fe28c32
chore(deps): bump next, postcss, sharp, js-yaml and brace-expansion in the dashboard 2026-07-25 11:18:20 -07:00
Yuneng Jiang
1bae2cff47
chore(deps): bump pypdf to 6.14.2 2026-07-25 11:18:20 -07:00
Yuneng Jiang
1ef06834dc
chore(deps): bump pyasn1 to 0.6.4 2026-07-25 11:18:20 -07:00
Yuneng Jiang
9e651e1064
chore(deps): bump gitpython to 3.1.54 2026-07-25 11:18:20 -07:00
ryan-crabbe-berri
d453d52480
fix(proxy): attribute org spend for team-linked credentials minted without org_id (#34577)
* fix(proxy): attribute spend to org for team-linked keys minted without org_id

Keys attached to an org-linked team but minted without an organization_id
produced spend that was never credited to the org: the spend writer reads
user_api_key_dict.org_id with no team fallback, while the org budget check
resolves the org from the team. The check therefore ran against a counter
fed by almost none of the org's traffic and never tripped.

Backfill org_id from the freshly fetched team object in
_run_centralized_common_checks, per request only, so the spend writer and
the budget check read the same org. A key with an explicitly pinned org_id
always wins, and the cached key row is never mutated, so moving a team to
a different org takes effect on the next auth once the team cache
refreshes.

* test(proxy): cover CLI session-token org backfill from team

CLI session tokens from /sso/cli/poll are minted with a real team_id but
no org_id, and their auth path decrypts the blob without the combined_view
team join that fills org for DB keys. Spend from these tokens reached the
team but never the org, so org budgets never tripped. The regression test
mints a real CLI token, runs it through the centralized checks, and
asserts the credential leaves auth with the team's org.

(cherry picked from commit 579f41d57f)
2026-07-25 11:18:19 -07:00
devin-ai-integration[bot]
1d14f2402d
fix(guardrails/model_armor): handle None metadata in post_call _process_response (#34390) (#34405)
* fix(guardrails/model_armor): handle None metadata in post_call _process_response

On batch routes data["metadata"] is normalized to None (present key, None
value), so request_data.get("metadata", {}) returned None and _process_response
raised 'NoneType' object has no attribute 'get', 500ing every /v1/batches create
with a post_call Model Armor guardrail (regression from v1.93.0 activating the
post_call hook). Coalesce a falsy metadata to {}

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Clean up test case documentation

Remove regression comment from test_process_response_with_none_metadata_does_not_crash.

---------

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 7257d0fc89)
2026-07-25 11:18:19 -07:00
devin-ai-integration[bot]
78f512f5a8
fix(proxy): share CLI SSO login sessions across workers without enable_redis_auth_cache (#33261)
* fix(proxy): share CLI SSO login sessions across workers without enable_redis_auth_cache

* fix(proxy): make CLI SSO flow state redis-authoritative across workers

The CLI SSO flow is stored in a DualCache whose get_cache is memory-first, so
the worker that served /sso/cli/start keeps serving its stale in-memory flow and
never observes the sso_complete/session_data update another worker writes during
the OAuth callback. Attaching Redis alone is not enough; poll on the original
worker returns pending forever.

Read and write the flow directly through the attached Redis backend when present
so every worker sees the same authoritative state, falling back to the in-memory
DualCache only when no Redis is configured.

* fix(proxy): serialize CLI SSO flow as JSON for the redis round trip

RedisCache stores values via str(value) and parses reads with
json.loads then ast.literal_eval. The completed flow contains a
LitellmUserRoles enum in session_data.user_role, whose repr is not a
parseable literal, so any worker reading the completed flow from redis
raised SyntaxError and returned 400 "CLI login session not found".
Writing the flow as json.dumps makes the round trip lossless (the enum
is a str subclass) and fails loudly at write time if a non-serializable
value is ever added to the flow.

* fix(proxy): point CLI SSO session-not-found hint at configuring Redis

The error message and warning still told users to set enable_redis_auth_cache,
but the CLI SSO session cache now gets Redis unconditionally whenever one is
configured, so that flag no longer affects CLI login

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: ryan-crabbe-berri <ryan@berri.ai>
(cherry picked from commit 17a83aa896)
2026-07-25 11:18:19 -07:00
ryan-crabbe-berri
ad98430d1d
refactor(auth): derive temp budget increase without mutating the token (#34121)
* refactor(auth): derive temp budget bump without mutation, tz-aware auth datetimes

_update_key_budget_with_temp_budget_increase mutated max_budget in place, so correctness depended on every resolution path handing it a fresh copy of the cached token; one future re-cache of a live token would compound the bump per request. Return a model_copy instead so no caller can leak an increased budget into shared state.

Also fixes the three remaining DTZ005 naive datetime.now() calls in user_api_key_auth.py (auth span start, builder start_time, service-log end_time; all consumers convert to epoch or subtract same-pair datetimes) and ratchets the DTZ005 strict budget 244 -> 241.

* test: pin non-mutation of the temp budget helper input

Adversarial mutation-testing showed reverting the helper to in-place mutation still passed every test: the cache's copy-on-read layer masks the mutation in the integration test and the direct unit test only inspected the return value. Assert the input object is left untouched and the result is a distinct object so the purity guarantee itself is load-bearing.

(cherry picked from commit 76c9eca25d)
2026-07-25 11:01:57 -07:00
devin-ai-integration[bot]
ef976070f9
fix(auth): apply temp_budget_increase for cache-hit keys (#33841)
temp_budget_increase was only applied on the DB-fetch path of _user_api_key_auth_builder, so a key served from the auth cache reverted to its original max_budget and was wrongly blocked with BudgetExceededError once spend crossed the original budget while staying under the effective budget.

Move _update_key_budget_with_temp_budget_increase out of the DB-only branch so it runs for every resolved token regardless of source. The cache stores the original budget and each cache hit returns a fresh model_copy(), so this never double-applies.

Fixes #25760

Co-authored-by: shivam <shivam@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 089de50d20)
2026-07-25 11:01:53 -07:00
devin-ai-integration[bot]
2374dda83e
fix(proxy/auth): handle tz-aware temp_budget_expiry (#33840)
Co-authored-by: shivam <shivam@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 10d2a27d87)
2026-07-25 11:01:53 -07:00
yuneng-jiang
13fef68b12
chore: update Next.js build artifacts (2026-07-22 02:58 UTC, node v20.20.2) (#34216) 2026-07-21 20:15:49 -07:00
yuneng-jiang
8423efc5fa
chore(release): backport #33810, #33733 to rc/1.94.0 and bump litellm-proxy-extras to 0.4.79.post1 (#34215)
* feat(spend): track prompt compression saved tokens in daily spend aggregates (#33810)

* feat(spend): track prompt compression saved tokens in daily spend aggregates

Native compression interception now records tokens_before/after/saved into the
request litellm_metadata so savings land in the SpendLog metadata JSON under a
typed compression_savings key. A single normalizer
(extract_compression_saved_tokens) sums that key with Headroom guardrail
tokens_saved; the two writers are disjoint and run at different stages, so
summing never double-counts. The spend-log redactor now preserves purely
numeric compression stats inside guardrail_response so Headroom savings
survive the store_prompts_in_spend_logs=false default. compression_saved_tokens
is threaded through BaseDailySpendTransaction, queue aggregation, the daily
upsert blocks, a new BigInt column on all six daily spend tables, and the
daily activity read path (SpendMetrics, DailySpendMetadata, raw-SQL rollups)

* fix(spend): normalize legacy guardrail shapes and float token stats in compression savings reader

* feat(spend): aggregate compression and prompt caching dollar savings in daily rollups

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(spend): update daily spend aggregation fixtures for savings columns

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(ui): add Cost Optimization dashboard page

New left-nav Cost Optimization page under Observability that surfaces money saved by prompt compression and prompt caching. It reads the daily activity rollup (userDailyActivityCall / get_daily_activity) and never scans SpendLogs, so it stays fast at 1M+ rows.

Renders a Total saved card, per-driver Compression and Prompt caching cards, a savings-over-time area chart, and a savings-by-driver donut, all aggregated in memory from the per-day metrics.compression_savings_spend and metrics.prompt_caching_savings_spend fields.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 3f3295b33f)

* Merge pull request #33733 from BerriAI/litellm_lit_4162_bedrock_batch_tags

feat(bedrock): forward bedrock_tags to CreateModelInvocationJob for batch jobs

(cherry picked from commit 3819ee5dc0)

* bump: version 0.4.79 → 0.4.79.post1

---------

Co-authored-by: tin-berri <tin@berri.ai>
Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Mateo Wang <277851410+mateo-berri@users.noreply.github.com>
2026-07-21 19:53:06 -07:00
yuneng-jiang
6c6a07c824
Merge pull request #34033 from BerriAI/litellm_backport_rc_1_94_0_fireworks_ct
chore(release): backport #33929 to rc/1.94.0
2026-07-20 14:24:22 -07:00
devin-ai-integration[bot]
d75a0716d8
fix(fireworks_ai): restore Content-Type application/json header (fixes 415) (#33929)
* fix(fireworks_ai): set Content-Type application/json in validate_environment

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(fireworks_ai): delegate chat validate_environment to OpenAIGPTConfig

Instead of re-adding the JSON Content-Type default inside FireworksAIMixin,
FireworksAIConfig now delegates header construction to OpenAIGPTConfig and only
layers the Fireworks-specific x-session-affinity header on top, so the
Content-Type default can no longer drift away from the OpenAI base and reintroduce
the 415.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(fireworks_ai): cover missing api key error path in chat validate_environment

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 3fcd19d7ad)
2026-07-20 11:21:07 -07:00
yuneng-jiang
5d4c4d0fce
Merge pull request #33868 from BerriAI/litellm_internal_staging
Some checks failed
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
CodSpeed Benchmarks / benchmarks (push) Has been cancelled
Helm unit test / unit-test (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
LiteLLM Rust / rustfmt, clippy, test (push) Has been cancelled
GitHub Actions Security Analysis / zizmor (push) Has been cancelled
chore(ci): promote internal staging to main
2026-07-18 16:36:59 -07:00
devin-ai-integration[bot]
366ec6f487
docs(rust): add provider abstraction standards (#33865)
Some checks are pending
CodSpeed Benchmarks / benchmarks (push) Waiting to run
LiteLLM Rust / rustfmt, clippy, test (push) Waiting to run
GitHub Actions Security Analysis / zizmor (push) Waiting to run
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
2026-07-18 15:31:00 -07:00
yuneng-jiang
92409daded
chore: update Next.js build artifacts (2026-07-18 21:58 UTC, node v20.20.2) (#33857) 2026-07-18 15:30:44 -07:00
yuneng-jiang
ef7007c3dd
fix(router): treat malformed configured token limits as absent on /v1/models (#33864)
A deployment whose model_info carried a non-numeric max_input_tokens or
max_output_tokens (for example "128,000" or an empty string) made the
bare int() in get_configured_token_limits raise inside the per-model
/v1/models loop, so one misconfigured deployment turned the entire
listing into a 500. Coerce each configured limit safely and treat
malformed values as absent, matching the graceful degradation the
listing had before the cost-map switch
2026-07-18 15:27:07 -07:00
devin-ai-integration[bot]
9dfd79b6c5
docs(litellm-rust): require the official Rust Style Guide in agent rules (#33867)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
2026-07-18 22:25:11 +00:00
yuneng-jiang
3f9b71c1a4
bump: litellm-proxy-extras 0.4.78 -> 0.4.79 (#33855) 2026-07-18 22:06:57 +00:00
devin-ai-integration[bot]
d495da4ce4
feat(chat-ui): add personal Logs view scoped to the current user (#33829)
* feat(chat-ui): add personal Logs view scoped to the current user

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(chat-ui): show request payload from proxy_server_request in logs detail

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(chat-ui): address logs panel review feedback (stable detail key, error state)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-18 14:58:12 -07:00
yuneng-jiang
567ebcb3e9
fix(docker): bake prisma CLI and engines at a fixed path so fresh-DB migrations work for any uid offline (#33853)
* fix(docker): bake prisma CLI and engines at a fixed path so fresh-DB migrations work for any uid offline

The runtime image shipped the prisma CLI and engines under /root/.cache, the
default HOME-derived prisma-python cache location. Any deployment whose
runtime HOME is not /root (kubernetes runAsUser, docker --user, HOME
overrides) missed that cache on a fresh database, fell back to a nodeenv
Node download that crashes on Wolfi (libatomic.so.1), and started the proxy
with zero tables while every DB-backed endpoint returned 500

The bake now lives at /opt/prisma, a path no HOME resolution or cache
volume mount can shadow. The builder records the engine paths there at
generate time, and the runtime stage pins PRISMA_BINARY_CACHE_DIR,
PRISMA_CLI_PATH, PRISMA_CLI_QUERY_ENGINE_TYPE=binary and
PRISMA_OFFLINE_MODE so both litellm-proxy-extras and prisma-python resolve
the baked CLI and engines directly. prisma migrate deploy on a fresh
database now needs no npm and no network access for any runtime uid,
including readOnlyRootFilesystem deployments

Verified against live containers: fresh and existing databases as root,
uid 12345, HOME overridden, on an internal-only docker network, and with
a read-only root filesystem all migrate and serve /team/new successfully

Fixes #33650, #24554

* chore(docker): fail the image build if the baked prisma CLI layout drifts

Asserts the baked CLI shim is executable and its entrypoint exists in the
runtime stage after the COPY and chmod, so a layout change in a future
prisma-python release breaks the image build loudly instead of silently
degrading the migration path at container startup
2026-07-18 14:52:40 -07:00