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>
This commit is contained in:
yucheng 2026-09-23 08:00:25 +00:00
parent 4b6efef9de
commit ed23e2e82d
2 changed files with 7 additions and 4 deletions

View file

@ -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,

View file

@ -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