Fix DIFC proxy GraphQL endpoint rewriting for github.com API base#4030
Merged
Fix DIFC proxy GraphQL endpoint rewriting for github.com API base#4030
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/704c283d-fc05-4f02-bd25-3574eec4f332 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix DIFC proxy to return correct path for GitHub GraphQL API
Fix DIFC proxy GraphQL endpoint rewriting for github.com API base
Apr 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates DIFC proxy GraphQL forwarding so requests are rewritten to the correct upstream GraphQL endpoint depending on the configured GitHub API base (GHES /api/v3 vs github.xm233.cn-style), preventing 404s/retry loops.
Changes:
- Adjusted
forwardToGitHubGraphQL normalization to route to/graphqlfor non-/api/v3API bases and to/api/graphqlfor/api/v3API bases. - Added unit tests validating dotcom-style API base GraphQL rewriting and query-string preservation across supported incoming path variants.
- Updated handler test expectations to match the normalized dotcom forwarding path for
/api/graphql?....
Show a summary per file
| File | Description |
|---|---|
internal/proxy/proxy.go |
Implements conditional GraphQL endpoint rewrite based on whether githubAPIURL ends with /api/v3. |
internal/proxy/proxy_test.go |
Adds coverage for dotcom-style API base ensuring GraphQL paths normalize to /graphql and preserve query strings. |
internal/proxy/handler_test.go |
Aligns expected forwarded URL for /api/graphql?... with new dotcom normalization behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
This was referenced Apr 17, 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.
The DIFC proxy was forwarding GraphQL traffic to
/api/graphqleven when upstream was github.xm233.cn-style, causing 404s and repeated retries in cli-proxy workflows. This updates GraphQL path normalization to target the correct endpoint based on configured API base.Endpoint rewrite logic
/api/v3(GHES) →/api/graphql/api/v3(github.com) →/graphql/graphql,/api/graphql,/api/v3/graphql.Coverage for dotcom behavior
/graphqlacross all supported input path forms.Handler expectation alignment
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build203165019/b514/launcher.test /tmp/go-build203165019/b514/launcher.test -test.testlogfile=/tmp/go-build203165019/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build203165019/b405/vet.cfg 1.80.0/internal/resolver/delegatingresolver/delegatingresolver.go 0845442/b151/ x_amd64/vet e.go esource/v1(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build203165019/b496/config.test /tmp/go-build203165019/b496/config.test -test.testlogfile=/tmp/go-build203165019/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build203165019/b317/vet.cfg /sdk@v1.43.0/trago1.25.8 /sdk@v1.43.0/tra-c=4 x_amd64/vet ctor idle E=3 x_amd64/vet 0845�� g_.a otection x_amd64/vet --gdwarf-5 rs/otlp/otlptrac-atomic -o x_amd64/vet(dns block)nonexistent.local/tmp/go-build203165019/b514/launcher.test /tmp/go-build203165019/b514/launcher.test -test.testlogfile=/tmp/go-build203165019/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build203165019/b405/vet.cfg 1.80.0/internal/resolver/delegatingresolver/delegatingresolver.go 0845442/b151/ x_amd64/vet e.go esource/v1(dns block)slow.example.com/tmp/go-build203165019/b514/launcher.test /tmp/go-build203165019/b514/launcher.test -test.testlogfile=/tmp/go-build203165019/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build203165019/b405/vet.cfg 1.80.0/internal/resolver/delegatingresolver/delegatingresolver.go 0845442/b151/ x_amd64/vet e.go esource/v1(dns block)this-host-does-not-exist-12345.com/tmp/go-build203165019/b523/mcp.test /tmp/go-build203165019/b523/mcp.test -test.testlogfile=/tmp/go-build203165019/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s 0845�� g_.a GBv9xrrGM x_amd64/vet -p go-sdk/internal/-atomic -lang=go1.24 x_amd64/vet ortc�� cfg 64/src/net/textp-ifaceassert x_amd64/vet . --gdwarf2 --64 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: