Commit graph

49820 commits

Author SHA1 Message Date
yassin
58c3ccf668 fix(proxy): keep org admins' own team memberships in other orgs visible on team list
An org admin listing their own teams on GET /team/list and GET /v2/team/list
only saw teams in the orgs they administer. Teams they belong to in other
orgs were dropped because the org scope and the membership scope were ANDed.
A self query now unions the two, while a query for another user keeps the
org boundary intersection.

Resolves LIT-3723

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 15:27:06 +00:00
Yassin Kortam
9e1ed40db3
Merge pull request #40927 from BerriAI/litellm_per_issuer_virtual_key_claim_field
feat(jwt): allow virtual_key_claim_field per issuer
2026-09-14 08:00:25 -07:00
Mateo Wang
e3051a7af9
Merge pull request #40996 from BerriAI/litellm_deflake_20260913 2026-09-14 07:13:53 -07:00
mateo
1661e72c2c fix(registry): drop retired friendliai llama-3.1 serverless models
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 13:21:46 +00:00
Yuneng Jiang
cfda6dea3e
test: cover persisted updates and warmed authorization policies 2026-09-14 04:20:06 -07:00
Yuneng Jiang
7ff8919827
test: collect owned cleanup processes immutably 2026-09-14 04:18:59 -07:00
Yuneng Jiang
16d7e695c0
test: stop proxy before cleaning up its query engine 2026-09-14 04:04:21 -07:00
Yuneng Jiang
d7c13625e9
test: qualify integration cleanup and replay invocation 2026-09-14 03:48:23 -07:00
Yuneng Jiang
92e0b72e2d
test: add CircleCI integration contract foundation 2026-09-14 03:30:52 -07:00
Devin AI
a70f9a17cc perf(logging): skip correlation contextvar stamping when request_correlation_in_logs is off
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 08:54:34 +00:00
HUAHAODIA
d84e0eabf3 fix lint review feedback (round 2)
- actually drop the ruff-strict-budget.json changes: the earlier
  checkout restored the edited HEAD version instead of main, so the
  twelve limit changes were still in the branch; budget ratcheting
  stays with the scheduled automation
- annotate validator_call as Final per repo convention
- drop the standalone comment duplicating the inline noqa reason
2026-09-14 16:42:35 +08:00
HUAHAODIA
57b9090292 chore: retrigger CLA re-evaluation 2026-09-14 15:42:27 +08:00
HUAHAODIA
74fe022988 chore: retrigger CLA evaluation 2026-09-14 15:32:10 +08:00
HUAHAODIA
b71eff40f8 fix lint review feedback
- restore the short-circuit in custom_team_metadata_validate: only
  touch __call__ when the plain coroutine-function check fails, so a
  raising descriptor on an async function is not newly triggered
- inline the noqa reasons per the suppression policy
- drop the ruff-strict-budget.json edit: budget ratcheting is reserved
  for the scheduled automation on the default branch
2026-09-14 15:09:53 +08:00
Devin AI
19c43eb875 test(cli): drop structural StrEnum source check; smoke job covers the 3.10 import
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 07:08:24 +00:00
Devin AI
0679d799d4 ci: exercise the lite CLI on the Python 3.10 import smoke job
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 07:07:06 +00:00
Devin AI
03e6dd051c fix(cli): drop enum.StrEnum so the CLI imports on Python 3.10
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 06:59:10 +00:00
ryan
c25498b66d fix(proxy): remove a bulk-deleted user's email-only roster entries without touching same-email teammates
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 06:08:42 +00:00
HUAHAODIA
29cdcf4880 chore(lint): graduate 12 rules from the strict-gate ratchet
Zeroes the remaining violations for 12 rules so they can hard-fail
in the main ruff config instead of being budget-ratcheted, and drops
their strict-gate budgets to 0:

- B021: drop useless f-prefix on the Javelin docstring
- C404 / C419: dict()/any() around unnecessary list comprehension
- PLR0124: replace the 'value == value' NaN idiom (and the separate
  +/-inf exclusion) with math.isfinite in _validate_response_time
