Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughCodex rate-limit fetching now accepts network proxy settings. The settings are passed through inactive-account, reset-refresh, full-refresh, and Codex-only service paths. WSL commands export configured proxy variables. RPC and PTY subprocesses use a shared child-environment builder. Tests cover configured and inherited proxy values, parent environment preservation, WSL command exports, and PTY fallback propagation. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes proxy settings not being forwarded to Codex rate-limit subprocesses (RPC and PTY). A new
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to subprocess environment construction and service wiring, with no mutations to process.env and no new network or credential sources. The new buildCodexChildEnv helper correctly handles all four environment-construction cases (WSL/non-WSL × RPC/PTY), all service call sites were updated, parent process.env is never mutated, and the three new focused tests plus two updated WSL tests validate the proxy injection end-to-end. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/rate-limits/codex-fetcher.ts | Adds buildCodexChildEnv helper to centralise subprocess env construction, merging parent env, configured proxy vars, and CODEX_HOME; injects proxy exports into WSL shell commands via proxyEnv option on buildWslCodexCommand; both RPC and PTY paths use the new helper correctly. |
| src/main/rate-limits/service.ts | Threads networkProxySettings: this.networkProxySettingsResolver?.() into all four fetchCodexRateLimits call sites; straightforward wiring change with no logic alterations. |
| src/main/rate-limits/codex-fetcher-proxy-env.test.ts | New test file covering three proxy scenarios: configured proxy overrides parent env for RPC, empty proxy preserves parent env without injecting empty keys, and configured proxy reaches PTY spawn env. |
| src/main/rate-limits/codex-fetcher.test.ts | Extends two existing WSL RPC tests with networkProxySettings and asserts the proxy export statement appears in the generated WSL shell command. |
| src/main/rate-limits/service.test.ts | Adds assertion that fetchCodexRateLimits is called with networkProxySettings alongside the existing fetchClaudeRateLimits assertion in the refresh test. |
Sequence Diagram
sequenceDiagram
participant S as RateLimitService
participant CF as codex-fetcher
participant NP as network-proxy
participant C as Child Process (RPC/PTY)
S->>S: networkProxySettingsResolver()
S->>CF: "fetchCodexRateLimits({ networkProxySettings })"
alt WSL path (codexHomePath is UNC)
CF->>NP: buildConfiguredProxyEnv(settings)
NP-->>CF: "{ HTTP_PROXY, HTTPS_PROXY, ... }"
CF->>CF: "buildWslCodexCommand(path, args, { proxyEnv })"
note over CF: injects export HTTP_PROXY=... into WSL sh -c script
CF->>NP: buildConfiguredProxyEnv(settings) via buildCodexChildEnv
NP-->>CF: "{ HTTP_PROXY, HTTPS_PROXY, ... }"
CF->>C: "spawn(wsl.exe, [...], { env: buildCodexChildEnv(...) })"
else Non-WSL path
CF->>NP: buildConfiguredProxyEnv(settings) via buildCodexChildEnv
NP-->>CF: "{ HTTP_PROXY, HTTPS_PROXY, ... } or {}"
CF->>C: "spawn(codex, args, { env: buildCodexChildEnv(...) })"
end
C-->>CF: rate limit data
CF-->>S: ProviderRateLimits
Reviews (2): Last reviewed commit: "refactor(rate-limits): build proxy env o..." | Re-trigger Greptile
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Related PR, with a bit broader scope: |
Summary
CODEX_HOMEandTERM, exports proxy values inside WSL, and leaves the parent environment unchanged.Closes #11752.
Screenshots
No visual change
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation run in this session:
pnpm exec vitest run --config config/vitest.config.ts src/main/rate-limits/codex-fetcher.test.ts src/main/rate-limits/codex-fetcher-proxy-env.test.ts src/shared/network-proxy.test.ts(30 passed)pnpm run typecheck:nodepnpm exec oxlint src/main/rate-limits/codex-fetcher.ts src/main/rate-limits/codex-fetcher.test.ts src/main/rate-limits/codex-fetcher-proxy-env.test.ts src/main/rate-limits/service.ts src/main/rate-limits/service.test.tspnpm exec oxfmt --check src/main/rate-limits/codex-fetcher.ts src/main/rate-limits/codex-fetcher.test.ts src/main/rate-limits/codex-fetcher-proxy-env.test.ts src/main/rate-limits/service.ts src/main/rate-limits/service.test.tspnpm run check:max-lines-ratchetgit diff --checksrc/main/rate-limits/service.test.tswas also run; seven existing Claude PTY expectation cases fail on Windows because the test expects Linux values (allowUsagePanelSupplement: true), while the unchanged production guard correctly returns false onwin32.AI Review Report
The change is limited to Codex rate-limit subprocess environment construction and service wiring. RPC and PTY use the same inherited-environment clone and configured proxy merge. WSL receives the proxy through the existing shell-quoting path; host
CODEX_HOMEstripping and PTYTERMbehavior remain intact. No UI, network client, provider selection, or new subprocess path changed.Security Audit
Configured proxy values pass through the existing normalized proxy helper, which preserves credential handling and bypass normalization. Values are shell-quoted for WSL and are not logged. The parent
process.envis never mutated, and no new network or credential source is introduced.Notes
Validated against
origin/mainata53c5d3fb07ef00bbe42e75609310436ed95a541. The base regression run failed the configured RPC and PTY proxy assertions; the head run passed all 30 focused tests. Related PR #11662 covers invalid RPC fallback, not proxy environment merging.