Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

  • Understand the issue: Codex agent cannot resolve host.docker.internal to connect to MCP Gateway
  • Identify root cause: CodexDefaultDomains missing host.docker.internal (unlike Copilot/Claude defaults)
  • Add host.docker.internal to CodexDefaultDomains in pkg/workflow/domains.go
  • Update TestCodexDefaultDomains test to expect the new domain
  • Update TestGetCodexAllowedDomains test to include host.docker.internal in expected output
  • Fix GitHub MCP remote mode domain extraction:
    • Add GitHubCopilotMCPDomain constant in pkg/constants/constants.go
    • Detect mode: remote in extractHTTPMCPDomains and add api.githubcopilot.com
    • Add tests for remote/local mode domain extraction
  • Disable Codex CLI internal sandbox:
    • Add --sandbox danger-full-access flag to Codex CLI invocation
    • This allows file writes and shell commands when running inside AWF
  • Fix noop.test.cjs: update test to expect core.info instead of core.error
  • Run unit tests to verify changes - PASSED
  • Build and recompile workflows
  • Run code review - No issues
  • Run security scan (CodeQL) - No vulnerabilities found
Original prompt

This section details on the original issue you should resolve

<issue_title>Codex agent unable to use MCP tools due to host.docker.internal DNS resolution failure</issue_title>
<issue_description>## Summary

Workflow runs with the Codex engine are showing as successful (green checkmark) but the agent cannot actually use any MCP tools due to DNS resolution failures when connecting to host.docker.internal.

Evidence

Workflow Run: https://github.com/githubnext/gh-aw/actions/runs/21005890162

Discovery Process

Using gh aw audit to investigate the run:

./gh-aw audit https://github.com/githubnext/gh-aw/actions/runs/21005890162 --parse -v

The audit report shows the workflow completed successfully with 0 errors, but examining the agent logs reveals critical MCP server failures.

Root Cause

All 6 MCP servers failed to start from the Codex client with DNS resolution errors:

