fix(run_agent): prevent _create_openai_client from mutating caller's kwargs#11056
Conversation
|
I independently hit the same root cause while debugging gateway instability on macOS, and I wanted to add a few datapoints that may help reviewers validate the fix. What I observed locally:
That matched the exact issue fixed here: Additional note: on my side, preserving OpenAI SDK timeout / connection-limit defaults alongside the keepalive client was also helpful for keeping gateway behavior aligned with fresh-shell behavior. For traceability, I documented the full reproduction and validation notes in #11070, and closed my duplicate PR #11072 in favor of this one. |
Thanks for the findings. Could you please verify if this PR fixes your issue? |
Cherry-picked from #10978 by @taeuk178.
Shallow-copy
client_kwargsat the top of_create_openai_client()to prevent in-place mutation from leaking back intoself._client_kwargs. Defensive fix that locks the contract for future httpx/transport work.Test Results