Skip to content

fix: don't use Gateway.Domain in gateway output URLs#1753

Merged
lpcox merged 1 commit intomainfrom
fix/gateway-output-domain
Mar 10, 2026
Merged

fix: don't use Gateway.Domain in gateway output URLs#1753
lpcox merged 1 commit intomainfrom
fix/gateway-output-domain

Conversation

@lpcox
Copy link
Collaborator

@lpcox lpcox commented Mar 10, 2026

Problem

The smoke-allowonly workflow fails with Ping failed: HTTP 000 on all MCP server connectivity checks when using gateway v0.1.12+.

Root cause: Commit 9a70098 added logic to prefer cfg.Gateway.Domain (e.g., host.docker.internal) in writeGatewayConfig output URLs. The gateway output config is consumed by the gh-aw infrastructure's connectivity check script, which runs on the host runner. host.docker.internal doesn't resolve from the host, causing curl to get no TCP connection (HTTP 000).

Evidence:

  • v0.1.8 (success): gateway output URLs used http://0.0.0.0:80/mcp/* → curl treats as localhost → works
  • v0.1.12 (failure): gateway output URLs used http://host.docker.internal:80/mcp/* → DNS fails from host → HTTP 000
  • Health check on localhost:80 always passes — the gateway IS running
  • Gateway logs show zero MCP requests in failing runs (requests never reach the gateway)

Fix

Remove the cfg.Gateway.Domain preference from writeGatewayConfig. The gateway output should always use the listen host (with wildcard addresses mapped to 127.0.0.1). The downstream converter already handles domain mapping when generating agent configs for container-side access.

Changes

  • internal/cmd/root.go: Remove domain preference, keep wildcard→127.0.0.1 mapping
  • internal/cmd/stdout_config_test.go: Update test expectations
  • test/integration/auth_config_test.go: Update URL expectation

All tests pass (make agent-finished ✓).

The gateway output config is consumed by host-side tools (health checks,
connectivity checks) that need localhost-reachable URLs. Previously,
writeGatewayConfig preferred cfg.Gateway.Domain (e.g., 'host.docker.internal')
which doesn't resolve from the host runner, causing MCP connectivity
checks to fail with HTTP 000.

Now the gateway output always uses the listen host (mapped to 127.0.0.1
for wildcard addresses). The downstream converter handles domain mapping
for container-side agent configs.

This fixes smoke-allowonly workflow failures where the gateway health check
passed on localhost:80 but MCP server checks failed on host.docker.internal:80.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 10, 2026 22:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes gateway stdout “output config” URL generation to be host-runner reachable by avoiding cfg.Gateway.Domain (e.g., host.docker.internal) and instead using the listen host with wildcard binds mapped to 127.0.0.1. This aligns the gateway’s emitted config with how gh-aw host-side connectivity checks consume it.

Changes:

  • Update writeGatewayConfig to always derive output URLs from the listen host (wildcard → 127.0.0.1), ignoring cfg.Gateway.Domain.
  • Adjust unit test expectations for domain vs. listen-host behavior.
  • Update integration test expectation for emitted routed URL host.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/cmd/root.go Stops preferring cfg.Gateway.Domain for stdout output URLs; keeps wildcard → 127.0.0.1 mapping.
internal/cmd/stdout_config_test.go Updates test case naming/expectations to reflect domain no longer overriding listen host.
test/integration/auth_config_test.go Updates expected routed URL host to 127.0.0.1 to match new output behavior.
Comments suppressed due to low confidence (1)

internal/cmd/root.go:454

  • The debug log "Resolved gateway address" logs host, but the URLs are built using domain (which may be rewritten from wildcard hosts to 127.0.0.1). This can be misleading when troubleshooting output URL issues; consider logging domain (or both host and domain) here.
	domain := host
	if domain == "0.0.0.0" || domain == "::" || domain == "[::]" {
		domain = "127.0.0.1"
	}

	debugLog.Printf("Resolved gateway address: host=%s, port=%s", host, port)


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

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.

2 participants