Update_pr rejects valid PR with "PR URL must belong to the current repository"

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The ManagePullRequest tool fails to update an existing pull request when the GitHub organization/owner name differs only by letter casing between contexts.

In my repo, the git remote is configured as company-name (lowercase):

origin https://github.com/company-name/company.git
However, when the agent creates a PR with the create_pr action, the tool returns a PR URL using a different casing for the owner:

PR URL: https://github.com/Company-Name/company/pull/712
(Company-Name vs company-name).

GitHub owner/repo names are case-insensitive, so both URLs resolve to the same repository. But when the agent subsequently calls update_pr, the tool rejects the request with:

Error managing PR: PR URL must belong to the current repository

This happens both when the agent passes the pr_url returned by create_pr and when it passes only branch_name (which should resolve the PR internally without it supplying any URL). So the failing comparison appears to be an internal, case-sensitive string match between the PR’s owner/repo and the remote’s owner/repo — not something the caller can work around.

Impact: Once a PR is created, it cannot be updated (e.g., to add screenshots, edit the description, or change the base branch) for any repository whose remote URL casing doesn’t byte-for-byte match the casing GitHub/the API returns in the canonical PR URL. The PR itself is fine and viewable on GitHub; only the tool’s update path is blocked.

Steps to Reproduce

  1. Use a repository whose git remote owner casing differs from GitHub’s canonical casing. For example, set the remote to a lowercased owner while the GitHub org is mixed-case:
    git remote set-url origin https://github.com/Company-Name/company.git
    (canonical owner on GitHub: Company-Name)
  2. Commit and push a branch.
  3. Call ManagePullRequest with action: create_pr (providing title, body, branch_name, base_branch). Note the returned PR URL uses the canonical casing, e.g. https://github.com/Company-Name/company/pull/.
  4. Call ManagePullRequest with action: update_pr, passing the pr_url from step 3 (and a new body).
  • Actual: Error managing PR: PR URL must belong to the current repository
  • Expected: the PR is updated.
  1. Retry update_pr passing only branch_name (no pr_url).
  • Actual: same error.
  • Expected: the PR is updated.

Expected Behavior

update_pr should treat owner/repo comparisons as case-insensitive (matching GitHub’s own semantics), so a PR created via create_pr in the same session can always be updated — whether referenced by pr_url or by branch_name.

Operating System

Linux

Version Information

Cursor Cloud Agent

For AI issues: which model did you use?

Opus 4.8

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hi @TomO Thanks for reporting this! I tried to reproduce it but I was unable to. Could you please share the URL of the cloud agent that triggered this error, and I can take a closer look?

Thank you @kevinn . Here’s the link: https://cursor.com/agents/bc-a3c99db3-cea9-4e25-a962-d5ab3bd64190