- SIM201: 'not X == "function"' -> 'X != "function"'
- SIM211: 'False if x is False else True' -> 'x is not False'
- SIM222: drop literal 'None or' before "success"
- UP036: remove the dead sys.version_info < (3, 8) branch (and the
  now-unused sys import) in the weights_biases TYPE_CHECKING block
- B018 x2: keep the deliberate property side-effect access but assign
  it ('_ = self.prompt_manager') as the rule requires
- PLR0206: the unusable '@property def api_version(self, api_version)'
  (a property getter cannot take extra args) becomes a @staticmethod
  matching its siblings get_api_base/get_api_key; it had no callers
- PLR1704: rename the loop variable (and the nested helper parameter)
  that shadowed abatch_completion_fastest_response's 'model' argument
- B004 x2: scoped noqa with rationale — both sites retrieve __call__
  to unwrap functors for iscoroutinefunction, which is a value use,
  not the callability test B004 assumes; the callable() autofix would
  break them

N999 intentionally stays on the ratchet (limit 1): it flags the
'litellm/proxy/lambda.py' filename, which needs a module rename.

Verified: full-tree 'ruff check litellm' green with the graduated
rules enforced; ruff-strict counts for all 12 rules are 0; budget
JSON regenerated in the gate script's json.dumps style.
2026-09-14 14:04:08 +08:00
ryan
dbb4de7bc2 fix(proxy): match bulk-deleted users on team rosters by user_id only and give /team/bulk_member_delete the 60s batch timeout
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 05:59:19 +00:00
ryan
d442d90411 test(proxy): add /team/bulk_member_delete behavior-suite scenarios for route coverage
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 05:56:52 +00:00
ryan
450f7deff8 docs(proxy): shorten bulk delete endpoint descriptions to one sentence
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 05:46:02 +00:00
ryan
82872c9627 fix(proxy): run /user/bulk_delete team rewrites and user deletes in one transaction
Lock affected teams in sorted order inside a single 60s transaction so a
failure on any team rolls back every rewrite and every user row delete.
PrismaClient.tx() gains an optional timeout for the larger batch.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 05:35:55 +00:00
ryan
595aba3cb0 fix(proxy): evict deleted keys from the auth cache and make bulk user deletion transactional
/user/bulk_delete now deletes the users' keys, invitation links, org and team
memberships and user rows in one transaction and reports a rolled-back batch
per row instead of leaving partial deletes behind. Both bulk endpoints evict
the deleted keys (and deleted user objects) from the auth cache, so a deleted
key stops authenticating immediately rather than at TTL expiry.

