Skip to content

[Bug]: PR URLs on a self-hosted GitHub host with no project fail with "cannot be browsed for this project's host yet", even when gh is signed in to it #42790

Backlog

Description

@rwblokzijl

Before submitting

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

Area

apps/server

Steps to reproduce

  1. Sign gh in to a self-hosted GitHub host, ghes.example. gh auth token --hostname ghes.example works, and the host serves the GHES API (/api/v3, /api/graphql).
  2. Have no T3 project whose remote is on ghes.example (for example, only github.com projects, or a plain folder).
  3. From a thread, call watch_pull_request with https://ghes.example/owner/repo/pull/1. Opening the same PR in the panel fails the same way.

Expected behavior

T3 reads the PR through gh's credential for ghes.example, as it does once a project on that host exists. Failing that, the error says what is missing, like the message PullRequestUnavailableError already has for this case: "No project in T3 Code is on ghes.example. Add any ghes.example project to read its change requests." (#41581 did the same for issue URLs.)

Actual behavior

  • watch_pull_request with the URL: "Change requests cannot be browsed for this project's host yet." (provider-unsupported). That reads as "this host isn't supported", which isn't true.
  • With repository, number and host: ghes.example instead: "This thread's project is on a host with no known pull request URL shape. Pass url."
  • Adding any project whose remote.origin.url is on ghes.example fixes it: an empty git init with origin https://ghes.example/owner/repo.git is enough. T3 gives that project provider github (refined through gh), and after that PRs of every repository on ghes.example read and watch.

In PullRequestService's route lookup, a host with no project falls back to findByPublicHost(host) and findByRepositoryKey(...). Both only know public hosts, so the repository-without-project branch is never reached for a self-hosted one, and it ends in provider-unsupported.

Not a regression: 0.1.10 has the same code. We hit it after #41364 (fixing #41341): our repositories reach GitHub through an authenticating proxy that speaks the GHES API. Before #41364 every project was wrongly on the proxy host, which happened to make proxy PR URLs work; now they're correctly on github.com, and nothing is on the proxy host.

Suggested fix

  • For a host with no project, run the same refinement used for project remotes (refineUnknownRemote: does gh, or a saved setting, have a credential for this host?) before giving up, and read through it.
  • At least return repository-without-project with the host for an unrecognised host, so the message names the fix.

Impact

Minor bug or occasional failure

Version or commit

0.1.12

Environment

Server on Linux arm64 in a container, desktop client on macOS

Logs or stack traces

watch_pull_request(url: "https://ghes.example/owner/repo/pull/1")
→ Change requests cannot be browsed for this project's host yet.
watch_pull_request(repository: "owner/repo", number: 1, host: "ghes.example")
→ This thread's project is on a host with no known pull request URL shape. Pass url.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions