Repository navigation
Conversation
…rriAI#25855) Bedrock enforces non-increasing TTL ordering across cache_control blocks (tools → system → messages). The tool cache_control TTL was being unconditionally dropped to the default 5m, while system blocks preserved the user-specified TTL for Claude 4.5+ models. This mismatch caused "a ttl='1h' block must not come after a ttl='5m' block" errors when users set ttl='1h' on both tools and system. Converse path: add_cache_point_tool_block() now accepts a model param and preserves TTL for Claude 4.5+, matching _get_cache_point_block(). Invoke path: _remove_ttl_from_cache_control() now also processes tools (was only processing system and messages). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…onses (BerriAI#20270) (BerriAI#26262) * fix(proxy): invoke post-call guardrails on pass-through endpoint responses (BerriAI#20270) Wire post_call_success_hook into non-streaming pass-through response path, gated on explicit guardrail config (opt-in only, no backwards-compat break). - Call post_call_success_hook after reading non-streaming response body - Build enriched hook_data with guardrails metadata and litellm_logging_obj at call site (avoids mutation of _parsed_body which is shared by logging) - Handle ModifyResponseException with provider-agnostic error envelope, post_call_failure_hook, and defensive try/except - Strip stale content-length when guardrail modifies response body - Move ModifyResponseException to litellm.exceptions to break cyclic import; re-export from custom_guardrail for backwards compat - Add call_type fallback in UnifiedLLMGuardrails for pass-through endpoints using CallTypes.pass_through.value enum * test: add unit tests for pass-through post-call guardrails 5 tests covering the post-call guardrail invocation on pass-through endpoints: - post_call_success_hook fires when guardrails configured - post_call_success_hook skipped when no guardrails (backwards compat) - ModifyResponseException returns 200 with provider-agnostic error - UnifiedLLMGuardrails resolves call_type from logging_obj for pass-through - ModifyResponseException re-export from custom_guardrail stays in sync
…BerriAI#26122) tool_calls on assistant messages were translated to OllamaToolCall format but never copied into the outgoing OllamaChatCompletionMessage, so Ollama received {role: assistant, content: ''} with no tool_calls. The model then had no record of having made a tool call, causing it to re-issue the identical call on every turn (infinite loop). Similarly, tool_call_id on role:tool messages was silently dropped. Ollama uses this field to resolve the tool name from conversation history. Also add tool_call_id to OllamaChatCompletionMessage TypedDict. Fixes BerriAI#26094
Low: Formatting and UI fix for dict-shaped fallback entriesThis PR is mostly formatting changes across Python files, plus a UI fix to properly render dict-shaped fallback entries in router settings. The new masking logic for sensitive keys in fallback override dicts is client-side only and covers the common cases (string values for keys matching api_key, token, secret, password, authorization). The data already arrives at the authenticated admin client from the server, so the masking is a cosmetic defense-in-depth measure. No exploitable security issues found. Status: 0 open Posted by Veria AI · 2026-04-25T19:56:11.551Z |
979fddd to
ba93eba
Compare
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
Greptile SummaryThis PR fixes a React error #31 crash in the router-settings Fallbacks UI when Confidence Score: 5/5Safe to merge — no P0/P1 findings; both previously flagged issues are fully addressed. All changes are well-scoped: the UI crash fix is correct, ChainCard is now at module level, secret masking covers both the tooltip and the display-label (including the no-model-field edge case). Seven tests lock in the regressions. Python file changes are formatting-only with zero logic impact. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx | Core fix: widened FallbackChainItem type, moved ChainCard to module level, added maskSensitiveOverrideValues and getFallbackChainItemDisplayName; both previously flagged issues (secret leak in label, component-in-render) are resolved. |
| ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx | Adds 7 new regression tests (PR description says 5) covering the crash fix, override badge, mixed entries, round-trip safety, and secret masking including the no-model-field edge case; existing tests reformatted but logic unchanged. |
| litellm/litellm_core_utils/prompt_templates/factory.py | Cosmetic reformatting of .format() call to satisfy line-length linting; no logic change. |
| litellm/llms/predibase/chat/transformation.py | Cosmetic reformatting of long conditionals and a for-loop expression to meet line-length limits; no logic change. |
| litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py | Reformatted long boolean condition and added missing trailing newline; no logic change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["FallbackChainItem\n(string | FallbackOverride)"] --> B{typeof item}
B -->|string| C["displayName = item"]
B -->|object| D{item.model\nexists?}
D -->|yes| E["displayName = item.model"]
D -->|no| F["displayName =\nJSON.stringify(\n maskSensitiveOverrideValues(item)\n)"]
C --> G["ChainCard: plain span\n(no override badge)"]
E --> H["ChainCard: span + override Tag"]
F --> H
H --> I["Tooltip with\nmaskSensitiveOverrideValues(item)\nas JSON preview"]
G --> J["Rendered in\nrenderFallbacksChain"]
I --> J
Reviews (3): Last reviewed commit: "chore: apply black formatting to unblock..." | Re-trigger Greptile
ba93eba to
1d63c91
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Router runtime accepts dict chain items like
{model, api_key, extra_headers, ...} (used to override request-level
auth on a fallback attempt). Admin UI typed each item as `string` and
rendered it directly as a React child, crashing the router settings
page with React error BerriAI#31 ("Objects are not valid as a React child
(found: object with keys {model, api_key, extra_headers})").
Widen FallbackChainItem to `string | {model?: string, ...}`, derive a
display name, tag dict entries with an "override" badge, and surface
the override JSON via a tooltip with api_key / authorization / token /
secret / password (and matching extra_headers keys) masked so secrets
never enter the DOM. Add/delete flows already preserved unrelated
entries, so dict items round-trip safely with no backend changes.
Adds 5 regression tests in Fallbacks.test.tsx covering: no-crash
render, override marker, mixed string+dict chains, sibling-row delete
preserves dict entries, and api_key masking in DOM.
Fixes BerriAI#26473
Three files on litellm_oss_branch are not black-formatted, which fails the lint check on every PR. Apply black with no functional changes. Same pattern as aefb54f.
1d63c91 to
1efcbce
Compare
cd88dde to
c014bfa
Compare
Relevant issues
Fixes #26473
Pre-Submission checklist
ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx. UI-only change, sotests/test_litellm/does not apply here.npm run build✅), vitest passes (47/47 inRouterSettings/**, 20/20 inFallbacks.test.tsx).make test-unitnot impacted — no Python files touched.@greptileaiafter the PR is open.Type
🐛 Bug Fix
Changes
Problem
router_settings.fallbacksaccepts dict-shaped chain entries at runtime, e.g.This shape is used to override request-level params (notably
api_key/Authorization) on the fallback attempt — important when the primary model uses request-injected auth that must not carry over to the fallback. Runtime support lives inlitellm/router_utils/fallback_event_handlers.py:122-132(kwargs.update(mg)for dict items) and_check_non_standard_fallback_format.The Admin UI's
Fallbacks.tsxtyped each chain entry asstringand rendered it directly as a React child, so any dict entry crashed the router-settings page:(React error #31 — exactly what the issue reports.)
Fix (UI-only)
ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx:FallbackChainItem = string | { model?: string; [key: string]: any }.getFallbackChainItemDisplayName()to resolve the visible label from string, dict.model, or stringified JSON.ChainCardnow tags dict entries with anoverridebadge and shows the override JSON in a tooltip on hover.api_key,authorization,token,secret,password(and matching keys insideextra_headers) are masked with••••••so secrets never enter the DOM.\${i}-\${displayName}) since the same model can repeat across overrides.The existing add/delete flows already preserved unrelated entries unchanged, so dict items round-trip safely with no backend changes.
UpdateRouterConfig.fallbacks: Optional[List[dict]]already permits the dict shape on/config/update.Tests
ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsxadds 5 cases underdict-shaped fallback chain entries:overridetag for the dict, none for the string.setCallbacksCalltriggered by deleting another row.Suite results:
Fallbacks.test.tsx: 20/20 ✅ (15 pre-existing + 5 new)RouterSettings/**: 47/47 ✅npm run build: ✅tsc --noEmit(filtered to touched files): clean ✅Repro confirmation
I temporarily reverted the patch and ran the new dict-fallback test. It produced the exact error from the issue:
With the patch applied the same render shows the model name, an
overridetag, and a masked-JSON tooltip — no crash.Screenshots / Proof of Fix
(Vitest output rather than screenshots, since the proof is a render-crash assertion):