Repository navigation
Studio: try every address a site resolves to when fetching a page - #10319
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
GitHub Actions reproduction, on the real networkNo UI surface changes here, so this is the "real values" form: the probe drives the real Two shapes of "unroutable" matter, and they are not equivalent:
Run 33917516884 — six cells,
The fourth row is why
Regression test: |
Studio before/after, in the chat UITwo isolated installs, each stamped with its own SHA: BEFORE is the PR's merge base The network condition is arranged for the launched Studio process alone and identically on both A stand-in OpenAI-compatible provider on
Only the five predicted keys moved. The control returned the identical 3598-character excerpt on The card on the left is the user-visible symptom on |
|
Confirmed main still pins only the first address in studio/backend/core/inference/tools.py, so a host whose first record is unroutable never gets retried, and the budget split in _fetch_hop_timeout covers the dropped-SYN case too. Will get this reviewed. |
Retrying `opener.open` once per address divided the caller's timeout between them, and `create_connection` leaves whatever timeout it was given on the socket it returns, so that division bounded time to first byte rather than just the connect. Measured against the merge base on a host whose first record is unroutable: main answered in 9.0s, the retry loop failed at 30.0s. Walking inside `HTTPConnection._create_connection` instead keeps the fallback in the connect phase, so the caller's timeout still covers one whole response, and it reaches the Gemini image fetch through the same handler. The walk spends one budget across two passes: a brief probe of every address, capped at 1s each and at a quarter of the timeout in total, so an address that answers neither way cannot hold up the reachable ones; then an equal share of what is left, so no address strands the ones behind it. Every address is dialled in both passes, a dial that overruns still leaves the rest an attempt, and with no timeout this collapses to the single uncapped pass `create_connection` performs. Only a direct request carries the addresses: a proxied one reaches the origin through the proxy. Validated with a 24-mutation sweep over the walk, the handlers and the routing decision, each mutation caught by a named test, and with live fetches against hosts given unroutable addresses ahead of their real ones, asserting the walk actually dialled them: 30 blackholed addresses first still connects, in 7.7s over 31 dials.
|
Pushed a commit that moves the fallback from the request layer down to the connect layer. The problem with retrying Walking inside The walk spends one budget in two passes: a brief probe of every address, capped at 1s each and at a quarter of the timeout in total, so an address that answers neither way cannot hold up the reachable ones; then an equal share of what is left, so no address strands the ones behind it. Every address is dialled in both passes, a dial that overruns still leaves the rest an attempt, and with no timeout it collapses to the single uncapped pass Validation: a 24-mutation sweep over the walk, the handlers and the routing decision, each mutation caught by a named test; plus live fetches against real hosts given unroutable addresses ahead of their real ones, asserting the walk actually dialled them. Two things worth knowing:
|
|
@codex review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Lyxot
left a comment
There was a problem hiding this comment.
Approving. The bug is real -- pinning to one validated address silently removed the walk create_connection does for every other client, so a host whose first record is unroutable became unfetchable.
With the fallback moved to the connect layer, the caller's timeout still covers one whole response, and the Gemini image path gets the same behaviour through the same handler.
Verified on the head: full backend suite green, a 24-mutation sweep over the walk, the handlers and the routing decision with each mutation caught by a named test, and live fetches against hosts given unroutable addresses ahead of their real ones. Staging CI on the same commit came back clean apart from test_model_picker_contracts.py, which fails on main independently of this PR.

Web search and page fetch look up all the addresses for a site, then only ever try the first one. Browsers and ordinary Python code move on to the next address when the first one does not answer.
Most large sites return an IPv6 address first. If your network has IPv6 set up but not actually working, which happens with some VPNs and some providers, every fetch of those sites fails and keeps failing. The same thing happens when a site has several addresses and one of them is down.
Now it tries each address in turn before giving up, and runs the same safety checks on every one of them. Tested with real network calls. Before: "Connection refused" or "timed out". After: the page loads.