litellm/tests/test_litellm/proxy/copilot_oauth_endpoints
Jason Cook 9167f9725b feat(oauth): refuse /start when STORE_MODEL_IN_DB is not set
Without STORE_MODEL_IN_DB=True the proxy still writes OAuth credentials
to LiteLLM_CredentialsTable, but ``proxy_config.get_credentials`` — the
DB → ``litellm.credential_list`` reload run at startup — lives inside
``if store_model_in_db is True:`` in proxy_server.py. Result: silent
data loss on restart and request-time ``api_key: oauth:<name>`` failures
because the name is no longer in the in-memory cache.

Gate the /start endpoints (both ChatGPT and Copilot) behind
``get_secret_bool("STORE_MODEL_IN_DB", False)``. Admins get a clear 400
up front instead of sitting through the 15-minute device-code poll only
to discover the flow silently doesn't persist.

Tests: setenv STORE_MODEL_IN_DB=True in the autouse fixture so the
success-path tests don't each have to opt in, plus one new test per
provider asserting 400 + message when the env var is absent. 167 cases
pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 11:48:02 -04:00
..
__init__.py feat(chatgpt, github_copilot): OAuth sign-in + token refresh in proxy UI 2026-04-16 20:30:10 -04:00
test_copilot_oauth_endpoints.py feat(oauth): refuse /start when STORE_MODEL_IN_DB is not set 2026-04-23 11:48:02 -04:00