fix: guard litellm modify_params context#3248
Conversation
9eb80d5 to
aa5abea
Compare
|
Rebased this branch onto current Revalidated locally after the rebase:
|
|
Thank you for the contribution! Calvin's investigation flagged this and wrote the tracking issue. @csmith49 I would love it if you could maybe take a look at the PR? |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste - Clean, minimal fix for a real concurrency bug.
[RISK ASSESSMENT]
🟢 LOW - Internal synchronization fix with no API or behavior changes. The RLock correctly serializes access to global litellm state, and the regression test thoroughly validates the thread-safety guarantee.
VERDICT:
✅ Worth merging - Straightforward concurrency fix with proper testing.
KEY INSIGHT:
Using a ClassVar RLock is exactly right here since litellm.modify_params is global state that needs process-wide synchronization.
Summary
litellm.modify_paramssave/set/restore with anRLockFixes #3137.
To verify
python -m py_compile openhands-sdk\openhands\sdk\llm\llm.py tests\sdk\llm\test_llm_completion.pypython -m ruff check openhands-sdk\openhands\sdk\llm\llm.py tests\sdk\llm\test_llm_completion.pypython -m ruff format --check openhands-sdk\openhands\sdk\llm\llm.py tests\sdk\llm\test_llm_completion.pypython -m pytest tests\sdk\llm\test_llm_completion.py -q