Repository navigation
fix(server): pull request tools say when repository is not owner/repo - #41397
juliusmarminge merged 4 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceCreate a synthetic GitHub project and replay-agent thread on fresh isolated server state. Call
Both calls returned Not shown:
|
main fixed the same bug in #41397; take main's resolveTarget and test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d of stripping the host #41397 on main rejects host-prefixed repositories with a clear error, so the host stripping and its test are dropped; the schema descriptions stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
On a GitHub project,
link_pull_request({ repository: "github.com/org/repo", number: 1 })fails withPullRequestUrlUnavailableError: "This thread's project is on a host with no known pull request URL shape. Pass url." The host is known. The real problem is the repository value: GitHub'schangeRequestUrlreturns null whenrepositoryis not a strictowner/repo(isRepositoryPathinpackages/source-control-github/src/shared/definition.ts), andresolveTargetreads every null URL as an unknown host. The agent is told to fix the wrong thing.Change
resolveTargetinapps/server/src/pullRequest/pullRequestTarget.tsnow looks at which definition produced the null URL. With no provider kind, or theunknowndefinition, it still returnsPullRequestUrlUnavailableError. With a known forge, it returns a newPullRequestRepositoryInvalidError: "Pass repository as owner/repo, without the host. Or pass url, or leave out repository."The new error follows the existing target errors (empty tagged error with a
messagegetter), joinsPullRequestTargetError, and is registered in the import and thePullRequestToolErrorunion inapps/server/src/mcp/toolkits/pullRequests/tools.ts. No client or contracts schema lists these errors.Scope
Fixes #41385
Only the error chosen when a known forge cannot build the URL changes. Valid input resolves exactly as before, and an unknown host still gets the old error.
Verification
Added one case to
apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts, next to the unknown host case. It callslink_pull_requeston the default GitHub project withrepository: "github.com/org/repo"and checks the error tag, that the message mentionsowner/repo, and that no link command was dispatched.Without the fix (test commit only):
With the fix:
vp test run src/mcp/toolkits/pullRequests/handlers.test.ts src/pullRequestalso passes (9 files, 213 tests).vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all pass.Not verified: I did not run the
evals/cases for model-facing text or try the tool from a live agent session; the change is covered by the handler test only.Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.