From 110e87cce61d1b978b749cac09e0ab5dd2a224d1 Mon Sep 17 00:00:00 2001 From: lei_lei <96427312+leilei3167@users.noreply.github.com> Date: Mon, 31 Aug 2026 09:04:27 +0000 Subject: [PATCH] fix(health): satisfy type-discipline LIT001/LIT002 on probe strip Annotate the required mutable dict copy/filter so the gate does not count new dict annotations or constructions. --- litellm/proxy/health_check.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/health_check.py b/litellm/proxy/health_check.py index 3f67b8b477c..976e9eb2de8 100644 --- a/litellm/proxy/health_check.py +++ b/litellm/proxy/health_check.py @@ -128,9 +128,15 @@ def _is_health_check_model_metadata_key(key: str) -> bool: return key.startswith("supports_") or key in _HEALTH_CHECK_MODEL_METADATA_KEYS -def _strip_model_metadata_from_health_params(litellm_params: dict) -> dict: +def _strip_model_metadata_from_health_params( + litellm_params: Mapping[str, object], +) -> dict: # mutable-ok: ahealth_check kwargs and LiteLLM_Params(**probe) need a mutable dict """Drop model_info capability keys that leaked onto the health-check probe params.""" - return {k: v for k, v in litellm_params.items() if not _is_health_check_model_metadata_key(k)} + return { # mutable-ok: ahealth_check kwargs and LiteLLM_Params(**probe) need a mutable dict + k: v + for k, v in litellm_params.items() + if not _is_health_check_model_metadata_key(k) + } def _get_process_rss_mb() -> float | None: @@ -755,7 +761,7 @@ def _update_litellm_params_for_health_check(model_info: dict, litellm_params: di the provider request body (#38941) """ # Copy first: callers pass the live deployment litellm_params dict. - litellm_params = dict(litellm_params) + litellm_params = dict(litellm_params) # mutable-ok: copy so probe mutations don't rewrite the shared deployment dict # rebind-ok: local probe copy mode: Final = _resolve_health_check_mode( model_info, litellm_params, # any-ok: untyped router config dict