Repository navigation
Conversation
Orca's configured proxy reached Claude and OpenCode Go usage fetches but not Codex, so on a Dock-launched macOS app — where the shell proxy vars are absent — a Codex usage refresh could reach the backend from the app's own IP while the user believed their traffic went through their proxy. Two halves: - The probe is spawned with the app process env, so the configured proxy never reached it. Both spawn sites now merge `buildConfiguredProxyEnv`, mirroring `claude-pty.ts`, and the service passes its resolver into `fetchCodexRateLimits`. - The three backend helpers used the platform global, which is undici and ignores Chromium's proxy. They now go through `getMainHttpClient()`, whose desktop implementation is `net.fetch` and therefore follows the session proxy. The Node fallback is the global, so hosts without Chromium are unchanged. Tests live in their own file because `codex-fetcher.test.ts` is at the max-lines ceiling; the shared probe doubles move to a fixtures module. Fixes stablyai#19755
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughCodex rate-limit fetches now use the main HTTP client for usage and reset-credit requests. The fetch options accept network proxy settings, which the rate-limit service passes to Codex fetches. RPC probe processes receive proxy environment variables. For WSL probes, the variable names are added to Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Codex usage requests and probes now receive the configured proxy. No concrete merge-blocking issue remains in the supplied evidence; normal checks should complete before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change brings Codex traffic under the selected proxy while preserving account selection and request destinations. No introduced security defect was established. The remaining uncertainty concerns effective routing during proxy-setting changes and across desktop and WSL environments. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Important
The proxy fix only lands on the full-cycle fetch. Three sibling fetchCodexRateLimits call sites still spawn the RPC/PTY probe without networkProxySettings, so a configured proxy is still bypassed on those paths.
Reviewed changes
- Proxy env on the Codex probe spawn —
fetchViaRpcandresolvePtyCommandnow mergebuildConfiguredProxyEnv(options.networkProxySettings)into the child env, mirroringclaude-pty.ts. - Backend calls through the main HTTP client —
fetchCodexUsage,fetchCodexResetCredits, andconsumeCodexResetCreditnow go throughgetMainHttpClient()(Electronnet.fetch, which follows the session proxy) instead of the undici global. - Call-site wiring —
service-full-cycle-preparation.tspasses itsnetworkProxySettingsResolvervalue intofetchCodexRateLimits. - Tests — a new
codex-fetcher-proxy-env.test.tscovers the RPC and PTY spawn envs;codex-fetcher-backend.test.tsgains a case asserting backend calls go through the main client and not the global. Shared probe doubles were extracted tocodex-fetcher.test-fixtures.ts.
⚠️ Configured proxy still bypassed on three sibling Codex fetch paths
The fix reaches only the full-cycle call site in service-full-cycle-preparation.ts. Three other production callers of fetchCodexRateLimits spawn the codex CLI without networkProxySettings, so buildConfiguredProxyEnv returns {} and the probe still egresses from the app's own IP — the exact symptom #19755 fixes. The Claude-only cycle already passes the resolver (service-provider-cycles.ts:112), so these are just missed siblings, and the asymmetry the PR sets out to close persists on them.
Technical details
# Pass `networkProxySettings` to the remaining Codex fetch call sites
## Affected sites
- src/main/rate-limits/service/service-provider-cycles.ts:41 — `runFetchCodexOnlyCycle` (the Codex-only refresh path)
- src/main/rate-limits/service/service-fetch-targets.ts:85 — `fetchCodexResetResultState` (re-fetch after a reset-credit redeem)
- src/main/rate-limits/service/service-inactive-accounts.ts:147 — inactive-account switcher preview (RPC-only, `allowPtyFallback: false`)
Each spawns the RPC/PTY probe, and none passes `networkProxySettings`. On non-WSL homes
(native macOS/Linux/Windows) the probe therefore runs without `HTTP_PROXY`/`HTTPS_PROXY`.
## Required outcome
- Add `networkProxySettings: this.networkProxySettingsResolver?.()` to each call, matching
`service-full-cycle-preparation.ts:158`. The resolver field is `protected` on
`src/main/rate-limits/service/service-state.ts:96`, so all three classes already have access.
## Notes
- The backend-supplement phase (`supplementCodexSessionWindow` / `supplementCodexRateLimitResetCredits`)
is unaffected: it goes through `getMainHttpClient()` regardless of the options, so it already follows
the session proxy.
- WSL homes route through `fetchWslBackend` (also `getMainHttpClient()`), so they are covered even on
these three call sites; the gap is specific to the native probe spawn.ℹ️ Nitpicks
- The proxy env added to the WSL spawn branches (
codex-fetcher.tsfetchViaRpcandresolvePtyCommand) is a no-op:wsl.exedoes not forward arbitrary env vars into the distro withoutWSLENV— which is whyclaude-pty.tsexports the proxy inside the shell command instead. WSL homes are covered by the backend path viagetMainHttpClient(), so this is inert rather than a bug, but the WSL RPC/PTY fallback (after a backend failure) still bypasses the proxy.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review caught two gaps in the previous commit. Only one of four production `fetchCodexRateLimits` call sites passed `networkProxySettings`, so a configured proxy was still bypassed on the provider-cycle, fetch-target and inactive-account paths. `service-provider-cycles.ts` already passed the resolver to Claude in the same file, which is precisely the asymmetry this changeset set out to close. The proxy env merged into the WSL spawn branches was also inert: `wsl.exe` does not forward arbitrary env vars into the distro without `WSLENV`, which `claude-pty.ts` already documents. `buildWslCodexCommand` now exports the proxy inside the shell command instead, matching that precedent, and the env merge applies only to the local branch.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (7f55dec) closes both findings.
- Wired the proxy through the remaining Codex call sites —
service-provider-cycles.ts,service-fetch-targets.ts, andservice-inactive-accounts.tsnow passnetworkProxySettings: this.networkProxySettingsResolver?.(), so all four productionfetchCodexRateLimitspaths honour the configured proxy. - Exported the proxy inside the WSL distro command —
buildWslCodexCommandgained aproxyEnvparameter and addsexport <KEY>='<value>'for each proxy var inside the shell command (same shape asclaude-pty.ts), fixing the WSL RPC/PTY fallback that previously bypassed the proxy. Local spawns still merge the env and skip the inert wsl.exe env.
The WSL export branch has no direct test, but it mirrors the established claude-pty.ts pattern and is gated behind win32 + a UNC path, so it is low-risk.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: cf59f919-b471-40fd-890f-47938670e255
📒 Files selected for processing (4)
src/main/rate-limits/codex-fetcher.tssrc/main/rate-limits/service/service-fetch-targets.tssrc/main/rate-limits/service/service-inactive-accounts.tssrc/main/rate-limits/service/service-provider-cycles.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…aining call sites Follow-up addressing review on stablyai#19931. Only the full-cycle fetch passed networkProxySettings, so a configured proxy was still bypassed on the provider-cycle, fetch-target and inactive-account paths — the last of which already passed the resolver to Claude in the same file. All four production fetchCodexRateLimits call sites now pass it. The WSL branch also serialized proxy values into the wsl.exe command line, where local processes could inspect them (and the URL is a protected secret at rest). Values now cross via WSLENV names using the shared addWslEnvKeys helper, and the command carries no proxy material. The local spawn keeps reading them from its own env.
|
Addressed in f4f82de — both points were correct. Sibling call sites: all four production WSL command line: agreed, serializing the URL there was wrong — the value is a protected secret at rest and the quoting helper only stops injection, not inspection. The WSL branch no longer puts any proxy material in the command; values cross via One scoping note: |
There was a problem hiding this comment.
Important
The new WSL proxy transport is a silent no-op — the configured proxy is still bypassed for WSL Codex homes, regressing the previous commit that exported it in-distro.
Reviewed changes
- Swapped the WSL proxy transport from in-command export to
WSLENV—buildWslCodexCommandno longer serializesexport <KEY>=<value>into thewsl.execommand line (avoiding credential exposure per CWE-200);fetchViaRpcandresolvePtyCommandnow name the proxy vars inWSLENVinstead. - Added a WSL credential-exposure test — a new case fakes
win32plus a UNC home and asserts the credentials stay out of the command text while the keys land inWSLENV.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…LENV import Follow-up to review: naming the proxy keys in WSLENV is not enough on its own — WSLENV only imports variables that already exist in the wsl.exe process environment, so excluding the values left nothing to import and the proxy never reached the distro. Both spawn sites now always merge the values (they ride the child env, never the command line) and add the WSLENV names on the WSL branch. The WSL test now asserts the value as well as the name, so a value-less WSLENV entry fails.
|
I'm the submitter of this PR's issue: #19755 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (f4f82de) resolves the WSL silent no-op finding.
- Merged the proxy env unconditionally into the WSL spawn env —
fetchViaRpcandresolvePtyCommandnow apply...proxyEnvin both branches, so the values ride the child env whileWSLENVnames them forwsl.exeimport; the values never enter the command line, keeping the CWE-200 posture. - Asserted the value in the WSL credential-exposure test —
codex-fetcher-proxy-env.test.tsnow checksspawnEnv.HTTPS_PROXYequals the configured proxy, so a value-lessWSLENVentry fails rather than passes.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
# Conflicts: # src/main/rate-limits/codex-fetcher.test.ts # src/main/rate-limits/codex-fetcher.ts # src/main/rate-limits/service/service-fetch-targets.ts # src/main/rate-limits/service/service-full-cycle-preparation.ts # src/main/rate-limits/service/service-inactive-accounts.ts # src/main/rate-limits/service/service-provider-cycles.ts
|
| if (wslCodex && Object.keys(proxyEnv).length > 0) { | ||
| addWslEnvKeys(spawnEnv, Object.keys(proxyEnv)) |
There was a problem hiding this comment.
WSL receives unreachable proxy address
If a Windows user configures a proxy at 127.0.0.1 and a WSL Codex account falls back to the RPC probe, this forwards the Windows proxy URL unchanged into WSL. In the usual WSL NAT configuration, that address points to the guest rather than the Windows proxy, so the probe cannot refresh usage.
There was a problem hiding this comment.
This WSL2 NAT limitation remains, as documented in the PR’s Known WSL limitation section. Forwarding a Windows-loopback proxy URL through WSLENV does not make that address reachable from the guest. I’m retaining the networking-policy hold: no address rewriting, silent proxy bypass or live WSL/proxy validation is claimed. The test-only update in c8fa2d0b63 addresses the separate redemption coverage finding; it does not fix this topology limitation.
There was a problem hiding this comment.
Agreed. The WSL2 NAT behavior is an explicitly documented limitation, and this PR intentionally preserves the configured proxy rather than rewriting it, bypassing it, or validating the topology. Since the redemption-coverage change is separate, there is no additional issue to raise here.
| try { | ||
| await fetchCodexRateLimits({ codexHomePath: wslHome }) | ||
|
|
||
| expect(clientFetch).toHaveBeenCalled() | ||
| expect(vi.mocked(fetch)).not.toHaveBeenCalled() |
There was a problem hiding this comment.
Redemption routing remains untested
This test checks usage and credit reads, but never calls consumeCodexRateLimitResetCredit. The existing redemption tests use the global-fetch fallback, so they would still pass if redemption stopped using the desktop HTTP client. That leaves a future proxy-bypass regression in the redemption path undetected.
There was a problem hiding this comment.
Covered in c8fa2d0b63 through the actual consumeCodexRateLimitResetCredit consumer. The injected-client regression now checks the reset outcome, consume POST URL, idempotency payload, authorization/account headers and request signal, and confirms global fetch is unused. A redemption-only mutation back to global fetch fails the new assertion (three client calls expected, two received). Production routing is unchanged. All 670 rate-limit tests pass with one skip; full typecheck, normal hooks and the unchanged review-delta quality gate pass.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review is a merge of upstream main plus a test-only trim; the proxy fix survives the merge intact.
- Re-applied the proxy env onto upstream's refactored RPC spawn — upstream removed the entire Codex PTY fallback path (
resolvePtyCommand,allowPtyFallback,child_process.spawn) and madespawnProcessthe single spawn seam. The merge keeps the fix on that seam:buildConfiguredProxyEnv(...)still merges into the child env,addWslEnvKeysstill names the proxy keys inWSLENVfor WSL homes, and all four service call sites still passnetworkProxySettings. The backend calls still route throughgetMainHttpClient(). - Trimmed the extracted test fixtures —
codex-fetcher.test-fixtures.tsnow exports onlymakeRpcChild; the PTY/RPC shutdown doubles and theFakePtyTerm/FakeDisposabletypes were dropped along with the PTY path.
Verification: the three focused suites (29 tests) and the full src/main/rate-limits directory (670 passed, 1 skipped) are green, and pnpm tc:node exits 0. spawnProcess forwards env straight to nodeSpawn, so the WSLENV crossing is unchanged.
One informational note, no code change needed: the PR description still describes a "PTY fallback" and resolvePtyCommand proxy coverage that upstream's refactor removed, and the fixture module is now imported only by codex-fetcher-proxy-env.test.ts (it is no longer shared with codex-fetcher.test.ts). Refreshing the description would keep it accurate.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (fb2e62b) is test-only and adds coverage for the redemption path.
- Covered
consumeCodexRateLimitResetCreditthrough the main HTTP client — a new case incodex-fetcher-backend.test.tsdrives a WSL UNC home through the backend, then asserts the reset-creditPOSTlands onclientFetch(the main HTTP client) and that the undici global is never called. The assertion set is exact enough to fail if the call reverts to the global.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
Orca has a setting for sending traffic through a proxy server. Claude and OpenCode Go usage checks respected it, but Codex usage checks did not. On a Mac launched from the Dock there are no shell proxy variables, so a Codex usage refresh could leave from your own IP while you believed it went through your proxy.
What Changed
Two halves, closing the same gap:
buildConfiguredProxyEnv(options.networkProxySettings). All four production paths pass the configured proxy: provider cycles, fetch targets, inactive accounts, and full-cycle preparation.fetchCodexUsage,fetchCodexResetCreditsandconsumeCodexResetCreditused the platform global, which is undici and ignores Chromium's proxy. They now go throughgetMainHttpClient(), whose desktop implementation isnet.fetchand therefore follows the session proxy. On a host without Chromium the port falls back to the global, so behaviour there is unchanged.Tests: a new
codex-fetcher-proxy-env.test.tscovers the RPC and PTY spawn envs, andcodex-fetcher-backend.test.tsgains a case proving the backend calls go through the main HTTP client (asserting the global is not used). The shared probe doubles moved tocodex-fetcher.test-fixtures.tsbecausecodex-fetcher.test.tsis at the max-lines ceiling.Why
The asymmetry is the bug.
service-full-cycle-preparation.tspassesnetworkProxySettingsto Claude (:147) and OpenCode Go (:162) but not to Codex (:155-159). The comment inclaude-pty.tsspells out why that matters: a probe that spawns the CLI directly, rather than the user's shell wrapper, "would reach api.anthropic.com from the app's own IP — bypassing the proxy the user set". Codex had no equivalent, on either the probe or the backend path.Scope note: this fixes the Codex half only. Claude's OAuth usage path already honours the proxy via
net.fetchondefaultSession, so nothing there is claimed as changed.Fixes #19755
Visual Proof
N/A — no UI or interaction change. The fix is in how the usage fetch egresses.
Testing
pnpm test src/main/rate-limits/codex-fetcher.test.ts src/main/rate-limits/codex-fetcher-proxy-env.test.ts src/main/rate-limits/codex-fetcher-backend.test.ts— 31 passed.AssertionError: expected undefined to be 'http://127.0.0.1:7890'before the change.pnpm tc— clean (exit 0). Explicit return-type annotations were needed on the exported fixtures, because exporting an inferredvi.fn()type trips TS2883.oxlint src/main/rate-limits/— clean.pnpm run check:code-quality:changedreports only pre-existing findings insrc/renderer/src/components/native-chat/NativeChatTaskList.tsx, which this diff does not touch — the gate compares against an older base, so upstream commits in between are counted as "changed".Platform testing: verified on Linux only. The proxy plumbing is platform-neutral; the macOS-specific symptom (Dock launch, no inherited shell proxy vars) is what the change addresses.
AI Disclosure
Written with an AI coding agent (deepseek-flash via opencode-go). All commands in Testing were run by the agent on Linux.
Review
AI-assisted code review summary, per CONTRIBUTING:
WSLENV, without translating the proxy address. The Node-host HTTP fallback remainsglobalThis.fetch; no new proxy support is claimed for that fallback.getMainHttpClient()is the existing main-process HTTP port (already used bysrc/main/jira/authenticated-request.ts). No host-specific assumptions added; nothing here touches execution-host ownership.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
networkProxySettingsis optional. The configured proxy is passed through all four production fetch paths, not only the full-cycle service call.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Known WSL limitation
Under WSL2 NAT, a configured Windows proxy at
127.0.0.1still points at the guest after its address is imported throughWSLENV. This PR does not resolve a Windows-host proxy address or silently bypass the configured proxy. That networking policy is explicitly held; no live proxy/WSL endpoint validation is claimed.