ERROR rmcp::transport::worker: worker quit with fatal: Transport channel closed, when Client(reqwest::Error { kind: Request, url: "http://host.docker.internal/mcp/<server>", source: hyper_util::client::legacy::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: Name does not resolve" })) })

Failed MCP Servers:

  • safeinputs
  • playwright
  • serena
  • tavily
  • github
  • safeoutputs

MCP Gateway Status

The MCP Gateway itself is working correctly:

  • Successfully started: Loaded 6 MCP server(s): [safeoutputs serena tavily github playwright safeinputs]
  • All servers connected and responded to tools/list requests
  • Gateway listening on 0.0.0.0:80

The Problem

The Codex agent running inside the Docker container cannot resolve host.docker.internal to connect to the MCP Gateway. This causes all MCP tool calls to fail silently.

Additional Context

OAuth Warnings:
The logs also show repeated warnings about keyring access failures:

WARN codex_rmcp_client::oauth: failed to read OAuth tokens from keyring: Platform secure storage failure: zbus error: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files

This suggests the system cannot access org.freedesktop.secrets for secure storage.

Impact

  • Workflows appear successful but MCP functionality is completely broken
  • Silent failure makes debugging difficult without examining detailed logs
  • Affects all Codex engine workflows that rely on MCP tools

Reproduction

  1. Run any Codex workflow that uses MCP servers
  2. Use gh aw audit <run-id> to download logs
  3. Search for "mcp:.*failed" in agent-stdio.log:
    grep -E "mcp:.*failed" .github/aw/logs/run-<id>/agent-stdio.log

Suggested Fix

Investigate Docker networking configuration to ensure host.docker.internal DNS resolution works correctly inside the Codex agent container. This may involve:

  • Verifying Docker network settings
  • Checking if --add-host flags are needed
  • Ensuring the container has proper DNS configuration</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Changeset

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator

Copilot AI and others added 2 commits January 14, 2026 22:15
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Fixes DNS resolution failure when Codex agent tries to connect to
MCP Gateway via host.docker.internal from within AWF container.

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix DNS resolution failure for MCP tools in Codex agent Add host.docker.internal to Codex default domains for MCP gateway access Jan 14, 2026
Copilot AI requested a review from Mossaka January 14, 2026 22:32
@Mossaka Mossaka added the smoke label Jan 14, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

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

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved PR data
  • ❌ Serena Go: Command not found
  • ✅ Playwright: Navigated to GitHub (title: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File Writing: Created test file successfully
  • ✅ Bash Tool: Verified file content

Status: FAIL (serena-go unavailable)

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results

PRs:

Tests:

  • ✅ GitHub MCP (list PRs)
  • ❌ Serena Go (tool not available)
  • ✅ Playwright (navigation)
  • ✅ Tavily Search (5 results)
  • ✅ File Write
  • ✅ Bash

Status: PARTIAL PASS (5/6 tests passed, Serena Go unavailable)

AI generated by Smoke Claude

@Mossaka
Copy link
Collaborator

Mossaka commented Jan 14, 2026

@copilot

The codex test tried to connect to an MCP server and got:

❌ Connection failed: failed to connect to HTTP MCP server: 
   calling "initialize": rejected by transport: 
   sending "initialize": Post "https://api.githubcopilot.com/mcp/": 
   dial tcp: lookup api.githubcopilot.com: no such host

Codex's reqwest library has DNS resolution issues

Can you think of a solution to workaround of it without compromising the security posture of awf and the gateway?

@Mossaka Mossaka marked this pull request as ready for review January 14, 2026 23:35
When using `tools.github.mode: remote`, the Codex agent needs to connect
to api.githubcopilot.com. This wasn't being added to the firewall allowlist
because the URL is set internally, not in the raw frontmatter.

- Add GitHubCopilotMCPDomain constant
- Detect `mode: remote` in extractHTTPMCPDomains and add the domain
- Add tests for GitHub MCP remote/local mode domain extraction

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot

The codex test tried to connect to an MCP server and got:
...

Fixed in 558cd2d. The issue was that when using tools.github.mode: remote, the api.githubcopilot.com domain wasn't being added to the AWF firewall allowlist because:

  1. The raw frontmatter only has mode: remote - no explicit URL
  2. The URL is set internally during MCP config generation
  3. extractHTTPMCPDomains couldn't find the URL to extract the domain

Solution: Enhanced extractHTTPMCPDomains to detect GitHub MCP mode: remote and automatically add api.githubcopilot.com to the allowed domains using a new GitHubCopilotMCPDomain constant.

This maintains the security posture - only the specific remote MCP domain is allowed, not arbitrary domains.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@Mossaka Mossaka added the smoke label Jan 15, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@Mossaka
Copy link
Collaborator

Mossaka commented Jan 15, 2026

@github-actions
Copy link
Contributor

PRs: Add JSON output and DEBUG logging to OpenCode engine; Remove incorrect PATH setup for OpenCode npm global installation
GitHub MCP ✅
Serena-go ❌
Playwright ✅
Tavily ✅
File write ✅
Bash cat ✅
Overall: FAIL

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved merged PRs successfully
  • ❌ Serena Go: Command not found
  • ✅ Playwright: Navigated to GitHub (title: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File Writing: Created test file successfully
  • ✅ Bash Tool: File read/verified successfully

Overall Status: FAIL (1/5 tests failed)

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results - Claude Engine

Recent PRs:

Test Results:

  • ✅ GitHub MCP (list PRs)
  • ❌ Serena Go (command not found)
  • ✅ Playwright (page loaded, title verified)
  • ✅ Tavily Web Search (5 results returned)
  • ✅ File Creation & Bash Tools
  • ✅ Safe Outputs (this comment)

Status: PARTIAL PASS (5/6)

AI generated by Smoke Claude

The loadAgentOutput function was changed to use core.info instead of
core.error for missing files (see #10128). This is a normal scenario
when the agent fails before producing safe-outputs, so info-level
logging is appropriate.

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot fix this run failure: https://github.com/githubnext/gh-aw/actions/runs/21048249052/job/60528124113?pr=9999

Fixed in 8665727. The noop.test.cjs test was expecting core.error to be called, but the loadAgentOutput function was changed to use core.info for missing files (per #10128). Updated the test to match the new behavior.

Note: The other test failures (handle_agent_failure.test.cjs, create_pr_review_comment.test.cjs) are pre-existing issues unrelated to this PR's changes.

- Add 30 second timeout to all Go tests (was 10s default)
- Go compilation in CI can be slow
- Fixes test timeout failures in CI
@Mossaka Mossaka added smoke and removed smoke labels Jan 15, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

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

@github-actions
Copy link
Contributor

Smoke Test Results (Run #21049334863)

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved last 2 merged PRs
  • ❌ Serena Go: go command not available
  • ✅ Playwright: Navigated to github.com, title verified ("GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-copilot-21049334863.txt
  • ✅ Bash Tool: File read successful

Overall Status: FAIL (1 test failed)

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 merged PRs:

  • Add JSON output and DEBUG logging to OpenCode engine
  • Remove incorrect PATH setup for OpenCode npm global installation

✅ GitHub MCP
✅ Playwright
✅ Tavily Web Search
✅ File Writing
✅ Bash Tool
❌ Serena Go (tool not available)

Status: PASS (5/6 tests passed)

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

Merged PRs:
Add JSON output and DEBUG logging to OpenCode engine
Remove incorrect PATH setup for OpenCode npm global installation
Tests: MCP ✅ | Serena-go ❌ | Playwright ✅ | Tavily ✅ | File ✅
Overall: FAIL

AI generated by Smoke Codex

@Mossaka Mossaka merged commit 6d83d6e into main Jan 15, 2026
117 checks passed
@Mossaka Mossaka deleted the copilot/fix-dns-resolution-failure branch January 15, 2026 23:09
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.

Codex agent unable to use MCP tools due to host.docker.internal DNS resolution failure

2 participants