/team/bulk_member_delete rejects member rows that carry both user_id and
user_email, reports repeated rows as duplicates, and only cleans up keys and
memberships of members it actually matched.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 05:12:34 +00:00
ryan
beaa96fc8f fix(proxy): log audit log failures in /user/bulk_delete instead of dropping them
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 04:57:27 +00:00
ryan
cd9c39921b feat(proxy): add POST /user/bulk_delete and POST /team/bulk_member_delete
Batch user deletion that also removes each user from every team they belong to, and batch removal of many members from one team. Each touched team is rewritten once under the team advisory lock from a roster re-read under that lock

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 04:55:39 +00:00
ryan
0c9e0c407e fix(proxy): keep a team on a /user/bulk_new row when the roster already lists that user id
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 03:37:20 +00:00
ryan
4285f1dfb0 fix(proxy): do not claim rows a concurrent request inserted when /user/bulk_new create_many fails
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 02:39:47 +00:00
ryan
7ec9e2a7e8 fix(proxy): log /user/bulk_new failures with exc_info instead of request-derived values
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 02:35:36 +00:00
ryan
f5e7294b46 fix(proxy): keep request identifiers out of /user/bulk_new log lines
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 02:12:54 +00:00
ryan
24a1d772b6 fix(proxy): keep key policy fields and reconcile committed rows in /user/bulk_new
Rows opting into auto_create_key lost blocked, permissions, aliases, config,
agent_id, budget_fallbacks and budget_limits before reaching the key helper.
When create_many commits but the response is lost, re-read which ids landed
and retry only the rest so committed rows report success and get their teams.
Regenerate schema.d.ts and allowlist the endpoint in the Terraform audit.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 01:48:44 +00:00
ryan
ff5b59b173 feat(proxy): add POST /user/bulk_new for batched user and team membership creation
Creates up to 500 internal users in one request with set-based validation,
a single create_many for user rows, and one locked write per referenced team.
Rows fail independently, keys are opt-in per row via auto_create_key, and
send_invite_email is rejected for the batch.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 01:17:19 +00:00
ryan
0201ca60e7 fix(ui): move tags typed into key metadata JSON into the Tags field
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 23:09:27 +00:00
yassin
a41b719920 fix(proxy): refund batch TPD reservation on failure and report active window reset time
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 10:56:17 +00:00
yassin
c47120cbf7 fix(proxy): add tpd_limit to deleted token table and fix CI fixtures
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 10:31:35 +00:00
mateo-berri
fff7a2cecf fix(responses): keep context-window events out of mid-stream fallback and fix stale exception assertions 2026-09-13 03:18:59 -07:00
github-actions[bot]
aad2a774cd chore: sync schema.prisma copies from root 2026-09-13 10:08:49 +00:00
yassin
438d46cb50 feat(proxy): add tpd_limit (tokens per day) for batch submissions
Adds a nullable tpd_limit column and field to keys, teams, budgets and end users. The batch submission limiter swaps the per-minute RPM/TPM descriptor of any scope that has a tpd_limit for a token-only 24h descriptor, so batch traffic is budgeted per day while online traffic keeps the existing per-minute limits. The Admin UI exposes the field on key, team and budget create/edit forms

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 10:06:07 +00:00
mateo-berri
2923c4ac55 fix(guardrails): read the rewrite from texts when a guardrail echoes every row back unchanged 2026-09-13 03:02:15 -07:00
mateo-berri
7ea19eccc7 fix(responses): keep namespace custom tools through guardrail merges and Mantle params identity 2026-09-13 03:02:03 -07:00
mateo
db79226b6b test(auth): freeze the cache clock in auth prefetch tests
The org cache entries written by prefetch_auth_objects carry the 5s
DEFAULT_IN_MEMORY_TTL. The first @log_db_metrics getter lazily imports
litellm.proxy.proxy_server, which on a cold CI runner can take longer
than 5s, so the org entry expired before get_org_object read it and the
getter fell through to the MagicMock database. Inject a frozen clock
into InMemoryCache so the test asserts the join, not import latency.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:59:39 +00:00
yassin
e41b3bd13f test(router): annotate return types of team cooldown test helpers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:50:12 +00:00
yassin
e61b6bfd5f fix(router): classify pass-through cooldown against pass-through deployments only
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:48:35 +00:00
mateo-berri
6264bd84bf chore(ui): regenerate dashboard API types 2026-09-13 02:43:36 -07:00
mateo-berri
dd173a0b1b fix(guardrails): count the PANW latest-user scan over the hoisted system prompt 2026-09-13 02:43:35 -07:00
yassin
9080f0904a fix(router): ignore blocked siblings when checking team model cooldown alternatives
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:35:54 +00:00
mateo-berri
c246372859 fix(responses): import BaseLLMException lazily and collect stream chunks via anext
Move the BaseLLMException import into _map_error_event_exception so the
module no longer imports it at load time, clearing the module-level cyclic
import CodeQL flagged. The class is used only on the cold error path.

Replace the mutable list-append test collector with aiter/anext so the
regression tests read the stream immutably.
2026-09-13 02:35:53 -07:00
yassin
10f411e60d fix(router): name the all-deployments-in-cooldown error on 429 responses
RouterRateLimitError now carries the model group's deployment ids so it
can tell when every deployment is cooled down, and exposes that as
type=all_deployments_in_cooldown with an explicit message. A partial
cooldown keeps type=rate_limit_error. Either way the proxy no longer
reports type=internal_server_error next to code 429

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:34:16 +00:00
mateo-berri
37447c98f7 fix(guardrails): reject per-message texts that cannot land on a string input or a Messages request 2026-09-13 02:28:43 -07:00
yassin
d0a846c8be test(router): cover team_model_has_alternatives directly in the mapped router test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-13 09:27:33 +00:00