Skip to content

Set HTTP_PROXY and HTTPS_PROXY from user / OS config#324209

Merged
chrmarti merged 1 commit into
mainfrom
chrmarti/confident-cheetah
Jul 3, 2026
Merged

Set HTTP_PROXY and HTTPS_PROXY from user / OS config#324209
chrmarti merged 1 commit into
mainfrom
chrmarti/confident-cheetah

Conversation

@chrmarti

@chrmarti chrmarti commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds proxy-resolution plumbing to the agent host so the Copilot SDK subprocess can inherit an accurate HTTP_PROXY / HTTPS_PROXY derived from VS Code’s proxy configuration (settings/env) and, when local, the Electron session (system proxy/PAC).

Changes:

  • Add a reverse-RPC channel (renderer → agent host) to resolve proxies via IRequestService.resolveProxy, plus a node-side AgentHostProxyResolver that feeds this into @vscode/proxy-agent.
  • Extend CopilotAgent to resolve the effective CAPI endpoint host (token-discovered) and inject HTTP_PROXY/HTTPS_PROXY into the SDK subprocess env; restart the client when a token change would change the resolved proxy.
  • Extend ICopilotApiService with resolveApiEndpoint() and update affected tests/fakes accordingly.
Show a summary per file
File Description
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Updates test DI wiring for the new proxy resolver dependency.
src/vs/platform/agentHost/test/node/codex/codexProxyService.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/claudeProxyService.test.ts Updates fake/wrapped ICopilotApiService shapes to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/claudeAgent.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/claudeAgent.integrationTest.ts Updates stub ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/agentService.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/agentHostPullRequestOperationHandler.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/node/agentHostCommitOperationHandler.test.ts Updates fake ICopilotApiService to include resolveApiEndpoint.
src/vs/platform/agentHost/test/electron-browser/localAgentHostService.test.ts Updates channel-registration expectations to include the new proxy channel.
src/vs/platform/agentHost/node/shared/copilotApiService.ts Adds resolveApiEndpoint() and caches discovered endpoints.api per token.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Resolves CAPI proxy and forwards it via HTTP_PROXY/HTTPS_PROXY; restarts client if proxy changes on token update.
src/vs/platform/agentHost/node/agentHostServerMain.ts Registers IAgentHostProxyResolver in the server DI container.
src/vs/platform/agentHost/node/agentHostProxyResolver.ts New node-side resolver that uses @vscode/proxy-agent + optional host proxy resolution via reverse channel.
src/vs/platform/agentHost/node/agentHostMain.ts Wires the reverse proxy channel per renderer connection and registers the resolver in DI.
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts Registers the renderer-side proxy-resolution server channel.
src/vs/platform/agentHost/common/agentHostClientProxyChannel.ts New IPC channel wrapper + renderer-side IServerChannel implementation for resolveProxy.

Review details

Comments suppressed due to low confidence (1)

src/vs/platform/agentHost/node/agentHostMain.ts:148

  • The BYOK gating comment now mentions “proxy” in a way that’s ambiguous/misleading given this file also wires a separate proxy-resolution channel unconditionally. The comment should clarify it’s referring to the BYOK LM bridge/proxy behavior, not the new AgentHostProxyResolver.
	let proxyResolver: AgentHostProxyResolver | undefined;
	// Gate BYOK *use* behind the opt-in `chat.agentHost.byokModels.enabled`
	// setting, forwarded from the renderer as an env var. The proxy and bridge
	// registry are always constructed below (so the session launcher can inject
	// them), but when off they stay inert: the per-connection bridge and the
  • Files reviewed: 17/17 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgent.ts
@chrmarti chrmarti force-pushed the chrmarti/confident-cheetah branch from 0c46b69 to 901b467 Compare July 3, 2026 13:07
@chrmarti chrmarti marked this pull request as ready for review July 3, 2026 13:09
@chrmarti chrmarti enabled auto-merge (squash) July 3, 2026 13:09
@chrmarti chrmarti merged commit e4e5653 into main Jul 3, 2026
29 checks passed
@chrmarti chrmarti deleted the chrmarti/confident-cheetah branch July 3, 2026 14:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.128.0 milestone Jul 3, 2026
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.

3 participants