Repository navigation
fix(auth): refresh lite session token team models from team row - #40318
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Merging this PR will not alter performance
Comparing |
Greptile SummaryThis PR refreshes CLI session-token team models and aliases from the current team row during authentication
Confidence Score: 4/5The behavior is covered, but the repository requirements on critical-path database access and variable rebinding must be satisfied before merging The refresh works for normal CLI requests, but it permits database fallback during authentication and rebinds valid_token contrary to explicit repository guidance Files Needing Attention: litellm/proxy/auth/user_api_key_auth.py
|
| Filename | Overview |
|---|---|
| litellm/proxy/auth/user_api_key_auth.py | Refreshes session-token team grants but violates critical-path database-access and variable-rebinding requirements |
| tests/test_litellm/proxy/auth/test_user_api_key_auth.py | Adds focused mocked regression tests for refreshed grants and lookup-failure fallback |
Reviews (1): Last reviewed commit: "fix(auth): refresh lite session token te..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
#40657 re-reads the team row on each lite login request so team model changes apply. Reopen if it still happens or something is missing |
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
TLDR
Problem this solves:
lite logintokens freeze the team's model list at login timeHow it solves it:
team_modelsandteam_aliasfrom itUser Flow
Before: a developer who logged in with
lite logincannot see models the admin just added to their teamlite login, pick their team, and the token lands in their CLI configlite models listand seegpt-4o-minianthropic-haiku-4-5to the team's modelslite models listagain and still see onlygpt-4o-mini. GET https://litellm-domain/v1/models with the same token returns the same single modellite logoutandlite loginagain before the new model appearsAfter: the same token reflects team changes right away
lite login, pick their team, and the token lands in their CLI configlite models listand seegpt-4o-minianthropic-haiku-4-5to the team's modelslite models listagain and now see bothanthropic-haiku-4-5andgpt-4o-mini. GET https://litellm-domain/v1/models returns bothanthropic-haiku-4-5from the team, the nextlite models listno longer shows itRelevant issues
Reported by a customer (Pylon #8334)
Linear ticket
Resolves LIT-7358
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Setup: proxy on
litellm/proxy/dev_config.yaml(master keysk-1234). Teamcli-teamcreated withmodels: ["gpt-4o-mini"], internal usercli-repro-useradded to it. SSO is not available locally, so the session token was minted with the same server-side call thelite loginpoll endpoint uses (ExperimentalUIJWTToken.get_cli_jwt_auth_token(..., team_id=<team_id>, team_models=["gpt-4o-mini"])), then used from the real CLI viaLITELLM_PROXY_API_KEY.Before (5b2b542)
LITELLM_PROXY_URL=http://localhost:4000 LITELLM_PROXY_API_KEY=<session_token> lite models listcurl -X POST http://localhost:4000/team/update -H "Authorization: Bearer sk-1234" -d '{"team_id":"<team_id>","models":["gpt-4o-mini","anthropic-haiku-4-5"]}'returns"models":["gpt-4o-mini","anthropic-haiku-4-5"]lite models listagaincurl http://localhost:4000/v1/models -H "Authorization: Bearer <session_token>"After (a443a68)
["gpt-4o-mini","anthropic-haiku-4-5"].lite models listcurl http://localhost:4000/v1/models -H "Authorization: Bearer <session_token>"curl -X POST http://localhost:4000/team/update -H "Authorization: Bearer sk-1234" -d '{"team_id":"<team_id>","models":["gpt-4o-mini"]}'returns"models":["gpt-4o-mini"]lite models listagaincurl http://localhost:4000/v1/models -H "Authorization: Bearer <session_token>"Type
🐛 Bug Fix
Caveats (if any)
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/7e9513eb967049fa920eea64aea16a15
Open in Devin Desktop: https://app.devin.ai/desktop/session/7e9513eb967049fa920eea64aea16a15?variant=devin