Repository navigation
Retry a timed-out mainland China host only through a mainland-exit proxy - #101
Conversation
The retry added in #100 went through the general proxy, which exits abroad. The hosts it targets answer only addresses inside mainland China: of 45 that timed out in November, 30 dropped connections from nearly every probe location abroad, and all six production retries timed out. Each failed request waited 20 seconds longer for the same 504 and an anonymous one spent proxy budget. The retry now runs only when PROXY_POOL_MAINLAND names proxies that exit in mainland China, and goes through those. Without it the request fails after the 10-second direct timeout. The error message says the site answers only visitors inside mainland China. Amp-Thread-ID: https://ampcode.com/threads/T-01a19236-e961-759a-a320-167408397ed5 Co-authored-by: Amp <[email protected]>
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
website2markdown | 756e9e1 | Nov 21 2026, 12:01 PM |
A host that turned the general proxy away could skip the mainland proxy for a day, because both shared one record. Each pool now keeps its own. A mainland URL that redirects to a host outside mainland China, which then times out, is no longer sent to the mainland proxy.
The pool now follows the hop that timed out: a mainland host goes to the mainland proxies only, any other redirect target keeps the general proxy and the general timeout message. An anonymous mainland retry no longer spends budget when no mainland proxy parses, a host named with its root dot counts as mainland, and /admin no longer lists the mainland pool under the general proxy's card.
… apart A mainland URL that redirects abroad, times out mid retry backoff and also fails through the general proxy answered 502 target_unreadable. It is a timeout: 504 target_timeout again. Attempts through the mainland proxies are recorded as proxy_pool_mainland, so one pool's failures do not hide in the other's rate, and /admin shows them on their own card (off until PROXY_POOL_MAINLAND is set). The proxy's TLS handshake checks the certificate against the host without its root dot.
A site that refused the proxy was tried again, and spent anonymous budget again, when the same host was written with its root dot. Amp-Thread-ID: https://ampcode.com/threads/T-01a19236-e961-759a-a320-167408397ed5 Co-authored-by: Amp <[email protected]>
What changes
A mainland China host (
.cn) whose direct fetch times out is now retried through a proxy only whenPROXY_POOL_MAINLANDnames proxies that exit in mainland China, and the retry goes through those. Without that setting the request fails after the 10-second direct timeout, as it did before #100.The 504 message now reads: "The site did not answer. Many sites hosted in mainland China, especially government and university sites, only answer visitors inside mainland China."
Details:
www.example.gov.cn.) counts as a mainland host, and the proxy's TLS handshake checks the certificate against the name without the dot.proxy_pool_mainland, apart fromproxy_pool, so the failure alert judges each pool on its own./adminshows them on their own card, off untilPROXY_POOL_MAINLANDis set.Why
#100 retried these hosts through the general proxy, on the premise that they answer a home connection abroad. That premise was wrong: the machine used to check it reaches mainland sites from a mainland address.
Measured on the 57 mainland hosts that timed out between 2026-11-01 and 2026-11-21 (281 timeouts):
Not fixed here
/admincard for the mainland proxies has no connection test. A probe needs a real mainland exit to validate against..cnthat redirects to a mainland host which then times out is not retried, as onmain: it has already waited 30 seconds.Verification
npx vitest run: 949 tests pass.web/.PROXY_URL.proxy_pool.