Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: PR and CI MCP tools do not document the expected repository format and reject host-prefixed HOST/OWNER/REPO selectors #41396

Closedzbynekwinkler(GitHub profile, opens in a new tab) opened this issue 1 comment

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. Open a thread in a GitHub Enterprise Server project (e.g., https://gh.example.internal/org/repo.git, authenticated via gh) where the agent is asked to comment on or inspect a PR by number.
  2. Observe the MCP tool schema exposed to the agent for pull_request_respond (or pull_request_read, pull_request_update, pull_request_review, pull_request_merge, ci_logs, ci_rerun):
    • number has description "Default: the branch's PR."
    • repository has no description at all.
  3. The agent calls the tool using gh --repo-style [HOST/]OWNER/REPO syntax:
    {
      "number": 123,
      "repository": "gh.example.internal/org/repo",
      "body": "..."
    }

Expected behavior

  1. ThreadPullRequestInput.repository (and PullRequestTargetInput.repository) should clearly document its default and expected format (e.g., "Default: this thread's repository. owner/repo without host." or forge-appropriate path without host).
  2. On a matching host (or when repository starts with <host>/), resolveTarget should either strip the redundant <host>/ prefix (matching parseGitHubRepositorySelector in packages/source-control-github/src/server/gitHubRepositoryResolution.ts) or validate it with a clear format error (tracked separately in #41385).

Actual behavior

Because repository has no schema description explaining that it defaults to the project's repository and must omit the hostname, agents working on GitHub Enterprise Server routinely supply HOST/OWNER/REPO (the format gh --repo uses and the shape of canonicalKey / PR URLs). resolveTarget passes that 3-segment string straight to GitHub.definition.changeRequestUrl, which rejects it (isRepositoryPath requires 2 segments) and causes the tool call to fail (see also #41385 and #41394), forcing the agent to fall back to gh CLI commands.

Cause

  • In apps/server/src/mcp/toolkits/pullRequests/tools.ts (lines 498–503), ThreadPullRequestInput.repository has no .annotate({ description: ... }):
    export const ThreadPullRequestInput = Schema.Struct({
      environmentId: OrchestratorMcpEnvironmentTarget,
      number: Schema.optional(PositiveInt.annotate({ description: "Default: the branch's PR." })),
      repository: Schema.optional(TrimmedNonEmptyString),
    });
    (PullRequestTargetInput.repository at lines 69–72 also only says "With \number`, when no `url`."` without specifying the format.)
  • In apps/server/src/pullRequest/pullRequestTarget.ts (lines 95–115), resolveTarget lowercases input.repository verbatim without stripping a leading ${host}/ prefix, even though parseGitHubRepositorySelector in packages/source-control-github/src/server/gitHubRepositoryResolution.ts (lines 106–130) already supports 3-segment HOST/OWNER/REPO selectors.

(Note: updating MCP tool schema descriptions touches model-facing text covered by evals/.)

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

Omit repository when targeting a PR in the thread's own project, or pass "owner/repo" without the host prefix.


Analyzed and drafted with Gemini 4 Neon (Antigravity).

  1. tanstack-source added labelsbug

  2. #41397, now on main: Host-prefixed repository selectors on known GitHub and GitHub Enterprise projects now receive the clear repository-format validation error allowed by the report's second requested behavior.

    Not done: The repository fields still lack the requested schema descriptions explaining their expected format and defaults.

    Closing; open a new issue if what is left still matters to you.

  3. juliusmarminge closed this

Sign in to join this conversation.