fix: don't use Gateway.Domain in gateway output URLs#1753
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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
writeGatewayConfigto always derive output URLs from the listen host (wildcard →127.0.0.1), ignoringcfg.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 usingdomain(which may be rewritten from wildcard hosts to 127.0.0.1). This can be misleading when troubleshooting output URL issues; consider loggingdomain(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.
This was referenced Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
smoke-allowonlyworkflow fails withPing failed: HTTP 000on 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) inwriteGatewayConfigoutput URLs. The gateway output config is consumed by the gh-aw infrastructure's connectivity check script, which runs on the host runner.host.docker.internaldoesn't resolve from the host, causing curl to get no TCP connection (HTTP 000).Evidence:
http://0.0.0.0:80/mcp/*→ curl treats as localhost → workshttp://host.docker.internal:80/mcp/*→ DNS fails from host → HTTP 000localhost:80always passes — the gateway IS runningFix
Remove the
cfg.Gateway.Domainpreference fromwriteGatewayConfig. The gateway output should always use the listen host (with wildcard addresses mapped to127.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 mappinginternal/cmd/stdout_config_test.go: Update test expectationstest/integration/auth_config_test.go: Update URL expectationAll tests pass (
make agent-finished✓).