Skip to content

Let Switch Cloud session hosts reach vendors through the box proxy - #2532

Draft
lbangalosbt wants to merge 1 commit into
mainfrom
connectors/switch-cloud-node-proxy
Draft

lbangalosbt wants to merge 1 commit into
mainfrom
connectors/switch-cloud-node-proxy

Conversation

@lbangalosbt

Copy link
Copy Markdown
Collaborator

What this changes

On a Switch Cloud box, connector tools that the session host sets up itself did not work. Every Google Workspace (gws) call failed with gws failed: fetch failed, and BigQuery's MCP tools stayed "still connecting". Connectors worked when the same agent ran on a local machine.

A box has no DNS and leaves only through its egress proxy. Node's fetch ignores HTTPS_PROXY unless NODE_USE_ENV_PROXY is set when the process starts. The box operator sets it on the controller container only (added in #2278 for the controller's connection to Core). The agents container does not have it, so its session hosts failed to download a vendor CLI or reach a vendor's MCP server.

  • The fix: in box mode, switch-agent-controller sets NODE_USE_ENV_PROXY=1 in its own environment at start if HTTPS_PROXY or https_proxy is set. Every process it starts inherits it, which includes the launcher's session hosts in the agents container. An explicit value is kept. No pod spec change is needed.
  • No wider access: the flag only sends these calls to the proxy, which still applies each box's rules. Agent CLIs get a filtered environment (AGENT_ENV_VARS) and are not affected. The gateway's proxy login is still removed before any child starts.
  • Clearer error: a vendor CLI download that cannot connect now names the host and the network cause. For example: The download of `gws` from github.com failed: fetch failed (EAI_AGAIN: …).

How it was tested

  • Added: run-box.test.ts (flag set with a proxy, unchanged without one or when given) and cli-binaries.test.ts (host and cause in a failed download).
  • Ran: vitest for both files, typecheck, oxlint and oxfmt --check for agent-controller and agent-providers.
  • On a production Switch Cloud box, through the agent's own shell, before the fix: a fetch to https://bigquery.googleapis.com/mcp failed with UND_ERR_CONNECT_TIMEOUT. With NODE_USE_ENV_PROXY=1 it returned HTTP 405 from Google. The box's tools/status.json showed gws as failed with fetch failed.
  • Not verified: a box image built from this branch. This needs a check on a development box after the next box release: gws and BigQuery calls from a Switch Cloud agent.

Generated by Claude Code

A box has no DNS and leaves only through its egress proxy. The controller
container sets NODE_USE_ENV_PROXY so Node's fetch uses HTTPS_PROXY, but the
agents container does not, so the session hosts it starts could not download
a vendor CLI (gws) or connect to a vendor's MCP server (BigQuery): every
Google Workspace call failed with a bare "fetch failed" and BigQuery's tools
never loaded.

In box mode the controller binary now sets NODE_USE_ENV_PROXY=1 for its
children whenever a proxy is set and the setting isn't already given, so
it applies to the launcher in the agents container without a pod spec
change. Agent CLIs get a filtered environment and are unaffected.

A failed vendor CLI download now names the host and the network cause
instead of "fetch failed".
@lbangalosbt lbangalosbt self-assigned this Dec 4, 2026

This branch has not been deployed

No deployments
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.

1 participant