Skip to content

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

Description

@mkielar

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

Summary

The T3 Code MCP tool link_pull_request does not accept the URL of a pull request on a
GitHub Enterprise host. It works only when the caller passes host, repository and number separately.
The harness instructions and the tool description both say to pass the URL, so an agent
following them fails on the first call every time.

Steps to reproduce

  1. Open a pull request on a GitHub Enterprise host, for example
    https://my-awesome-company.ghe.com/<owner>/<repo>/pull/9.
  2. From an agent in T3 Code, call:
    {"url": "https://my-awesome-company.ghe.com/<owner>/<repo>/pull/9"}
  3. Call it again with:
    {"host": "my-awesome-company.ghe.com", "repository": "<owner>/<repo>", "number": 9}

Expected behavior

  • A pull request URL on any GitHub host that T3 Code can reach is accepted, the same as a
    github.com URL.
  • If only github.com URLs are supported, the tool description and the
    harness instructions say so. The error then names all three fields: host, repository
    and number.

Actual behavior

  • Step 2 fails with: This is not a recognised pull request URL. Pass repository and number instead.
  • Step 3 succeeds: {"host":"my-awesome-company.ghe.com", ..., "alreadyLinked":false}.
  • The error text does not mention host, so an agent that follows it on a GHE host may still
    not link the right PR.
  • The harness instructions tell agents: "Call link_pull_request with the full PR URL immediately
    after creating a PR". On a GHE host that call always fails first. Each agent has to recover
    from the error on its own, and the PR stays unlinked if it doesn't.

Impact

Minor bug or occasional failure

Version or commit

0.0.46-nightly.20261005.2667 (37de6cb)

Environment

macOS (Darwin 27.0.0)

Logs or stack traces

N/a

Screenshots, recordings, or supporting files

No response

Workaround

The agent notices the right way after one or two failures.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 5, 2026
  2. juliusmarminge commented on Oct 5, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks for the clear repro, @mkielar. The contrast between the URL call and the host + repository + number call made this easy to pin down.

    What I found

    • On current main (781223057) and on 37de6cbde65c (0.0.46-nightly.20261005.2667), link_pull_request still runs a url through parseChangeRequestUrl in packages/shared/src/changeRequestUrl.ts. A /owner/repo/pull/N path is treated as GitHub only when the hostname is github.com, a *.github.com subdomain, or has github as a DNS label (isHostOf).
    • A host like my-awesome-company.ghe.com misses that check. *.ghe.com is GitHub Enterprise Cloud with data residency, and the hostname has no github label, so parsing returns null and the tool returns PullRequestUrlInvalidError: "This is not a recognised pull request URL. Pass repository and number instead."
    • A host that does contain github, such as github.acme.test, is already accepted. The same gap applies to any other GitHub host whose name does not contain github. Leaving /pull/ unrecognized on an arbitrary hostname looks intentional, because that path is not unique to GitHub.
    • Passing host, repository, and number skips the URL parser and builds the link directly, which is why your second call works. unlink_pull_request, watch_pull_request, and unwatch_pull_request share resolveTarget, so a *.ghe.com URL fails on those too.
    • The error text names repository and number, not host. When the thread's project remote is already that Enterprise host, repository and number are enough. On any other project, following the error can link the wrong host, or hit "This thread's project has no recognised remote. Pass host or url."
    • The runtime instructions still tell agents to call link_pull_request with the full PR URL, and the tool description's example is a github.com URL, so an agent on a *.ghe.com host fails the first call every time.
    • This is a different problem from the open GitHub Enterprise detection PRs (fix(server): detect GitHub Enterprise remotes that gh is signed in to #7959, fix(server): recognize authenticated GitHub Enterprise hosts #11059). Those cover gh auth discovery for custom remotes and do not change this URL parser.

    Likely fix area

    • Teach parseChangeRequestUrl / isHostOf to recognise *.ghe.com (and any other known GitHub Enterprise Cloud host shapes) the same way it already accepts hosts with a github DNS label.
    • Optionally improve the error text so it mentions host when URL parsing fails.
    • Optionally adjust the link_pull_request instructions / example so agents on non-github.com hosts know to pass host, repository, and number until URL parsing covers them.

    Until then, the working call is the one you already found: host, repository, and number.

    A maintainer will decide on the fix direction.

  3. added
    via-triageFiled through npx t3 triage
    and removed
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions