From ed23e2e82dd208c6ef4f0a59374225ef3d3ffc4e Mon Sep 17 00:00:00 2001 From: yucheng Date: Wed, 23 Sep 2026 08:00:25 +0000 Subject: [PATCH] fix(proxy): reset batch line-item flag when the setting is absent Removing store_batch_line_items_in_callbacks from the DB general settings left the module flag at its previous value because the effect early-returned when the key was neither in the DB nor owned by YAML. The proxy owns the global, so an absent resolved value now writes False. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/proxy_server.py | 5 +---- tests/test_litellm/proxy/test_proxy_server.py | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index c08a7b8156d..9eab5478e3f 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -7586,11 +7586,8 @@ class ProxyConfig: async def _apply_batch_line_items_setting(self, db_values: Mapping[str, SettingsJsonValue]) -> None: key: Final = "store_batch_line_items_in_callbacks" - if key not in db_values and not self.settings.owned_by_config(key): - return value: Final = coerce_bool(self.settings.get(key)) - if value is not None: - litellm.store_batch_line_items_in_callbacks = value if isinstance(value, bool) else bool(value) + litellm.store_batch_line_items_in_callbacks = bool(value) if value is not None else False async def _apply_cache_size_setting( self, diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.py index 7fa63a95264..a52b119e02b 100644 --- a/tests/test_litellm/proxy/test_proxy_server.py +++ b/tests/test_litellm/proxy/test_proxy_server.py @@ -7890,6 +7890,12 @@ async def test_update_general_settings_store_batch_line_items_in_callbacks(): db_general_settings={"store_batch_line_items_in_callbacks": True} ) assert litellm.store_batch_line_items_in_callbacks is False + + proxy_config._yaml_general_settings_keys = set() + litellm.store_batch_line_items_in_callbacks = True # test-quality-ok: seed the prior opt-in so its removal is observable + with patch("litellm.proxy.proxy_server.general_settings", {}): # test-quality-ok: module-global seam + await proxy_config._update_general_settings(db_general_settings={}) + assert litellm.store_batch_line_items_in_callbacks is False finally: litellm.store_batch_line_items_in_callbacks = saved_flag