Repository navigation
test: fix flaky team delete, refusal sink, loop-blocking, Moyai tamper and model-cost leak tests - #47135
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
…delete_and_refusal_sink
…istic Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
|
…delete_and_refusal_sink
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…r starts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
1 similar comment
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 652fc03. Configure here.
|
@litereview all |
Review not startedThis review command is unavailable for this repository or caller. Check the agent or group names and the permissions in People and Repositories. |
|
@litereview full |
|
…ng on 1.108 Brings over the test_utils.py isolation fix from #47135. The replay test registered openai/gpt-4o with supports_function_calling false into the shared cost map, so a later function calling test on the same worker failed depending on xdist ordering
…ng on 1.108 Brings over the test_utils.py isolation fix from #47135. The replay test registered openai/gpt-4o with supports_function_calling false into the shared cost map, so a later function calling test on the same worker failed depending on xdist ordering
TLDR
Problem this solves:
no_db_connectionwhile warming keysHow it solves it:
failureunit passedcheck on this PR now prove event-loop progress with thread events instead of wall-clock timing, flip a real signature byte instead of the last base64 chars, and copylitellm.model_costbefore registering overridesThe proxy logs auth rejections through the failure hook on purpose, so the old empty-sink check only passed when it ran before the one-second flush. The test is renamed to match what it now checks
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 moreScreenshots / Proof of Fix
Test-only change, so the proof is the integration rig itself, which runs a real proxy with real Postgres. Each changed test passed 3 runs in a row locally on this branch: the refusal test in 88s, 79s and 78s, and the team delete test in 227s, 232s and 234s
CircleCI failures this fixes: jobs 2261488 (team delete, 503
no_db_connection) and 2261466 (refusal, sink event for the stranger key)Link to Devin session: https://app.devin.ai/sessions/a19d7fd2407a46ab98d7a4218eccd904
Open in Devin Desktop: https://app.devin.ai/desktop/session/a19d7fd2407a46ab98d7a4218eccd904?variant=devin
Note
Low Risk
Changes are limited to test assertions and harness concurrency; no production code paths are modified.
Overview
This PR stabilizes several flaky tests without changing production behavior.
The large team-delete integration test now warms and checks thousands of keys with 2 concurrent threads (aligned with the proxy DB pool) instead of 16, avoiding
503 no_db_connectionduring warmup. The unauthenticated refusal integration test waits for one sink failure event for the invalid key (statusfailure) instead of asserting an empty sink, matching intentional auth-failure logging and removing a race with the flush.Event-loop non-blocking checks in Vertex Gemini count-tokens and proxy token-counter unit tests no longer rely on wall-clock sleeps; they use threading events to prove the loop progressed while a download or vault lookup was pending. The Moyai exchange tamper test flips a byte in the decoded HMAC rather than editing trailing base64. A model-cost unit test copies
litellm.model_costvia monkeypatch beforeregister_modelso overrides do not leak across tests in the same process.Reviewed by Cursor Bugbot for commit 652fc03. Bugbot is set up for automated code reviews on this repo. Configure here.