feat: configurable retryPolicy and honour all_proxy in env proxy - #7
Open
AlienHub wants to merge 1 commit into
Open
feat: configurable retryPolicy and honour all_proxy in env proxy#7AlienHub wants to merge 1 commit into
AlienHub wants to merge 1 commit into
Conversation
- Add optional retryPolicy to the llm-codex-auth row (RetryPolicySchema); threaded through CodexAuthAdapterOptions to resolveRetryPolicy. Default behavior unchanged (harness normal policy, two retries). - installEnvHttpProxy now also reads ALL_PROXY/all_proxy and passes the resolved URL explicitly to EnvHttpProxyAgent, since undici's env parser ignores all_proxy. Fixes connect timeouts on networks that only set all_proxy (e.g. Clash). - Document the new retryPolicy field in README (en/zh) and CHANGELOG.
Owner
|
Thanks for the contribution — both directions are useful. Configurable retry behavior is valuable on flaky/rate-limited networks, and supporting A few changes are needed before this can merge:
So: the feature direction is worth keeping; the main blockers are the stale base and proxy-resolution regression. |
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.
Problem
Two pain points when using the
openai-codexroute on real networks:Retry count is not configurable.
CodexAuthAdapterhardcodesresolveRetryPolicy(undefined, …), so the route always uses the harnessnormal policy (max 2 retries). On a flaky/rate-limited
chatgpt.com/backend-api, requests frequently need more attempts and thereis no way to raise the budget without editing the installed package.
all_proxyis ignored.installEnvHttpProxyonly readsHTTPS_PROXY/https_proxy/HTTP_PROXY/http_proxy. Many proxy setups(e.g. Clash) set only
all_proxy, which curl and the codex CLI honour —but Node's undici does not, and
new EnvHttpProxyAgent()also reads onlyhttp_proxy/HTTPS_PROXY. On such networks every request tochatgpt.comwent direct and timed out (connect timeout), while thebrowser/CLI worked fine.
Changes
Configurable retry policy: optional
retryPolicyon thellm-codex-authrow (validated withRetryPolicySchema), threaded throughCodexAuthAdapterOptionsintoresolveRetryPolicy. Omitted ⇒ unchangeddefault (normal, 2 retries). Example:
all_proxysupport: the env-proxy chain now includesALL_PROXY/all_proxy, and the resolved URL is passed explicitly as{ httpProxy, httpsProxy }(undici's env parser never readsall_proxy).NO_PROXYbehaviour is preserved from the environment.README (en/zh) config table and CHANGELOG updated.
Validation
pnpm run checkpasses: oxlint, typecheck (both host and client, withexactOptionalPropertyTypes), vitest, build, package smoke, publint.all_proxy=http://127.0.0.1:7890is the only proxy envvar: undici direct to
chatgpt.com/backend-apitimes out; with the patcheddispatcher the same request succeeds through the proxy (HTTP 401, as
expected without auth headers).