The isolate_litellm_state conftest fixture saved/restored litellm.callbacks
but never cleared it before each test, unlike the other callback lists. It
also didn't handle litellm.model_fallbacks. Leaked callbacks and fallback
config caused mocked tests to route through Router/fallback paths, hitting
real APIs with mock keys.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: preserve metadata for custom callbacks on codex/responses path (#21204)
- Use metadata or litellm_metadata when calling update_environment_variables
in responses/main.py so metadata is not overwritten by None on the
bridge path (completion -> responses API).
- Add tests for metadata in custom callback for codex models and for
litellm_metadata in aresponses().
Co-authored-by: Cursor <cursoragent@cursor.com>
* Update tests/test_litellm/responses/test_metadata_codex_callback.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>