chore: integrate open PRs and issue fixes (#29, #31, #30) - #32
Merged
Conversation
All five urllib.request.urlopen() call sites in the proxy now close the HTTPResponse object after use (via try/finally), preventing file-descriptor leaks that crash the proxy under UltraCode concurrency, surfacing as 'ConnectionRefused' in Claude Code mid-session. Affected call sites: - _relay_response: wrap body in try/finally resp.close() - _mk_events (openai_compat): close resp in finally - _classifier_complete: close resp after read (both openai_compat and Anthropic passthrough backends) - _handle_models: close resp after /v1/models fetch 27/27 offline self-tests pass.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Jul 30, 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.
Summary
This rolls up the two currently open PRs and the one open issue into a single, rebased integration branch:
fix: close upstream HTTP responses to prevent FD exhaustion #31 / Proxy crashes mid-session with ConnectionRefused — upstream HTTPResponse objects are never closed (FD exhaustion) #30: close upstream
HTTPResponseobjects to prevent FD exhaustion — everyurlopen()response inproxy.pyis now closed viatry/finallyin_classifier_complete,_handle_models,_mk_events, and_relay_response. This stops file descriptors from leaking under sustained concurrency, which was causing mid-sessionConnectionRefusedcrashes.docs: add Requesty as an OpenAI-compatible backend example #29: add Requesty as an
openai_compatbackend example —config.example.json,docs/ADD_A_MODEL.md, andREADME.mdnow includeclaude-requesty/https://router.requesty.ai/v1withopenai/gpt-4o-mini, mirroring the existing OpenRouter example.Portability fix for zipped/embedded Python builds — the optional
providers/*.pyhelpers were failing to import whensys.path[0]points atpython312.zipinstead of the script directory.proxy.pynow adds its own directory tosys.pathbefore importingproviders.codex_oauthandproviders.cursor_agent, so the offline self-test andcodex_oauthroute work on those interpreters.Verification
python test_proxy.py— ALL TESTS PASSED (27/27)python scripts/doctor.py --no-test --ci— 13 ok, 0 failurespython -m compileall proxy.py test_proxy.py scripts/ultracode_selector.py scripts/doctor.py examples/auto_router_demo.py— cleanpython examples/auto_router_demo.py—RESULT: PASSCloses #30.
Link to Devin session: https://app.devin.ai/sessions/fd9010edb0274e7a94e94dec89a8699f
Requested by: @OnlyTerp