Repository navigation
fix(proxy): make Claude and Codex proxies fail-open and resilient across user environments - #1556
Merged
Merged
Conversation
…ig hygiene Skip local proxies in incompatible corporate/cloud/custom-provider/indeterminate-auth environments, preserve user NO_PROXY and NODE_EXTRA_CA_CERTS, and fall back to direct spawn on any proxy startup failure instead of aborting session launch. Refs #1552
Hard terminal-mode panes render the raw provider PTY directly and never mount Agent Code's semantic feed. Pass useProxy: false when the effective view mode (per-pane override or global setting) is 'terminal' across spawn, wake, reload, and rehydrate. Refs #1552
…nd auth policy Guard CodexSession's proxy catch block against cancelled start attempts before mutating shared fields or falling through to ptySpawn, stop consulting env.OPENAI_BASE_URL/env.OPENAI_API_KEY that Codex TUI ignores, validate config.toml openai_base_url and skip profile/chatgpt_base_url/keyring configs, update ClaudeSession diagnostic comment, and record review disposition in the plan. Refs #1552
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.
Summary
Makes both the Claude (
mitmdump) and Codex (ResponsesProxy) local proxies strictly fail-open and safe across arbitrary user configurations:mitmdumporResponsesProxyfails to resolve, bind, or start for any reason, Agent Code cleans up any partial proxy state, logs a warning + typedtranscript-diagnostic, and spawns the CLI directly without the proxy instead of aborting the pane withClaude proxy startup failed….claudeProxyPolicy.ts,claudeSession.ts) — Automatically skips local mitmproxy when corporateHTTPS_PROXY/HTTP_PROXY, Bedrock/Vertex/Foundry, or localhost/HTTPANTHROPIC_BASE_URLis set; mergeslocalhost,127.0.0.1,::1into existingNO_PROXY/no_proxy; combines userNODE_EXTRA_CA_CERTSwith mitmproxy's CA into a per-run PEM (0o600) instead of clobbering corporate root CAs.codexProxyPolicy.ts,codexSession.ts) — HonorsCODEX_HOME, parsesconfig.toml(@iarna/toml) to respect customopenai_base_url(URL-validated) and skip proxy for non-openaimodel_provider,profile,chatgpt_base_url, orcli_auth_credentials_store = "keyring"; detects all ChatGPT/Codex-backendauth_modevalues and legacyauth.json; skips proxy when auth is indeterminate (Keychain/pre-login) instead of guessingapi.openai.comand causing 401s; mergesNO_PROXYwhen proxying.shouldUseProxyForSession) — Hard Terminal-mode panes render raw PTY output and skip spawning unnecessary local proxies.Linked Issues
Fixes #1552
Plan & Review Disposition (one round, independent read-only reviewer)
Plan:
docs/plans/2026-11-27-proxy-resilience.mdCodexSession.start()attempt incatchcould clobber a newer generation'sproxyServer1353c026f(stops local proxy + checksisStartAttemptActive(attempt)first)env.OPENAI_BASE_URL/env.OPENAI_API_KEYinference could misroute Keychain ChatGPT users (Codex TUI doesn't read them)1353c026f(removed both env branches)openai_base_urlandprofile/chatgpt_base_url/keyringinconfig.toml1353c026fClaudeSessionEvents['transcript-diagnostic']1353c026fVerification
npm run typecheck: passed (0 errors).