fix(telegram): global dispatcher breaks HTTP proxy for all outbound requests (#26207)#26229
Closed
yinghaosang wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(telegram): global dispatcher breaks HTTP proxy for all outbound requests (#26207)#26229yinghaosang wants to merge 1 commit intoopenclaw:mainfrom
yinghaosang wants to merge 1 commit intoopenclaw:mainfrom
Conversation
thebtf
pushed a commit
to thebtf/openclaw
that referenced
this pull request
Feb 25, 2026
openclaw#25988 - openclaw#26229: replace Agent with EnvHttpProxyAgent in global undici dispatcher so HTTP_PROXY/HTTPS_PROXY env vars are respected for all outbound fetch calls (regression fix from openclaw#25682 that overwrote proxy-aware dispatcher) - openclaw#26264: lower text fragment aggregation threshold 4000→3600 chars to reliably catch structured content that Telegram splits at ~3800 chars - openclaw#25988: fail closed group allowlist against DM pairing store — group sender checks now use only explicit groupAllowFrom config, not the DM pairing store (security: DM-paired senders cannot bypass group allowlist)
Member
|
I appreciate the early pass on this fix. I’m closing this as a duplicate of #26239 because both changes address the same dispatcher/proxy regression in the same code path, and we need one canonical PR for merge flow. Your earlier work is preserved in the canonical credit chain for this cluster. If this boundary looks wrong, point me to the missing behavior and I’ll reopen review right away. |
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.
Summary
setGlobalDispatcher(new Agent({...}))in Telegram init replaces the process-wide undici dispatcher with a bareAgentthat doesn't respectHTTP_PROXY/HTTPS_PROXYenv vars. Users behind proxies (GFW, corporate networks) lose all outbound connectivity after upgrading to 2026.2.24.globalThis.fetchcalls go through this dispatcher — model API, Telegram API, everything.Agent→EnvHttpProxyAgentinsrc/telegram/fetch.ts.EnvHttpProxyAgentreads proxy env vars when set, falls back to direct connections otherwise. SameautoSelectFamilybehavior from fix: resolve Telegram outbound fetch failure on Node 22 (#25676) #25682 is preserved.channels.telegram.proxy) still uses its ownProxyAgentviasrc/telegram/proxy.ts. No new deps —EnvHttpProxyAgentis already inundici.lobster-biscuit
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
setGlobalDispatchercall), fix(net): respect HTTP proxy env vars in web_fetch SSRF dispatcher #25573 (same class of bug in SSRF dispatcher)User-visible / Behavior Changes
Outbound
fetch()calls now respectHTTP_PROXY/HTTPS_PROXY/NO_PROXYenv vars. No config changes needed — if the env vars aren't set, behavior is identical to a bareAgent.Security Impact (required)
Root Cause
applyTelegramNetworkWorkarounds()insrc/telegram/fetch.tscallssetGlobalDispatcher(new Agent({connect: {autoSelectFamily: ...}})). The bareAgentdoesn't read proxy env vars, so any previously-configured proxy-aware dispatcher gets overwritten. Introduced in #25682 to fix IPv6 fallback on Node 22.Tests
src/telegram/fetch.test.tsto assertEnvHttpProxyAgentinstead ofAgent— both fail before fix, pass afterpnpm build && pnpm checkcleanCompatibility / Migration
Failure Recovery (if this breaks)
Agent→EnvHttpProxyAgentin one file.HTTP_PROXYenv vars set that they forgot about.Risks and Mitigations
EnvHttpProxyAgentpicks up proxy env vars that users didn't intend for OpenClawNO_PROXYis also supported for exclusions.Greptile Summary
Replaced
AgentwithEnvHttpProxyAgentinsrc/telegram/fetch.tsto respectHTTP_PROXY/HTTPS_PROXYenvironment variables when setting the global undici dispatcher. This fixes a regression from #25682 where the bareAgentreplaced any proxy-aware dispatcher, breaking outbound connectivity for users behind proxies. The change preserves the existingautoSelectFamilyworkaround for IPv6 fallback issues on Node 22+ while allowing proxy configuration through standard environment variables. Per-account Telegram proxy configuration (channels.telegram.proxy) continues to use its ownProxyAgentviasrc/telegram/proxy.tsand is unaffected by this change.Confidence Score: 5/5
EnvHttpProxyAgentis a drop-in replacement forAgentthat adds proxy environment variable support without changing behavior when those variables aren't set. The fix is thoroughly tested with updated unit tests that verify the correct constructor is called, and all 527 existing Telegram tests pass. The change addresses a clear regression where users behind proxies lost connectivity after upgrading, while preserving the IPv6 fallback functionality introduced in the original PR.Last reviewed commit: d38520a