Skip to content

Exclude topology-attached MCP peers from agent proxy routing#6189

Merged
lpcox merged 5 commits into
mainfrom
copilot/fix-no-proxy-issue
Jul 20, 2026
Merged

Exclude topology-attached MCP peers from agent proxy routing#6189
lpcox merged 5 commits into
mainfrom
copilot/fix-no-proxy-issue

Conversation

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

In network-isolation mode, the agent container did not exempt topology-attached peers such as awmg-mcpg from proxy routing. Native MCP HTTP connections to gateway-mounted servers were therefore sent through Squid and denied, causing spurious TCP_DENIED audit noise and marking MCP servers as failed during session init.

  • Proxy environment

    • Extend agent NO_PROXY / no_proxy generation to include config.topologyAttach hostnames.
    • Keep existing local/service bypass entries intact (localhost, AWF service IPs, api-proxy, host-access entries).
    • Deduplicate the final list before exporting it to the container environment.
  • Regression coverage

    • Add a focused unit test proving topology peers such as awmg-mcpg and awmg-cli-proxy are present in NO_PROXY.
const noProxyEntries = [
  'localhost',
  '127.0.0.1',
  '::1',
  '0.0.0.0',
  networkConfig.squidIp,
  networkConfig.agentIp,
  ...(config.topologyAttach || []),
];

environment.NO_PROXY = [...new Set(noProxyEntries)].join(',');
environment.no_proxy = environment.NO_PROXY;

Copilot AI changed the title [WIP] Fix NO_PROXY omission for MCP gateway hostname Exclude topology-attached MCP peers from agent proxy routing Jul 13, 2026
Copilot finished work on behalf of lpcox July 13, 2026 16:16
Copilot AI requested a review from lpcox July 13, 2026 16:16
@lpcox

lpcox commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Addressed in e80feaa.

Copilot finished work on behalf of lpcox July 20, 2026 00:04
Only exempt topology-attached peers (awmg-mcpg, awmg-cli-proxy) from the
agent's proxy routing when the agent actually shares awf-net, i.e. a
compose-managed runtime (runc, gVisor). For microVM backends (Docker sbx)
the agent runs off awf-net and cannot resolve or route to these container
hostnames, so injecting them into NO_PROXY there would turn a Squid 403
into an unroutable direct connection.

- Gate the exemption on networkIsolation && runtimeUsesComposeAgent so it
  applies to gVisor and ARC/DinD compose isolation but not sbx.
- Defensively exempt difcProxyHost in case the DIFC/cli-proxy is configured
  independently of topologyAttach.
- Document the hostname-only limitation (peer IPs are unknown at
  config-write time; MCP URLs address peers by hostname).
- Add matrix tests: compose isolation (included), difcProxyHost (included),
  non-isolation (excluded), sbx microVM (excluded).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 33d45308-d07a-4a8a-887a-dfe16c75efa4
