openclaw - ✅(Solved) Fix web_fetch ignores HTTP_PROXY environment variables - dispatcherPolicy defaults to direct [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61480Fetched 2026-04-08 02:58:07
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2

Root Cause

In http-client-COwW1KRl.js line 111:

dispatcher = createPinnedDispatcher(
  await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy }),
  params.dispatcherPolicy,
  params.ssrfPolicy
);

In ssrf-BWlfjI7J.js, createPinnedDispatcher() checks policy.mode:

if (!policy || policy.mode === "direct") return new Agent({...});
if (policy.mode === "env-proxy") return new EnvHttpProxyAgent({...});

Because params.dispatcherPolicy is never set to {mode: "env-proxy"}, the dispatcher always falls back to a direct Agent.

Fix Action

Fix / Workaround

dispatcher = createPinnedDispatcher(
  await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy }),
  params.dispatcherPolicy,
  params.ssrfPolicy
);

In ssrf-BWlfjI7J.js, createPinnedDispatcher() checks policy.mode:

Because params.dispatcherPolicy is never set to {mode: "env-proxy"}, the dispatcher always falls back to a direct Agent.

PR fix notes

PR #61503: fix(web-fetch): honor HTTP proxy env

Description (problem / solution / changelog)

Summary

  • make strict web_fetch opt into env-proxy dispatcher mode when HTTP(S)_PROXY is configured for the request protocol
  • preserve explicit dispatcherPolicy overrides and ignore ALL_PROXY-only setups for this path
  • add focused regressions for guarded web-fetch policy selection and higher-level web_fetch dispatcher behavior

Testing

  • attempted: pnpm test -- src/agents/tools/web-guarded-fetch.test.ts
  • attempted: pnpm test -- src/agents/tools/web-tools.fetch.test.ts
  • local install/test execution was blocked by npm registry DNS failures in this environment (EAI_AGAIN registry.npmjs.org)

Closes #61480

Changed files

  • docs/automation/cron-jobs.md (modified, +1/-0)
  • docs/cli/cron.md (modified, +2/-0)
  • src/agents/tools/web-guarded-fetch.test.ts (modified, +64/-1)
  • src/agents/tools/web-guarded-fetch.ts (modified, +14/-0)
  • src/agents/tools/web-tools.fetch.test.ts (modified, +2/-2)
  • src/cron/isolated-agent.direct-delivery-forum-topics.test.ts (modified, +42/-0)
  • src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts (modified, +18/-0)
  • src/cron/isolated-agent/delivery-dispatch.ts (modified, +35/-4)

PR #61518: fix(web-fetch): honor HTTP proxy env

Description (problem / solution / changelog)

Summary

  • make strict web_fetch opt into env-proxy dispatcher mode when HTTP(S)_PROXY is configured for the request protocol
  • preserve explicit dispatcherPolicy overrides and ignore ALL_PROXY-only setups for this path
  • add focused regressions for guarded web-fetch policy selection and higher-level web_fetch dispatcher behavior
  • clean up env stubs in web-guarded-fetch.test.ts to avoid cross-test leakage

Testing

  • attempted: pnpm test -- src/agents/tools/web-guarded-fetch.test.ts
  • attempted: pnpm test -- src/agents/tools/web-tools.fetch.test.ts
  • local install/test execution was blocked by npm registry DNS failures in this environment (EAI_AGAIN registry.npmjs.org)

Closes #61480 Supersedes #61503

Changed files

  • docs/automation/cron-jobs.md (modified, +1/-0)
  • docs/cli/cron.md (modified, +2/-0)
  • src/agents/tools/web-guarded-fetch.test.ts (modified, +65/-1)
  • src/agents/tools/web-guarded-fetch.ts (modified, +14/-0)
  • src/agents/tools/web-tools.fetch.test.ts (modified, +2/-2)
  • src/cron/isolated-agent.direct-delivery-forum-topics.test.ts (modified, +42/-0)
  • src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts (modified, +18/-0)
  • src/cron/isolated-agent/delivery-dispatch.ts (modified, +35/-4)

Code Example

dispatcher = createPinnedDispatcher(
  await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy }),
  params.dispatcherPolicy,
  params.ssrfPolicy
);

---

if (!policy || policy.mode === "direct") return new Agent({...});
if (policy.mode === "env-proxy") return new EnvHttpProxyAgent({...});
RAW_BUFFERClick to expand / collapse

Bug Description

In OpenClaw 2026.4.2, the web_fetch tool does not respect HTTP_PROXY/HTTPS_PROXY environment variables even when they are correctly configured in the systemd service.

Root Cause

In http-client-COwW1KRl.js line 111:

dispatcher = createPinnedDispatcher(
  await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy }),
  params.dispatcherPolicy,
  params.ssrfPolicy
);

In ssrf-BWlfjI7J.js, createPinnedDispatcher() checks policy.mode:

if (!policy || policy.mode === "direct") return new Agent({...});
if (policy.mode === "env-proxy") return new EnvHttpProxyAgent({...});

Because params.dispatcherPolicy is never set to {mode: "env-proxy"}, the dispatcher always falls back to a direct Agent.

Suggested Fix

Detect HTTP_PROXY/HTTPS_PROXY and pass {mode: "env-proxy"} as dispatcherPolicy.

Environment

  • OpenClaw: 2026.4.2
  • Node.js: v24.14.1
  • OS: Linux 6.8.0-107-generic (Ubuntu 24.04/x64)

extent analysis

TL;DR

Set params.dispatcherPolicy to {mode: "env-proxy"} to respect HTTP_PROXY/HTTPS_PROXY environment variables in the web_fetch tool.

Guidance

  • Verify that HTTP_PROXY and HTTPS_PROXY environment variables are correctly set in the systemd service configuration.
  • Check the http-client-COwW1KRl.js file to ensure that the createPinnedDispatcher function is called with the correct params.dispatcherPolicy.
  • Update the code to detect HTTP_PROXY/HTTPS_PROXY environment variables and pass {mode: "env-proxy"} as dispatcherPolicy to the createPinnedDispatcher function.
  • Test the web_fetch tool with the updated configuration to ensure it respects the proxy environment variables.

Example

const proxyMode = process.env.HTTP_PROXY || process.env.HTTPS_PROXY ? 'env-proxy' : 'direct';
const dispatcherPolicy = { mode: proxyMode };
dispatcher = createPinnedDispatcher(
  await resolvePinnedHostnameWithPolicy(currentUrl.hostname, { policy: params.ssrfPolicy }),
  dispatcherPolicy,
  params.ssrfPolicy
);

Notes

This fix assumes that the createPinnedDispatcher function and the EnvHttpProxyAgent class are correctly implemented to handle the env-proxy mode.

Recommendation

Apply the workaround by updating the params.dispatcherPolicy to respect the HTTP_PROXY/HTTPS_PROXY environment variables, as this is a targeted fix for the specific issue described.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix web_fetch ignores HTTP_PROXY environment variables - dispatcherPolicy defaults to direct [2 pull requests, 1 participants]