Repository navigation
test(logging): isolate bridged call recorder per request - #51339
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! |
[Low impact] This test-only change appears safe to merge. SummaryThis PR attaches the bridged-call test recorder to each request instead of installing it globally. Both callers retain their existing checks for call type, response, content and cost. No actionable issues were found.
Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
|
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 dc5e7d2. Configure here.
Handwritten 1-3 sentence description
Keep unrelated background work from making the bridged-call tests fail. The test now records only its own request without changing application behavior
Details
Summary
A delayed synchronous Responses log can reach the global recorder installed by the next test. Scope the recorder to each completion request with
success_callback=[recorder], keeping the call-type, response, content and cost assertions unchangedTLDR
Problem this solves
How it solves it
User Flow
Before, a maintainer can see an unrelated unit-test failure
After, the same check receives only the request it is testing
Pre-Submission checklist
Screenshots / Proof of Fix
E2E exception at dc5e7d2
Only test-recorder wiring changes. Both non-streaming callers keep their existing assertions. No application code, API semantics, provider behavior or logging implementation changes, so focused test proof covers the entire diff. Live proxy/provider e2e was skipped
Fresh detached worktrees compare current main
454424c36c3be559fabafd2647406b792de7d2e5with refreshed headdc5e7d2ee094954c268e7ba356eb66d3e17dc837. With the existing ChatGPT text test immediately before the bridged-call check and a 0.5-second executor delay, base fails 3/3 times with('responses', 'responses')instead of('completion', 'completion'). Head passes 3/3 timesWithout delay injection, head passes 60/60 runs using four parallel pytest processes and hash seed 50408. The affected file and price-map tests pass all 364 cases, including the 258 callback cases.
make checkpasses, and all 565 assertion AST nodes remain unchanged. No call-type filtering, queue skipping, sleeps or retries were added to the testThe previous CI failure on duplicate
gemini/gemini-decision-1keys was pre-existing on main, reproduced at unchanged base7461a996cc. The upstream fix #51341 is now merged and included through the main update. This PR still changes only the callback test file, with no cost-map editsAt this tip, all 96 CI checks pass. Greptile review 40920151 is 5/5, Cursor Bugbot review 5869176263 reports no new issues, and the final review-thread sweep found no unresolved threads
Reproduce the delayed-executor check
Use an already bootstrapped checkout at either revision. Save the following diagnostic plugin outside the checkout as
delay_executor_plugin.py. Its delay is fault injection only and is not part of the committed fixSet
QA_ROOTto the directory containing that plugin and run this sequence three times from each checkout rootFor the natural-scheduling check, omit
-p delay_executor_pluginand repeat the same two-test sequence 60 times at headRun the affected file, price-map regression checks and repository gates
PYTHONPATH="$PWD" LITELLM_LOCAL_MODEL_COST_MAP=True .venv/bin/python -m pytest \ tests/unit/completion_extras/litellm_responses_transformation/test_completion_extras_litellm_responses_transformation_transformation.py \ tests/unit/test_model_prices_and_context_window.py \ -p no:randomly -q -o addopts= make checkTaxonomy audit, T1 and T5. Every assertion remains intact, and the changed test no longer installs a process-global recorder
Link to Devin session: https://app.devin.ai/sessions/6784ce00e6f841d5952aad26f4b817b4
Open in Devin Desktop: https://app.devin.ai/desktop/session/6784ce00e6f841d5952aad26f4b817b4?variant=devin
Requested by: @mateo-berri
Note
Low Risk
Test-only callback wiring change with no application or logging behavior modifications.
Overview
Fixes test isolation for
test_bridged_chat_call_is_logged_with_the_callers_call_typeby no longer wiring the call recorder throughlitellm.callbacks.The recorder is attached only on the completion under test via
success_callback=[recorder]on bothlitellm.completionandlitellm.acompletion, so delayed logging from earlier tests cannot hit the global callback list. All existing assertions (call type, response shape, content, and cost) are unchanged.Reviewed by Cursor Bugbot for commit dc5e7d2. Bugbot is set up for automated code reviews on this repo. Configure here.