feat(model): add configurable http/https/socks5 proxy support - #301
Merged
Merged
Conversation
Add a `proxy` config block (url + noProxy) and route every outbound HTTP client in the CLI and daemon through a shared proxy-aware transport. - model/http_client.go: shared transport, ConfigureProxy, NewHTTPClient, HTTPTransport, ParseProxyURL and RedactProxyURL - supports http, https, socks5 and socks5h; bare host:port means http - noProxy uses NO_PROXY semantics (domain suffix, CIDR); loopback bypasses - falls back to HTTP(S)_PROXY env vars when unset or invalid - config.local overrides proxy; `config view` redacts proxy passwords - docs: Network Proxy section in docs/CONFIG.md Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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
Adds a
proxyconfig block. Every outbound HTTP request from the CLI and daemon now goes through one shared, proxy-aware transport.Behaviour
http,https,socks5andsocks5h, all native tonet/http. A barehost:portmeanshttp://. SOCKS4 is rejected with a clear error.noProxy: usesNO_PROXYrules viagolang.org/x/net/http/httpproxy(domain suffix, CIDR,*.domain). Loopback always skips the proxy.HTTP(S)_PROXY/NO_PROXYenvironment variables apply. An invalid URL logs a warning and never aborts the CLI.config.local.*can override the proxy.shelltime config viewredacts proxy passwords.proxy enabled(redacted) at startup. Changing the proxy requires a daemon restart.Implementation
model/http_client.go:ConfigureProxy,NewHTTPClient(otel-wrapped),HTTPTransport(),ParseProxyURLandRedactProxyURL.SendHTTPRequestJSON(and thereforeSendGraphQLRequestand all their callers), handshake, updater, AI suggest stream, bash-preexec download, and the Anthropic and Codex usage fetchers in the daemon.cmd/cliandcmd/daemoncallConfigureProxyright after reading config.golang.org/x/netmoves from indirect to direct, same version.docs/CONFIG.md, plus README and CLAUDE.md notes.Known limitations
The uptrace OTEL exporter (
enableMetrics) and thebunx/npx ccusagesubprocess only honour the environment variables. These are documented rather than handled withos.Setenv, which would leak into child processes, and npm/bun don't understand SOCKS.Test plan
model/http_client_test.go: scheme validation, redaction, nil/invalid config keeps the transport,noProxyand loopback selection, end-to-end through anhttptestHTTP proxy, and end-to-end through an in-test SOCKS5 server (hostname resolved by the proxy)config viewredaction testconfig viewmasks the password, andsocks4://logs the fallback warningcommands/daemonfailures are unrelated: the same socket tests fail onmainssh -D)🤖 Generated with Claude Code