-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: Codex provider usage ignores proxy env and reports fetch failed #78714
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.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.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.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.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.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
Give feedbackNo fields configured for issues without a type.
Bug type
Behavior bug (incorrect provider usage state)
Summary
On OpenClaw 2026.5.5, Codex provider usage fails with
fetch failedin an environment where direct Nodefetch()tochatgpt.comtimes out, butHTTP_PROXY/HTTPS_PROXYis configured and a proxy-aware fetch succeeds.The failing path appears to be
loadProviderUsageSummary()selecting plainfetchfor provider usage snapshots instead of preferring the existing proxy-aware fetch helper from environment proxy settings.Environment
2026.5.5 (b1abf9d)Ubuntu 24.04.4 LTS, Linux6.17.0-22-generic,x86_64v22.22.2openai-codexOAuthHTTP_PROXY/HTTPS_PROXY/ lowercase variantsSteps to reproduce
openai-codexOAuth profile.https://chatgpt.com/backend-api/wham/usagetimes out, but an HTTP proxy is available and configured in env.Expected behavior
openclaw status --usage --jsonshould use the configured proxy path for Codex usage fetches and return Codex quota windows, for example:{ "provider": "openai-codex", "displayName": "Codex", "windows": [ { "label": "5h", "usedPercent": 2 }, { "label": "Week", "usedPercent": 22 } ], "plan": "..." }Actual behavior
Before a local patch, the usage payload consistently returned:
{ "provider": "openai-codex", "displayName": "Codex", "windows": [], "error": "fetch failed" }Evidence
Direct Node fetch tried to connect directly and timed out:
{ "ok": false, "name": "TypeError", "message": "fetch failed", "causeName": "AggregateError", "errors": [ { "code": "ETIMEDOUT", "address": "103.56.16.112" }, { "code": "ENETUNREACH", "address": "2001::80f2:f03b" } ] }The same URL succeeds when routed through OpenClaw's proxy-aware helper:
Using the packaged helper directly also works:
Local fix confirmation
In the packaged 2026.5.5 bundle,
provider-usage-BIeUuUeN.jshad:I locally patched it to prefer env proxy fetch:
After restarting the gateway, the same command returned Codex usage windows and plan data:
{ "provider": "openai-codex", "displayName": "Codex", "windows": [ { "label": "5h", "usedPercent": 2 }, { "label": "Week", "usedPercent": 22 } ], "plan": "..." }Suspected root cause
src/infra/provider-usage.load.ts/ the packagedprovider-usageruntime appears to resolve the fetch function with:This misses the already available proxy-aware path for provider usage requests when the operator relies on proxy env vars and direct Node fetch cannot reach
chatgpt.com.Suggested fix
Make provider usage loading proxy-aware by default, for example:
Alternatively, ensure this usage path reliably bootstraps the same env-proxy Undici dispatcher used by other provider/runtime network paths before
fetchCodexUsage()is called.Related but distinct issues checked
status --usage --jsonhanging/failing from non-TTY subprocesses.Codex: Unsupported providerpath.This report is narrower: Codex provider usage is implemented, auth is valid, and the failure disappears when
provider-usageuses the env proxy fetch helper.