Repository navigation
Fail Turns when the model host is unreachable - #704
Merged
Merged
Conversation
SaladDay
force-pushed
the
fail-turns-when-the-model-host-is-unreachable
branch
from
October 14, 2026 10:23
04f1461 to
0902c94
Compare
This was referenced Oct 14, 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.
What
A Turn whose model host can't be resolved or reached now fails in bounded time with a classified reason. Before this change it could stay
in_progressforever.0.153.4'sunbounded_connection_retriesfeature (Stable, on by default), so Codex falls back to its own bounded provider defaults. It also deletes theRequestMaxRetries/StreamMaxRetriesprovider fields. They had no producer, and only a test set them.2.1.269reports two different failures asserver_errorwith a nullapi_error_status: a request that got no HTTP response (DNS failure, refused connection, timeout) and a server error in a response that was already streaming. Only the first comes right after anapi_retrywhoseerror_statusis null, with no model output in between. The bridge classifiesserver_errorasconnection_failedonly on that structured signal; every otherserver_error, mid-response included, staysserver_error. No error text is matched.connection_failednext step (en, zh-CN) still starts with checking the provider's Base URL. Only when the failure has no HTTP status does it add: check that the URL's host resolves and is reachable from the Session's sandbox, or from the host of a self-hosted Session. A failure with an HTTP status already reached a server, so it keeps the Base URL step alone.docs/getting-started/nodes.md(EN and zh): replaces "needs a policy change on the node", which promised a setting that doesn't exist, with what is true:/etc/resolv.conf; microsandbox never reads/etc/hosts;It also lists the working options: make those nameservers return public addresses (an
/etc/hostsentry helps only when/etc/resolv.confpoints at a local stub that serves it, such as systemd-resolved at127.0.0.53, as on mx2), use a Docker node, or register the node manually with an address-onlynetworkrule.Why
On mx2, the VPC resolver returned private addresses for
api.minimaxi.com. microsandbox's rebind protection turned those answers into NXDOMAIN. Codex then retried about every 60 s forever, and the Turn showed no events and no diagnostics.Per-Harness behavior (pinned versions, unresolvable host, measured locally)
unbounded_connection_retrieson: 5 s doubling to a 60 s cap, forever ("Reconnecting... waiting for network"). With it off:request_max_retries4 andstream_max_retries5, with stream idle timeout 300 s unchangedconnection_failedwithin about a minute (25.8 s here, 46.5 s in review), depending on lookup and connect timeapi_retrywitherror_status: null, backoff to about 35 sserver_errorconnection_failed; a mid-response server error staysserver_error-32603, so it stays unclassifiedWhy these bounds are safe:
Residual: Codex has no connect timeout. Against a host that silently drops SYNs, each of the 30 attempts waits for the OS connect timeout. microsandbox resets denied traffic and returns NXDOMAIN for rebinding answers, so the case that motivated this PR fails fast.
Not in this PR (proposals)
Retry progress ("Reconnecting to the model provider"). There is no typed path for it today:
proto.TypeErroris terminal;Adding it needs a non-terminal Runtime envelope (attempt, max, next retry time), fed by Codex
errornotifications withwillRetryand by Claudeapi_retry. Core would keep the latest value per running Turn and expose it in Turn diagnostics. MiniMax emits no ACP signal.MiniMax classification. Needs structured errors from MiniMax Code upstream.
Verification
go test ./apps/daemon/internal/agent/codex(the whole package; it includes the new bound assertion and the existinghttpConnectionFailedclassification tests).go vet ./...TestExecutorNativeUnreachableModelHostwith the real Codex 0.153.4 (OAC_TEST_CODEX_BINARY), base URLhttps://model-host.invalid/v1:connection_failedafter 25.8 s;pnpm --dir packages/claude-sdk-adapter build;node --testonnative_failure,messages,command_observerandclassified_execution(26 pass).NativeFailure(probe not committed; logs in the lane evidence directory):api_retrywitherror_statusnull,connection_failedat 187 s;127.0.0.1:1): same retries,connection_failedat 176 s;API_TIMEOUT_MS=2000: same retries,connection_failedat 201 s;errorevent: no retry,server_errorat 0.5 s.pnpm --filter @oac/web typecheck, plusvitest runonsession-diagnostics,provider-observationsandi18ntests (19 pass).make check-docsandpnpm --dir website check-translations.Skipped:
make check;Residual (Claude):
api_retrycarries noparent_tool_use_id. A subagent's connection retry directly followed by a rootserver_errorwithout a status, with no stream event or assistant message between them, would read asconnection_failed. Any model output resets the signal.