Registry Mirror
Skip to content

pull_request_create errors and skips linking when the GitHub repo was renamed and the remote still uses the old name #45925

Done

Description

@santissimoo

What happened

My agents call pull_request_create on a private GitHub repo that was renamed recently. The local checkouts still have origin pointing at the old name, which GitHub redirects. The PR opens fine, but the tool comes back as an error:

The host accepted the PR but does not list it yet. Find it with pull_request_list.

The PR isn't linked to the thread either. Both agents found the PR with gh pr list 2 to 3 seconds later and had to call link_pull_request themselves, which returned "alreadyLinked":false. So it isn't a listing delay. The PR was there the whole time.

It happened on both pull_request_create calls against that repo yesterday, 2 of 2. The 46 calls I have from the week before on other repos all returned the PR normally.

Diagnosis

I read this in source on main at 66cc44d. I haven't stepped through it live.

  • resolveBranchHeadContext in apps/server/src/git/GitManager.ts (around line 2104) takes headRepositoryNameWithOwner from the remote URL, so it's the old name.
  • After createChangeRequest, pushAndOpenPullRequest looks the PR up again with findOpenPr (around line 2933). GitHub lists it with the repo's current name as the head repository.
  • matchesBranchHeadContext (line 491) compares the two names after lowercasing and drops the PR because old name ≠ new name. findOpenPr returns null and the result comes back with no url.
  • The handler in apps/server/src/mcp/toolkits/pullRequests/handlers.ts (line 1234) turns a missing url into the error above and returns before linkToThread.
  • The same comparison runs in the findOpenPr call before create. So I'd expect a retry to try to open a second PR rather than find this one. I haven't tested that.

That code path is the same on the 0.1.13 nightly tag I was on, the 0.1.14 nightly I'm on now and main.

Steps to reproduce

  1. Rename a GitHub repo and keep a local clone whose origin still uses the old URL. GitHub redirects it, so push and gh keep working.
  2. Push a branch and call pull_request_create from a thread on that clone (both of mine had draft: true and base: "main").
  3. The tool returns the "does not list it yet" error and the thread has no linked PR.
  4. gh pr list --head <branch> shows the PR right away.

I haven't run this on a throwaway repo. The steps come from two real sessions plus the source reading above.

Version

0.1.13-nightly.20261125.5258 (from the T3 Code MCP server info on both failing tool results). I've since updated to 0.1.14-nightly.20261129.5452, which has the same code on this path.

Environment

macOS 27.2.1 arm64, T3 Code Nightly desktop app, Claude Code agents, GitHub through gh

Evidence

# session 1, 2026-11-29 UTC
20:11:11 pull_request_create  {"draft":true,"base":"main",...}
20:11:15 tool result (is_error: true)  The host accepted the PR but does not list it yet. Find it with pull_request_list.
20:11:18 gh pr list --head <branch>  [{"number":169,"isDraft":true,"state":"OPEN",...}]
20:11:22 link_pull_request  {"host":"github.com","repository":"<owner>/<new-name>","number":169,"alreadyLinked":false,...}

# session 2, 2026-11-29 UTC
20:26:52 pull_request_create  {"draft":true,"base":"main",...}
20:26:56 tool result (is_error: true)  The host accepted the PR but does not list it yet. Find it with pull_request_list.
20:26:58 gh pr list --head <branch>  [{"number":170,"isDraft":true,...}]
20:27:00 link_pull_request  {"host":"github.com","repository":"<owner>/<new-name>","number":170,"alreadyLinked":false,...}

# both checkouts
git remote -v   origin  https://github.com/<owner>/<old-name>
gh api repos/<owner>/<old-name> --jq .full_name   <owner>/<new-name>

Related issues

I didn't find an existing issue. #32629 fixed renamed repos for Forgejo pull request links, which looks like the same idea on a different path. #26751 added pull_request_create and this error message.

Fix applied or workaround

Nothing was changed on the machine. Pointing origin at the new URL (git remote set-url origin https://github.com/<owner>/<new-name>) should avoid it, but I haven't tried that yet. For now the agents find the PR with gh pr list and link it with link_pull_request.

Activity

  1. added
    via-triage
    on Nov 30, 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

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions