Commit Graph

36771 Commits

Author SHA1 Message Date
Ryan Crabbe
84d7816bc9
refactor(ui/team): extract GuardrailSettingsView and reuse across team views
Pulls the Global / Team-specific subsection rendering out of
TeamInfo.tsx into a shared GuardrailSettingsView component with
card and inline variants, used on both the team Overview tab
(inside the existing Tremor Card) and the Team Settings tab read
view. The Global subsection header now carries a GlobalOutlined
icon, and since the icon is load-bearing the edit-form chip
coloring is simplified to a single blue instead of green/blue.
2026-04-13 11:38:23 -07:00
Ryan Crabbe
1dcccfc1d1
feat(ui/team): show guardrails in team settings read view
The Team Settings tab's read view listed every team field except
guardrails. Adds a Guardrails entry after Status with the same
Global / Team-specific subsections used on the Overview tab, so
the kill switch state and per-section membership are visible
without entering edit mode.
2026-04-13 11:08:39 -07:00
Ryan Crabbe
6ae693b85c
refactor(ui/team): split team read view guardrails into Global and Team-specific sections
Replaces the flat guardrails list with two subsections under the
Guardrails card, so the global vs. team-specific distinction is
carried by the section headers instead of per-badge markers. The
kill-switch state now renders in place of the Global subsection as
"Bypassed for this team", and the separate "Disable Global
Guardrails" field with its confusing "Disabled - Global guardrails
active" badge is removed.
2026-04-13 10:57:10 -07:00
Ryan Crabbe
1f57292363
fix(ui/team): add GlobalOutlined icon to global guardrail markers
Addresses a11y feedback — global vs. non-global guardrails were
distinguished only by color (green vs. blue). Adds GlobalOutlined
next to global guardrails in (1) the selected-chip tagRender, (2)
the dropdown OptGroup label, and (3) the team info read view badge.
2026-04-13 10:55:09 -07:00
Ryan Crabbe
30c2357fe3
fix(ui/team): annotate effectiveGuardrails as string[] for strict typecheck
The new effectiveGuardrails computation derived its element type from
`info.metadata?.guardrails`, which is implicitly typed `any[]`, so the
downstream `.map((name) => ...)` callback inferred `name` as implicit
`any` and broke the production typecheck.
2026-04-11 17:48:16 -07:00
Ryan Crabbe
3d72e2a6f3
fix(guardrails): address PR #25575 review feedback + sync kill switch with opt-out list
Renames the new per-guardrail opt-out field from `disabled_global_guardrails`
to `opted_out_global_guardrails` to eliminate the one-character collision with
the legacy `disable_global_guardrails` boolean kill switch. Adds a type guard
on the new gate so a misnamed bool can't crash the guardrail check. Filters
duplicates out of the team-edit guardrail display for legacy teams that have a
global name persisted in `metadata.guardrails` from before this PR. Drops the
unused `isGuardrailsLoading` and `guardrailsError` destructures left in
AddModelForm after the hook refactor.

Adds Python tests for the new gate behavior (root, litellm_metadata, metadata,
non-matching name, empty list, malformed bool value, opt-in coexistence) and
extends useGuardrails.test.ts to exercise the global / optional partition
logic that the rebuilt hook performs in its `select` transform.

Wires the legacy kill switch and the new opt-out list together in the team
edit form so they can never fall out of sync:

- Toggling the kill switch reactively updates the Guardrails Select via
  `onValuesChange` — switch on strips all globals from the selection, switch
  off re-adds them. Existing opt-in extras are preserved either way.
- When the switch is on, global options in the Select are individually
  disabled (greyed out) so the user can still manage opt-in guardrails but
  cannot accidentally re-enable a global the kill switch is bypassing.
- The save handler writes both fields together: `disable_global_guardrails`
  reflects the switch, and `opted_out_global_guardrails` is set to either
  every global (when the switch is on) or the user's explicit opt-outs.
- `effectiveGuardrails` for the form's initialValues honors the kill switch
  on legacy teams so the form opens in a state that matches what the runtime
  gate is actually doing — fixes the visual lie where chips appeared active
  while the switch was bypassing them.

The backend gate already reads the list as the primary path with the bool
as a fallback, so untouched legacy teams keep working until they get edited,
at which point they migrate naturally.
2026-04-11 17:48:16 -07:00
Ryan Crabbe
59f66af0f9
fix(ui/team): wait for useGuardrails to resolve before rendering edit form
The team edit form computed its `guardrails` initialValues from
`globalGuardrailNames`, which is empty until `useGuardrails` resolves.
Because Ant Design's `<Form initialValues>` is read once on mount, a
user who clicked Edit before the query resolved would see globals
missing from the Select and could save that stale state, silently
opting the team out of every global guardrail.

Gate the form on `!isGuardrailsLoading` so initialValues always sees
the resolved set.
2026-04-11 17:48:16 -07:00
Ryan Crabbe
f9639654fa
feat(ui/team): per-guardrail opt-out for global guardrails
Replace the team info page's tags-mode guardrails Select with a grouped
multi-select that splits guardrails into "Global" (default_on=true) and
"Other" sections. On submit, derive both metadata fields from the single
selection array:

  - metadata.guardrails: non-global opt-ins (additive)
  - metadata.disabled_global_guardrails: globals the team has opted out of

The legacy disable_global_guardrails kill-switch toggle stays alongside
the multiselect and remains semantically distinct: it kills all global
guardrails including any added in the future, while the new list lets
new globals auto-apply unless explicitly excluded.

Other changes:
  - Switch from a manual useEffect/useState guardrails fetch to the
    consolidated useGuardrails hook
  - Replace stale "Select existing guardrails or enter new ones" help
    text with a single tooltip on each section's info icon
  - Render selected chips with green/blue color coding via tagRender so
    global vs non-global is visible without opening the dropdown
  - Drop the redundant [Global] tag from inside the OptGroup options
    (the group label already conveys it)
  - Update the read-only display to show the effective set (globals not
    opted out + additive opt-ins) with [Global] suffix on globals
2026-04-11 17:48:16 -07:00
Ryan Crabbe
a9d64f8620
refactor(ui/guardrails): expose full data from useGuardrails hook
Extend useGuardrails to return the full guardrail objects plus derived
globalGuardrailNames / optionalGuardrailNames sets via React Query's
select option, instead of just an array of names. Update its existing
consumer (AddModelForm) to extract names from the new shape.

The previous shape was tailored to AddModelForm's single use case
(populate a Select with names). The team info per-guardrail opt-out
work needs default_on per guardrail to split globals from non-globals,
which the old shape couldn't provide. Consolidating into the existing
hook gives both consumers one source of truth and one React Query
cache entry instead of two parallel fetches.

- useGuardrails.ts: rewrite return type, derive global/optional sets
  in select(); preserve the existing query key and auth-gate semantics
- AddModelForm.tsx: extract names from data?.guardrails.map(...)
- AddModelForm.test.tsx: update mock to return the new shape (also
  fixes a pre-existing shape mismatch in the mock)
- useGuardrails.test.ts: update 3 assertions to read names via
  data?.guardrails.map(...) instead of asserting against the flat array
2026-04-11 17:48:16 -07:00
Ryan Crabbe
88beed905e
feat(guardrails): per-team opt-out for specific global guardrails
Add disabled_global_guardrails list field to team metadata that
selectively skips named globals at request time. Coexists with the
existing disable_global_guardrails boolean kill switch — the boolean
kills all globals (including future ones), the new list selectively
skips named ones (new globals auto-apply).

The field lives in the team metadata JSON column; no schema migration.

- litellm/proxy/litellm_pre_call_utils.py: propagate the field from
  team_metadata into per-request data.metadata
- litellm/integrations/custom_guardrail.py: new
  get_disabled_global_guardrails_from_metadata helper plus a
  scoped-to-globals early return at the top of should_run_guardrail
2026-04-11 17:48:16 -07:00
Ryan Crabbe
ef38c665ca
fix(guardrails): use plural key in get_disable_global_guardrail
Rename disable_global_guardrail → disable_global_guardrails to match
the key name used by litellm_pre_call_utils.py, the API endpoints,
and the UI when propagating key/team metadata.

The singular form was introduced in PR #16983 and has never matched
the plural form written by the rest of the codebase, so the feature
silently did nothing.

Re-applies fix originally from #25488. Original commit could not be
merged due to missing signature.

