feat(mac): add proxy config and harden quota window routing - #57
Open
XLevon wants to merge 2 commits into
Open
Conversation
Proxy configuration (macOS): - Add Settings UI for HTTP/HTTPS/SOCKS5/SOCKS5h proxy configuration - Store proxy_state.json under per-platform runtime dir (macos/) - Inject proxy into reqwest HTTP client (ChatGPT plan/quota API) - Inject proxy env vars into codex app-server and login subprocesses - Inject proxy env vars into update-check curl subprocess - Invalidate cached HTTP client on proxy change for immediate effect - Validate proxy URL via reqwest::Proxy::all before saving - reqwest: enable socks feature for SOCKS5 support Quota window routing: - Fall back to reset_at distance when window_minutes is missing in /wham/usage payload (observed in production). 5h window resets within hours, weekly resets in days; classify by 6h threshold. - Apply reset_at fallback across all three data paths: chatgpt_api, codex_app_server, session_usage - Show "Xd Yh Zm" reset countdown when reset is more than a day out (previously "115h 20m" for weekly resets)
Cmochance
force-pushed
the
feat/mac-proxy-config
branch
from
July 26, 2026 01:08
4808388 to
f1b4c43
Compare
Owner
|
@XLevon Thanks for the contribution! Maintainer note: #56 landed on main first and touched the same quota code, so I rebased this branch onto the new main (via the "allow edits from maintainers" permission) — What changed during the rebase:
Local verification after the rebase: |
Surfaced by Cmochance#57: formatting drift passed CI because no fmt check ran. rustfmt is not in dtolnay/rust-toolchain's minimal profile, so declare the component explicitly.
Author
|
Thanks for handling the rebase and preserving both behaviors! I really appreciate the detailed verification.For additional context, I use a proxy with custom routing rules on macOS. Without this configuration, Codex Account Switch does not route its requests through the proxy, so I’m unable to sign in to my OpenAI accounts or refresh quota information.This implementation currently covers macOS only; I haven’t considered or tested Windows or Linux support yet.Thanks again for creating and maintaining such a useful tool!
|
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.
Changes
Proxy configuration (macOS)
proxy_state.jsonunder per-platform runtime dir (macos/)reqwest::Proxy::allbefore savingsocksfeature for SOCKS5 supportQuota window routing fix
reset_atdistance whenwindow_minutesis missing in/wham/usagepayload (observed in production). 5h window resets within hours, weekly resets in days; classify by 6h threshold.reset_atfallback across all three data paths:chatgpt_api,codex_app_server,session_usageXd Yh Zmreset countdown when reset is more than a day out (previously115h 20mfor weekly resets)Test plan
cargo test quota_routing— 5 tests passcargo check --lib— compiles cleansocks5h://127.0.0.1:7898, refresh profile, 403 region error gone4d 19h 20minstead of115h 20m