Repository navigation
test(auth): hold the JWT mapping insert the Rust repository now sends - #53144
Merged
Merged
Conversation
The concurrent first-call test paused the mapping insert by matching Prisma's INSERT INTO "public"."LiteLLM_JWTKeyMapping". Since #52756 the insert goes through the Rust repository as INSERT INTO "LiteLLM_JWTKeyMapping", so the relay never held it and both parametrizations failed on every integration run.
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
yucheng-berri
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handwritten 1-3 sentence description
[insert handwritten description here]
Details
TLDR
Problem this solves:
How it solves it:
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<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 moreDelays 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
E2E exception at a4782b8. The diff is one bytes literal in an integration test and touches no product code, so the focused integration run below fully proves it. The runs were made at 9ad81f4, and the tip only adds a merge of main that changes nothing under auth, the JWT repositories or the integration support code.
The test pauses the first JWT call's mapping insert at a Postgres relay, sends a second call, then releases the first. Before #52756 the insert came from Prisma as
INSERT INTO "public"."LiteLLM_JWTKeyMapping". Now it comes fromlitellm/rust/crates/repositories/src/jwt_key_mapping/queries/insert_mapping.sqlasINSERT INTO "LiteLLM_JWTKeyMapping", so the relay never saw it and both cases failed with "the first call never reached its mapping insert". The first scheduled run after #52756 merged (44771273647) failed both cases that way, and the run before it passed.Each run used a throwaway Postgres and Redis, the worktree's own venv and Rust
_nativebuild, and this command underenv -iwithPATH,HOME,PYTHONPATH,INTEGRATION_PYTHON,DATABASE_URL,REDIS_HOST,REDIS_PORT,LITELLM_MASTER_KEY,LITELLM_SALT_KEY,LITELLM_LICENSE,LITELLM_MODE=PRODUCTION,STORE_MODEL_IN_DB=True,LITELLM_LOCAL_MODEL_COST_MAP=Trueand emptyINTEGRATION_PROXY_DATABASE_URL,INTEGRATION_PROXY_READ_REPLICA_URL,INTEGRATION_ROUTING,INTEGRATION_PEER_URL.With the old trigger restored, both cases fail the same way CI does.
With the fix, both cases pass, and three more runs in a row passed too.
To check the test exercises the race again, I mutated the losing call in
litellm/proxy/auth/host/steps/jwt_auto_register.pyto keep its own key instead of the winner's (return inserted.token, Truetoreturn token_hash, True). Theauto_registercase goes red because the held call is served with the orphan key that was just deleted. Thelink_onlycase stays green under this mutant since both calls already share one existing key.Type
✅ Test
Caveats (if any)
Low
test_budget_updates.pyfailureFinal Attestation