Skip to content

Support gh CLI /meta probe in DIFC proxy#5924

Merged
lpcox merged 2 commits into
mainfrom
copilot/add-meta-endpoint-support
May 18, 2026
Merged

Support gh CLI /meta probe in DIFC proxy#5924
lpcox merged 2 commits into
mainfrom
copilot/add-meta-endpoint-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

gh initializes by calling GET /meta (via GH_HOST as /api/v3/meta). The proxy treated /meta as an unknown REST route and returned 403, which broke workflows running gh commands in pre-agent steps.

  • Request handling

    • Added an explicit fast-path in proxyHandler.ServeHTTP for GET /meta.
    • Requests are forwarded upstream unchanged (after existing GH_HOST prefix stripping), instead of entering REST route matching and being fail-closed.
  • Behavioral coverage

    • Added a focused handler test for /api/v3/meta to assert passthrough behavior and upstream path normalization to /meta.
// gh CLI probes /meta during initialization for feature detection.
if r.Method == http.MethodGet && rawPath == "/meta" {
    h.passthrough(w, r, fullPath)
    return
}

Copilot AI linked an issue May 18, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add /meta endpoint support to gh CLI proxy Support gh CLI /meta probe in DIFC proxy May 18, 2026
Copilot finished work on behalf of lpcox May 18, 2026 02:51
Copilot AI requested a review from lpcox May 18, 2026 02:51
@lpcox lpcox marked this pull request as ready for review May 18, 2026 03:17
Copilot AI review requested due to automatic review settings May 18, 2026 03:17
Copy link
Copy Markdown
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

Adds a /meta passthrough path in the DIFC proxy so gh CLI startup probes are forwarded to GitHub instead of being blocked as unknown REST reads.

Changes:

  • Handles GET /meta after /api/v3 prefix normalization.
  • Adds a handler test covering /api/v3/meta passthrough and upstream path normalization.
Show a summary per file
File Description
internal/proxy/handler.go Adds the /meta fast-path passthrough before DIFC REST route matching.
internal/proxy/handler_test.go Verifies GET /api/v3/meta reaches upstream as /meta and returns the upstream response.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

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.

Add /meta endpoint support to gh CLI proxy

3 participants