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
- Open a thread in a GitHub or GitHub Enterprise Server project whose
repositoryIdentity.provider is already resolved to "github" (for example, https://gh.example.internal/org/repo.git authenticated via gh, or any github.com/org/repo project).
- Invoke any MCP tool that goes through
resolveTarget with a repository value that is not strictly owner/repo — for example, a host-prefixed gh --repo-style selector or a single-segment name:
pull_request_respond({ number: 123, repository: "gh.example.internal/org/repo", body: "test" })
- or
link_pull_request({ repository: "github.com/org/repo", number: 123 })
Expected behavior
resolveTarget distinguishes between:
- an unknown forge host (
kind === null or kind === "unknown"), and
- a known forge whose
changeRequestUrl rejected the repository value.
For a known GitHub host, it should either return a clear validation error stating that repository must be in owner/repo format (without the hostname), or normalize a matching <host>/owner/repo prefix.
Actual behavior
The call fails with PullRequestUrlUnavailableError:
This thread's project is on a host with no known pull request URL shape. Pass url.
This happens even though the project's host is recognized as "github". The misleading message causes both agents and users to think host/GHES detection failed, rather than realizing repository had an unexpected format (3 segments instead of 2).
Cause
In apps/server/src/pullRequest/pullRequestTarget.ts (resolveTarget, lines 104–118), url === null is treated unconditionally as an unknown host URL shape:
const url =
kind === null
? null
: sourceControlDefinitions.get(kind).changeRequestUrl({
host,
repository,
number: input.number,
remoteUrl: project?.repositoryIdentity?.locator.remoteUrl,
});
if (url === null) {
return yield* new PullRequestUrlUnavailableError({});
}
In packages/source-control-github/src/shared/definition.ts (lines 40–48 and 88–97), changeRequestUrl returns null whenever isRepositoryPath(repository) is false (i.e., repository.split("/").length !== 2 or invalid characters). Because resolveTarget does not check kind === null || kind === "unknown" separately from definition.changeRequestUrl(...) === null, a malformed repository string on a recognized GitHub/GHES project surfaces as PullRequestUrlUnavailableError.
Impact
Minor bug or occasional failure
Version or commit
Reproduced on v0.1.11; confirmed identical on main @ d63b9c4c76.
Environment
Linux, T3 Code v0.1.11 (Desktop / Web), Codex (gpt-6.2-sol), GitHub Enterprise Server authenticated via gh.
Logs or stack traces
Tool call:
t3-code.pull_request_respond({
"number": 123,
"repository": "gh.example.internal/org/repo",
"body": "..."
})
Tool output:
This thread's project is on a host with no known pull request URL shape. Pass url.
Workaround
Pass repository as owner/repo without the host prefix (e.g., "org/repo"), or omit repository on thread-scoped PR tools so it defaults to the project's repository.
Analyzed and drafted with Gemini 4 Neon (Antigravity).