fix(net): honor HTTP(S)_PROXY in embedded runner dispatcher#41455
fix(net): honor HTTP(S)_PROXY in embedded runner dispatcher#41455nowanti wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a bug where Changes:
The fix is minimal, well-scoped, and backward-compatible. Existing dispatchers of types other than plain Confidence Score: 5/5
Last reviewed commit: c8f1516 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8f1516f88
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…s configured Ensure that ensureGlobalUndiciStreamTimeouts() detects when HTTP_PROXY/ HTTPS_PROXY env vars are configured and upgrades the undici global dispatcher from plain Agent to EnvHttpProxyAgent. This fixes the issue where gpt-5.4 (openai-codex) and other embedded runners timeout behind proxies because the default Agent ignores proxy settings. Changes: - Check hasProxyEnvConfigured() when determining next dispatcher kind - Upgrade 'agent' -> 'env-proxy' when proxy env vars are present - Update tests to verify the upgrade behavior Fixes openclaw#41046 (related)
c8f1516 to
095f515
Compare
|
Rebased this branch onto the current This fix path has already landed upstream in #43248 ( Closing this PR as superseded to avoid duplicate review churn. |
Summary
ensureGlobalUndiciStreamTimeouts()kept a plain undiciAgenteven whenHTTP_PROXY/HTTPS_PROXYwere configured.openai-codex/gpt-5.4could still try direct connections and time out behind HTTP proxies.HTTP_PROXY/HTTPS_PROXYare present, the dispatcher now upgradesAgent -> EnvHttpProxyAgent, and it re-applies the extended timeouts if another subsystem replaces that global dispatcher. Tests cover the upgrade path, the re-apply path, and theALL_PROXY-only non-upgrade path.ALL_PROXYsupport and does not change Telegram-specific proxy selection logic.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
LLM request timed out#41046User-visible / Behavior Changes
LLM request timed outeven whenHTTP_PROXY/HTTPS_PROXYwere set.EnvHttpProxyAgentwhenHTTP_PROXY/HTTPS_PROXYare set.ALL_PROXY-only setups are unchanged.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
openai-codex/gpt-5.4{ "agents": { "defaults": { "model": { "primary": "openai-codex/gpt-5.4" } } } }Steps
agents.defaults.model.primarytoopenai-codex/gpt-5.4.HTTP_PROXY/HTTPS_PROXYvalues.openclaw agent --session-id proxy-check-gpt54-gateway --message "Reply with only OK." --json --timeout 120Expected
openai-codex/gpt-5.4turn completes successfully.Actual
embedded run agent end: ... error=LLM request timed out.status: okand replyOK.Evidence
Attach at least one:
Log Before Fix
Log / Command After Fix
Unit Tests
$ pnpm exec vitest run src/infra/net/undici-global-dispatcher.test.ts ✓ src/infra/net/undici-global-dispatcher.test.ts (8 tests)Human Verification (required)
What you personally verified (not just CI), and how:
HTTP_PROXY/HTTPS_PROXYconfigured on macOSopenai-codex/gpt-5.4turn succeedsEnvHttpProxyAgentremains on env-proxy pathEnvHttpProxyAgentis re-applied with extended timeoutsALL_PROXY-only setup does not upgrade in this PRProxyAgentremains untouchedALL_PROXYsupportReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/infra/net/proxy-env.tssrc/infra/net/undici-global-dispatcher.tssrc/infra/net/undici-global-dispatcher.test.tsHTTP_PROXY/HTTPS_PROXYconfigured but embedded runner traffic still behaves like direct-connectRisks and Mitigations
ALL_PROXY-only environments.HTTP_PROXY/HTTPS_PROXY.Agentis active andHTTP_PROXY/HTTPS_PROXYare already configured; custom proxy dispatchers remain untouched, and tests cover re-application after an external dispatcher swap.