Skip to content

fix(mcp): accept GitHub Enterprise Cloud pull request URLs - #23521

Open
vkpdeveloper wants to merge 2 commits into
pingdotgg:mainfrom
vkpdeveloper:fix/accept-ghe-pull-request-urls
Open

vkpdeveloper wants to merge 2 commits into
pingdotgg:mainfrom
vkpdeveloper:fix/accept-ghe-pull-request-urls

Conversation

@vkpdeveloper

Copy link
Copy Markdown

Problem

link_pull_request (and unlink/watch/unwatch) reject GitHub Enterprise Cloud URLs such as https://acme.ghe.com/owner/repo/pull/9. changeRequestUrl.ts has its own GitHub host check that misses *.ghe.com, although sourceControl.ts already recognises it. The error message also doesn't mention the host field.

Change

  • Export the existing GitHub host check from sourceControl.ts and use it in changeRequestUrl.ts for PR URLs and autolinks.
  • The invalid-URL message now gives a GHE example and says to pass host, repository and number when a URL isn't recognised.
  • Arbitrary custom hosts still need the explicit fields, since a /pull/ path alone doesn't prove the host is GitHub.

Scope and approval

Fixes #16070 (triaged bug).

Verification

  • New tests in changeRequestUrl.test.ts and handlers.test.ts: all 7 fail without the fix (parse returns null, every tool raises PullRequestUrlInvalidError) and pass with the fix.
  • vp run check:changed passes. 101 tests pass across the related shared and MCP test files.
  • Not checked: a real Enterprise PR; no Enterprise host was available.

Code by gpt-6.1-sol (xhigh) in Codex CLI. PR description written with Claude Code (Opus 5.5).

🤖 Generated with Claude Code

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 22, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c4c789d

Macroscope's review found this PR approvable — This focused bug fix reuses the existing GitHub host classification to accept GitHub Enterprise Cloud pull-request URLs in established parsing and MCP flows. It preserves rejection of unrelated hosts and adds targeted coverage, with no product-default, schema, deployment, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c4c789d and 4696359.

Files selected for processing: 3
  • apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
  • apps/server/src/mcp/toolkits/pullRequests/tools.ts
  • packages/source-control-github/src/shared/definition.test.ts
Files skipped from review as they are similar to previous changes: 1
  • apps/server/src/mcp/toolkits/pullRequests/tools.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Walkthrough

The changes add test coverage for GitHub Enterprise Cloud pull-request URLs and MCP pull-request commands. The invalid-URL error guidance now asks callers to provide host, repository, and number.

Changes: GitHub Enterprise pull-request URL coverage

Layer / File(s) Summary
GitHub Enterprise URL parsing tests
packages/source-control-github/src/shared/definition.test.ts
Tests cover lowercase and uppercase ghe.com hosts, host and repository normalization, and reference-autolink conversion.
MCP handler tests and URL guidance
apps/server/src/mcp/toolkits/pullRequests/tools.ts, apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
The invalid-URL message names host, repository, and number. Handler tests cover link, unlink, watch, and unwatch with a ghe.com URL, and verify that an FTP URL records no command.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: Minimal · up to 46963

The change adds Enterprise URL coverage and clearer error guidance. No merge-blocking risk was identified.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: accepting GitHub Enterprise Cloud pull request URLs in MCP.
Description check Passed The description includes all required sections, explains the problem and change, links the triaged issue, and reports focused verification results and limitations.
Linked Issues check Passed Issue #16070 requires Enterprise-hosted pull-request URL support and a fallback that names host, repository, and number. At the reviewed head, the GitHub provider parses pull-request paths on En…
Out of Scope Changes check Passed The changes stay within issue #16070. The diff adds Enterprise URL regression tests for the affected handlers and GitHub provider, and updates the invalid-URL guidance. These changes directly support …
Full details: Linked Issues check

Explanation

Issue #16070 requires Enterprise-hosted pull-request URL support and a fallback that names host, repository, and number. At the reviewed head, the GitHub provider parses pull-request paths on Enterprise hosts and converts Enterprise issue autolinks. The added handler tests cover link, unlink, watch, and unwatch with *.ghe.com URLs. PullRequestUrlInvalidError now names all three explicit fields. No coding requirement remains unmet.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #16070. The diff adds Enterprise URL regression tests for the affected handlers and GitHub provider, and updates the invalid-URL guidance. These changes directly support Enterprise pull-request URL handling and do not add unrelated behavior.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@maria-rcks

maria-rcks commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

Verified the current production change at 46963590c0e91594153d713f9b12fa34b1db31b0 on Linux with repo Playwright, /usr/bin/google-chrome, and real Codex gpt-6.1-sol turns submitted through the web composer. Created the project and thread through the app with no mocks, fixtures, replay, or seeded database. Ran one background dev server at a time.

On github/main (b50d8a1b15), calling link_pull_request with ftp://code.acme.test/owner/repo/pull/9 returned "Pass repository and number instead." On the exact PR head, the same client/provider path returned "Pass host, repository and number instead."

Nearby behavior passed through real MCP calls: the GitHub URL for this PR linked and displayed its title/number in the app; watch returned watching: true; unwatch returned watching: false; unlink returned wasLinked: true; explicit host, repository, and number linked the git.cafe URL. Final cleanup returned empty pullRequests and chains lists. No external PR state was changed.

Blacksmith vp run check:changed 6328c8472255e9b93bd362af63ae0d3c17e2d540 passed: format, lint, knip, GraphQL, 11 affected package typechecks, and 39 tests. No code changes or pushes were needed. Current GitHub checks have no failures; several deployment/platform workflows are skipped.

main: invalid URL error omits host

PR: same invalid URL error includes host

real Codex turn links this PR and the app displays it

Runtime command transcript

Not verified

Authenticated GitHub Enterprise Cloud access, a real Enterprise PR, and external watch notifications: no Enterprise account or PR was available. Current main already contains the Enterprise URL parser; the production diff in this head only improves the invalid-URL guidance, alongside regression tests. The old Enterprise parsing failure therefore cannot be reproduced on current main. Native Electron, iOS/Android, and remote/tunnel clients were not exercised on this Linux web pass.

@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Nov 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: link_pull_request rejects a PR URL on a GitHub Enterprise host

2 participants