@lpcox
lpcox marked this pull request as ready for review July 20, 2026 16:53
Copilot AI review requested due to automatic review settings July 20, 2026 16:53
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 98.45% 98.79% 📈 +0.34%
Statements 98.29% 98.73% 📈 +0.44%
Functions 99.16% 99.28% 📈 +0.12%
Branches 94.30% 95.01% 📈 +0.71%
📁 Per-file Coverage Changes (3 files)
File Lines (Before → After) Statements (Before → After)
src/sbx-manager.ts 96.7% → 96.6% (-0.04%) 96.2% → 96.1% (-0.05%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
src/config/mount-policy.ts 80.2% → 100.0% (+19.80%) 74.3% → 100.0% (+25.72%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

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

Adds topology-attached peers to agent proxy bypass settings in network-isolation mode.

Changes:

  • Extends and deduplicates NO_PROXY entries.
  • Excludes unsupported microVM runtimes.
  • Adds focused and compose-level regression tests.
Show a summary per file
File Description
proxy-environment.ts Adds topology peer proxy bypasses.
proxy-environment.test.ts Tests runtime-specific bypass behavior.
agent-environment-options.test.ts Verifies generated compose environment.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/services/agent-environment/proxy-environment.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP connectivity ⚠️ (template vars not expanded)
File write/read ⚠️ (template vars not expanded)

Overall: PARTIAL — MCP ✅, pre-step template variables (${{ steps.smoke-data.outputs.* }}) were not substituted before agent invocation.

Author: @lpcox

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6189 · 54.6 AIC · ⊞ 3.3K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS

  • ✅ GitHub MCP connectivity
  • ✅ GitHub.com HTTP 200
  • ✅ File write/read test
  • ✅ BYOK inference (direct via api-proxy → api.githubcopilot.com)

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY).

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results — Services Connectivity

  • Redis PING: ❌ (host.docker.internal DNS resolution failed)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (DNS resolution failed)

Overall: FAILhost.docker.internal is not resolvable in this environment. Service containers may not be running or the hostname is not available outside a Docker network context.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@lpcox
lpcox enabled auto-merge (squash) July 20, 2026 17:03
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@lpcox
Smoke Test: Copilot BYOK (Direct) Mode — Azure OpenAI (Foundry, api-key)

  • MCP connectivity: ✅
  • GitHub.com connectivity: ✅
  • File I/O: ✅
  • BYOK Inference: ✅
    Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
    Status: PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🔥 AWF Smoke Test — PAT Auth

Test Status
GitHub MCP connectivity ✅ Connected
github.com HTTP ✅ 200 OK
File write/read ⚠️ Pre-step vars not substituted
Pre-fetched PR data ⚠️ Filtered by secrecy policy

Overall: PASS (core connectivity tests passed)
Auth mode: PAT (COPILOT_GITHUB_TOKEN)

🔑 PAT report filed by Smoke Copilot PAT
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison ✅

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13
Node.js v24.18.0 v24.18.0
Go go1.22.12 go1.22.12

All runtimes match between host and chroot environments.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test

  • Internalize dead \sbx-manager` exportsandInternalize dead `secureWipeFile` export in SSL key storage` were the last 2 merged PR titles
  • Safe-input GH CLI: ❌ (safeinputs-gh wrapper unavailable; used authenticated gh fallback)
  • GitHub homepage title: ✅
  • Temp file write/read: ✅
  • Discussion lookup: ✅ (found [Security Review] 🔒 Daily Security Review — 2026-07-20 #6419; discussion commenting unavailable here)
  • Build (npm ci && npm run build): ✅
  • Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
1. Module Loading ✅ Pass otel.js loads successfully; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + test internals. isEnabled() returns true when FileSpanExporter fallback is active.
2. Test Suite ⚠️ Expected — No TS tests OTEL tests (otel.test.js, otel-fanout.test.js) exist in containers/api-proxy/ as JS but Jest is configured to only pick up **/*.test.ts in src/ and scripts/. No TypeScript OTEL tests exist yet — expected during development.
3. Env Var Forwarding ✅ Pass src/services/api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, and OTEL_SERVICE_NAME to the api-proxy container.
4. Token Tracker Integration ✅ Pass onUsage callback exists in token-tracker-http.js (line 343) and is the OTEL hook point — called after normalized usage is extracted, feeds setTokenAttributes.
5. OTEL Diagnostics ✅ Pass (fallback) No OTLP endpoint configured in this run; spans fall back to FileSpanExporter writing to /var/log/api-proxy/otel.jsonl. No export errors.

Summary: All scenarios pass or are expected-pending. OTEL integration is functional with graceful degradation to file fallback when no collector endpoint is configured.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox Smoke test results for BYOK AOAI Entra:

  • MCP connectivity: ✅
  • GitHub.com connectivity: ✅
  • File write/read: ✅
  • BYOK inference: ✅

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra

Overall status: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results: Gemini Engine

  • GitHub MCP Testing: ❌ (Results filtered by secrecy policy)
  • GitHub.com Connectivity: ❌ (DNS SERVFAIL for github.com)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

Overall Status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color passed ✅ PASS
Go env passed ✅ PASS
Go uuid passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for #6189 · 37.5 AIC · ⊞ 8.2K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Test Results — Docker Sbx

Test Result
GitHub MCP connectivity ✅ (secrecy-filtered, but MCP responded)
GitHub.com HTTP ✅ HTTP 200
File write/read ⚠️ Pre-step data unavailable (template vars not substituted)
Pre-fetched PR data ⚠️ Not available

Overall: PARTIAL PASS — core connectivity verified; pre-step outputs not injected into prompt.

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent container NO_PROXY omits MCP gateway hostname (awmg-mcpg): native MCP connections denied by Squid

3 participants