Co-Authored-By: Remi Mabon <remi.mabon@redcare-pharmacy.com>
2026-04-11 17:35:50 -07:00
Krrish Dholakia
01b9b50b43
Add Screenshots / Proof of Fix section to PR template (#25564)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
2026-04-11 10:20:34 -07:00
Krrish Dholakia
4e12d3c562
docs: document april townhall announcements (#25537)
* docs: document april townhall announcements

* docs: cleanup blog post
2026-04-10 16:12:06 -07:00
yuneng-jiang
d67b5f8b08
Merge pull request #25526 from BerriAI/litellm_yj_04_09_2026
[Infra] Merge Dev Branch with Main
2026-04-10 15:30:23 -07:00
yuneng-jiang
f2f2a91a29
Merge pull request #25480 from BerriAI/litellm_/eloquent-allen
[Fix] Flush Tremor Tooltip timers in user_edit_view tests
2026-04-10 15:11:27 -07:00
yuneng-jiang
9e4352afb4
Merge pull request #25528 from BerriAI/yj_bump_10
bump: version 1.83.5 → 1.83.6
2026-04-10 13:28:51 -07:00
Yuneng Jiang
1f148ea6a1
bump: version 1.83.5 → 1.83.6 2026-04-10 13:20:58 -07:00
yuneng-jiang
193a57b5d2
Merge pull request #25478 from BerriAI/litellm_align_list_response_field_handling
[Fix] Align v1 guardrail and agent list responses with v2 field handling
2026-04-10 13:12:17 -07:00
yuneng-jiang
576e6a06e3
Merge pull request #25517 from BerriAI/litellm_bedrock-messages-cache-prompt-double-count
fix(bedrock): avoid double-counting cache tokens in Anthropic Messages streaming usage
2026-04-10 12:54:59 -07:00
yuneng-jiang
ec524a0e7a
Merge pull request #25513 from BerriAI/litellm_fix_ws_duplicate_kwarg
[Fix] Responses WebSocket Duplicate Keyword Argument Error
2026-04-10 12:41:15 -07:00
Sameer Kankute
f0d2d26301
fix(bedrock): avoid double-counting cache tokens in Anthropic Messages streaming usage
Made-with: Cursor
2026-04-11 00:03:45 +05:30
Yuneng Jiang
2a4e5b59fd
fix(responses): prevent duplicate kwargs in WebSocket call
Filter all explicitly-passed keys from remaining_kwargs before
spreading into async_responses_websocket(). The router now injects
custom_llm_provider into kwargs (via #25334), which collides with
the explicit custom_llm_provider= argument.
2026-04-10 11:13:17 -07:00
yuneng-jiang
d0e347af32
Merge pull request #25473 from BerriAI/litellm_auth_rbac_cleanup
refactor: consolidate route auth for UI and API tokens
2026-04-10 09:14:42 -07:00
Ryan Crabbe
3af7de4222
retain ui_routes enum alias for JWT config backwards compatibility 2026-04-10 08:55:32 -07:00
Yuneng Jiang
a771e1939c
Fix unhandled "window is not defined" error in user_edit_view tests
Tremor's internal Tooltip component sets a setTimeout that fires after
the jsdom test environment tears down, causing a ReferenceError. Add
afterEach that flushes pending timers before cleanup.
2026-04-10 00:10:40 -07:00
Yuneng Jiang
28bce0b05e
fix: align v1 guardrail and agent list responses with v2 field handling 2026-04-10 00:00:53 -07:00
yuneng-jiang
5666ed04ca
Merge pull request #25475 from BerriAI/litellm_harden_skill_file_paths
[Fix] Harden file path resolution in skill archive extraction
2026-04-09 23:00:57 -07:00
Yuneng Jiang
9a4f5d7316
fix: remove unnecessary f-string prefix in SQL query 2026-04-09 22:47:13 -07:00
Yuneng Jiang
820b45784c
Merge remote-tracking branch 'origin/main' into litellm_harden_skill_file_paths 2026-04-09 22:46:23 -07:00
Yuneng Jiang
6a15adcd64
fix: harden file path resolution in skill archive extraction 2026-04-09 21:59:23 -07:00
Yuneng Jiang
e828a91eee
[Docs] Add missing MCP per-user token env vars to config_settings
MCP_PER_USER_TOKEN_DEFAULT_TTL and MCP_PER_USER_TOKEN_EXPIRY_BUFFER_SECONDS
were added in #25441 but not documented, causing test_env_keys.py to fail.
2026-04-09 21:49:06 -07:00
joereyna
b7d7b93eb9
fix(responses-ws): use urllib.parse to append model param, fix test mocking 2026-04-09 21:49:06 -07:00
joereyna
1264bf3f8e
fix(responses-ws): append ?model= to backend WebSocket URL 2026-04-09 21:49:06 -07:00
Yuneng Jiang
236bb4f59f
address greptile review feedback (greploop iteration 1)
Remove leftover 10000ms per-test timeout in add_model_tab.test.tsx that was
missed in the initial sweep. The test now inherits the 30000ms global.
2026-04-09 21:49:06 -07:00
Yuneng Jiang
06f3679778
[Test] UI - Unit tests: raise global vitest timeout and remove per-test overrides
Raise vitest testTimeout from 10s to 30s and drop per-test timeout overrides
across UI unit tests. Group CreateUserButton and TeamInfo tests under nested
describe blocks to make the most flaky suites easier to scan.
2026-04-09 21:49:06 -07:00
Yuneng Jiang
df3ddd7a81
[Fix] Let setSecureItem propagate storage errors to callers
Remove the silent try/catch from setSecureItem so OAuth hooks can
surface actionable "enable storage" guidance instead of a cryptic
"state lost" error after the round-trip. Add a local try/catch in
ChatUI where the storage write is non-critical.
2026-04-09 21:49:06 -07:00
yuneng-jiang
4e068718c9
Update docker/Dockerfile.custom_ui
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-04-09 21:49:06 -07:00
Yuneng Jiang
464c98878e
[Fix] Address review feedback on storage utility and Dockerfiles
- Dockerfile.health_check: HEALTHCHECK now verifies the script is intact
  instead of unconditionally exiting 0
- secureStorage.ts: replace deprecated escape/unescape with
  encodeURIComponent/decodeURIComponent; don't delete legacy values on
  decode failure so in-flight flows can time out naturally
- OAuth callback: add same-origin check before redirecting to stored
  return URL
2026-04-09 21:49:06 -07:00
Yuneng Jiang
4272d80c83
fix(docker): add non-root USER and HEALTHCHECK to Dockerfile.custom_ui
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 21:49:06 -07:00
Yuneng Jiang
a12ba1f4d1
[Fix] UI: resolve CodeQL security alerts and Dockerfile.health_check hardening
Port security fixes from litellm_v1.82.3.dev.6:
- Use secureStorage (sessionStorage wrapper) instead of raw storage for tokens
- Add URL validation for stored worker URLs to prevent open redirects
- Add same-origin checks before redirecting to stored return URLs
- Harden Dockerfile.health_check with non-root user and exec-form HEALTHCHECK
2026-04-09 21:49:06 -07:00
Chetan Soni
8dc5ab39f0
feat(mcp): add per-user OAuth token storage for interactive MCP flows 2026-04-09 21:49:06 -07:00
joereyna
f8ae642736
format vertex test file 2026-04-09 21:49:06 -07:00
joereyna
fb527ae250
fix(test): mock headers in test_completion_fine_tuned_model 2026-04-09 21:49:06 -07:00
Ryan Crabbe
26e99f22b3
refactor: consolidate route auth for UI and API tokens
Unify UI and API token authorization through the shared RBAC path
and backfill missing routes in role-based route lists.
2026-04-09 21:36:35 -07:00
yuneng-jiang
9e6d2d2069
Merge pull request #25468 from BerriAI/litellm_/compassionate-shannon
[Test] UI - Unit tests: raise global vitest timeout and remove per-test overrides
2026-04-09 21:35:43 -07:00
Yuneng Jiang
c7f610c57e
Merge remote-tracking branch 'origin/main' into litellm_/compassionate-shannon 2026-04-09 21:15:03 -07:00
yuneng-jiang
42e5583788
Merge pull request #25471 from BerriAI/litellm_doc_mcp_per_user_token_env_vars
[Docs] Add missing MCP per-user token env vars to config_settings
2026-04-09 21:13:10 -07:00
Yuneng Jiang
ce0b57b4ff
[Docs] Add missing MCP per-user token env vars to config_settings
MCP_PER_USER_TOKEN_DEFAULT_TTL and MCP_PER_USER_TOKEN_EXPIRY_BUFFER_SECONDS
were added in #25441 but not documented, causing test_env_keys.py to fail.
2026-04-09 21:04:34 -07:00
yuneng-jiang
1214dc93b3
Merge pull request #25467 from jaydns/fix/parameterize-combined-view-query
fix(proxy): use parameterized query for combined_view token lookup
2026-04-09 21:03:24 -07:00
yuneng-jiang
9b33d9d427
Merge pull request #25445 from jaydns/fix/proxy-input-validation
fix(proxy): improve input validation on management endpoints
2026-04-09 21:02:52 -07:00