Skip to content

Fix Codex usage bypassing configured proxy routing - #26942

Merged
OrcaWin merged 1 commit into
mainfrom
nwparker/reproducible-codex-proxy-10-09
Oct 11, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
nwparker/reproducible-codex-proxy-10-09

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

ELI5

Codex usage checks can ignore the HTTP proxy configured in Advanced settings. They now use Orca's configured desktop connection and pass the same proxy settings to the background Codex probe.

What Changed

Usage reads, reset-credit reads and redemption use the existing host HTTP client. Codex requests keep explicit account authentication and omit desktop-session cookies. All four service paths forward their existing local proxy settings. Native probes receive the validated proxy environment; WSL receives values through private environment carriers and restores them after login, keeping proxy credentials out of command arguments.

Why

The previous backend used Node fetch, which bypassed the desktop proxy, while the probe missed the configured environment. Reusing the host client and existing proxy/WSL helpers preserves host selection, cancellation and account-home ownership without adding another transport or remote protocol field.

This PR is stacked on #26957. That prerequisite fixes a separately reproduced failure to answer a cold Basic proxy challenge in the desktop HTTP client. The routing patch itself is unchanged; both fixes are needed for the measured cold authenticated Codex calls to work.

Linked Issue

Addresses the request-routing portion of #26477. The requested error-display improvement is outside this fix; #26477 remains open. Related reports: #19755 and #11752. Retains material from @petersindex's #26497 and @mmarabel's #19931, credited as co-authors. Thanks to @rodboev for the earlier investigation in #11862.

Visual Proof

Actual cold-authentication before/after: routing alone fails the usage, redemption and public-service calls with zero destination requests. With #26957, those operations complete with five cookie-free destination requests and ten cold proxy attempts. The fixture clears its session authentication cache and connections before every HTTP-port call; no app login handler or manual warm-up is installed. Explicit bypass stays direct, and a rejecting proxy reaches zero destinations. Download the cold trace. No rendered UI change.

Original routing before/after remains unchanged: five configured calls change from direct to proxied, bypass stays direct and a failed proxy changes from five direct origin calls to zero. This earlier proof uses cached proxy authentication and is not a cold-authentication claim. Download the original trace.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Actual macOS Electron 43.7.5 fixture exercises the production Codex fetcher, redemption and public service. All five configured and five bypass requests retain exact synthetic bearer/account authentication, the POST payload and zero desktop cookies. Six controlled probe processes per revision receive the fixture-owned account home and configured environment. Rejecting-proxy, no-direct-fallback, positive cookie and cleanup controls pass; no real CLI, account, user credential home, external endpoint or window is used.

Fresh combined local validation passes 297 tests across 26 suites, Node/CLI typechecks and the changed-code quality gate. The routing-only diff has an identical range-diff to its original commit, preserving all twelve files and both material contributor credits.

Separate prerequisite portability checks pass 149 tests across ten suites on native Windows and Linux; these use Request/stream fixtures, not native network captures. The original routing-only checks passed all 148 on Linux. Windows passed 137, skipped two POSIX cases and had nine failures independently reproduced on the pinned baseline: seven existing Fable policy expectations and two graceful-EOF child-termination expectations. Those failures are not claimed fixed by the stack. Windows carrier construction passes; the emitted POSIX WSL command runs with login overrides and hostile quoted values. Actual wsl.exe guest execution is pending: its controlled local constructor capture correctly refused an unexpected injected Windows authority key, before any guest command. Native Windows/Linux networking and SSH transport are outside the measured macOS proof. Node/SSH HTTP fallback remains unchanged.

AI Disclosure

Review

Root and independent source/proof reviews are clean. The routing patch preserves its original contributor trailers; source, fixture, proof and published asset hashes are recorded in the review packet. Final stacked source and actual cold proof were reviewed separately from the retained original evidence.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The base is the authentication prerequisite branch; the diff contains only the Codex routing fix. Execution hosts continue to own settings and credential homes; optional local settings preserve older callers. Proxy values stay in the child environment. No global cookie policy, retry policy, billing behavior or remote wire change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@nwparker
nwparker force-pushed the nwparker/reproducible-codex-proxy-10-09 branch from 8f1e26a to bfcca95 Compare October 9, 2026 20:55
@nwparker
nwparker changed the base branch from main to nwparker/reproducible-http-proxy-auth-10-09 October 9, 2026 20:56
@OrcaWin
OrcaWin force-pushed the nwparker/reproducible-codex-proxy-10-09 branch from c659f70 to ebf54f1 Compare October 11, 2026 07:35
@OrcaWin
OrcaWin changed the base branch from nwparker/reproducible-http-proxy-auth-10-09 to main October 11, 2026 07:36
…roxy

Use the host HTTP client for usage, reset-credit reads and redemption, keep
those account requests cookie-free, and pass configured proxy settings to the
native Codex probe. WSL probes keep the guest's own proxy environment.

Co-authored-by: petersindex <[email protected]>
Co-authored-by: mmarabel <[email protected]>
@OrcaWin
OrcaWin marked this pull request as ready for review October 11, 2026 07:36
@OrcaWin
OrcaWin force-pushed the nwparker/reproducible-codex-proxy-10-09 branch from ebf54f1 to ab63d0f Compare October 11, 2026 07:36
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23b63f30-8660-4a10-b298-5cb487c7ac80


📥 Commits

Reviewing files that changed from the base of the PR and between e3be586 and ab63d0f.



📒 Files selected for processing (11)
  • src/main/rate-limits/codex-fetcher-backend.test.ts
  • src/main/rate-limits/codex-fetcher-process-contract.test.ts
  • src/main/rate-limits/codex-fetcher.ts
  • src/main/rate-limits/codex-rate-limit-fetch-options.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.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


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

Codex rate-limit fetches now receive resolved network proxy settings from service call sites. Non-WSL RPC probes add configured proxy environment variables; WSL probes retain the guest’s proxy environment. Usage, credit lookup, and credit redemption requests now use the shared HTTP client with credentials omitted. Tests cover proxy propagation, request details, and transport failure behavior.



Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to ab63d

Codex usage, reset-credit, and redemption requests now route through the configured proxy, and the change looks safe to merge. Actual WSL guest behavior is still pending validation by the author.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the primary change: routing Codex usage through the configured proxy.
Description check Passed The description covers the required sections, explains the user impact and implementation, links related issues, documents visual proof, testing, platform limitations, security considerations, and che…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants