fix: make upstream egress explicit and resilient - #15
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b3665c670
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def _tcp_connect(self, address, deadline): | ||
| try: | ||
| return socket.create_connection(address, timeout=self._remaining(deadline)) |
There was a problem hiding this comment.
Bound DNS lookup by the egress deadline
When resolving either the upstream or explicit proxy through a slow or unavailable DNS resolver, socket.create_connection() calls getaddrinfo() before applying this timeout to a socket. The lookup can therefore block well beyond the promised 5-second deadline, preventing the next egress candidate from being attempted and defeating failover. Resolve under the deadline separately (for example in a bounded worker) before connecting.
Useful? React with 👍 / 👎.
|
thx🚀 |
fix: make upstream egress explicit and resilient
Problem
vision_proxy.pyusedurllib's default opener for model-upstream requests. On Windows, that implicitly follows the system proxy. If a local Clash proxy such as127.0.0.1:7890is configured but stopped, every request through the local vision proxy fails with 502 even though the proxy process itself is healthy.Fixes #14.
Changes
urllibopener with explicit stdlib networking (socket+http.client): direct TCP/TLS by default, or an explicitly configured HTTP CONNECT proxy.--upstream-proxy/VISION_UPSTREAM_PROXYand--proxy-first/VISION_PROXY_FIRST=1.Verification
All passed locally on Python 3.12. The egress smoke test and compile checks also passed locally on Python 3.11.
This is a non-UI proxy/networking change, so there is no meaningful browser E2E path. The substitute verification uses local TLS upstream and CONNECT proxy fixtures to exercise the affected request path end to end.