-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
SSRF guard pinned DNS dispatcher causes model fetch timeouts when autoSelectFamily is enabled #87763
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
Starting from OpenClaw 2026.5.12, the SSRF guard's pinned DNS dispatcher conflicts with Node.js's
autoSelectFamily(Happy Eyeballs / RFC 8305), causing model fetch requests to time out after 120 seconds. This makes the gateway completely unresponsive to messages on affected providers.Environment
openai-completionsAPI), baseUrlhttps://hydragpt.ru/v1Problem
After upgrading from 5.7 to any version ≥5.12, the gateway cannot reach the model provider. Every model fetch request times out at exactly 120 seconds:
Key observation: The provider's request counter on their side does NOT increment — the request never reaches the server at all. The TCP connection is never established.
CLI inference works fine:
openclaw infer model run --prompt "hello" --model hydragpt/glm-5p1returns a response instantly on the same machine and same version. Only the gateway is affected.Root Cause Analysis
The SSRF guard (introduced in 5.12) creates a pinned DNS dispatcher using undici's
Agentwith a customlookupfunction andautoSelectFamily: true. This combination fails:1.
dedupeAndPreferIpv4reorders addressesIn
ssrf-B5bGsnx-.js,resolvePinnedHostnameWithPolicycallsdedupeAndPreferIpv4which puts IPv4 addresses before IPv6:2. Pinned lookup + autoSelectFamily = broken
In
undici-runtime-BdHHFzbs.js,withHttp1OnlyDispatcherOptionssetsautoSelectFamilyfrom the Node.js system default (true on Node 20+). When undici'sautoSelectFamilymechanism calls the pinned lookup with{all: true}, the interaction breaks:Reproduction:
When the pinned lookup returns a single
(address, family)result instead of an array for{all: true}, or whenautoSelectFamilytries to perform Happy Eyeballs with a lookup that doesn't properly support the dual-family resolution pattern, the connection attempt producesInvalid IP address: undefinedor simply hangs until timeout.3. Telegram module has a workaround, model fetch does not
The Telegram subsystem has its own IPv6 fallback mechanism:
The model fetch path through
buildGuardedModelFetch→fetchWithSsrFGuardhas no such fallback — it simply hangs until the 120s timeout.4. Why CLI inference works
openclaw infer model runuses a different code path that does not go through the gateway's SSRF-guarded fetch pipeline, so it connects successfully.Workaround
Setting
NODE_OPTIONS=--no-network-family-autoselectionin the gateway systemd service disables Happy Eyeballs, which allows the pinned lookup to work without interference. However, this is a partial workaround because:dedupeAndPreferIpv4is used)Suggested Fix
Short-term: The model fetch path should have the same IPv4/IPv6 fallback mechanism that the Telegram module already implements. If the primary connection attempt fails with a timeout, retry with the alternate address family.
Medium-term: The
createPinnedLookupfunction inssrf-B5bGsnx-.jsshould properly support the{all: true}callback format thatautoSelectFamilyexpects, returning an array of{address, family}records. The current implementation handlesopts.allbut the interaction with undici's Happy Eyeballs still breaks.Consider: Whether
dedupeAndPreferIpv4is the right default ordering for all environments. In IPv6-capable environments, keeping the system's natural DNS ordering (IPv6 first) may be preferable, especially for services known to work better over IPv6.Related
buildReplyPayloads, not this SSRF dispatcher issue