Automations with "PR opened" trigger fail on GitLab self-hosted MRs opened from a fork ("The starting branch or commit does not exist")

Where does the bug appear (feature/product)?

Cloud Agent (GitHub, Slack, Web, Linear)

Describe the Bug

When a Cursor Automation is configured with a “PR opened” trigger on a self-hosted GitLab repository, runs triggered by Merge Requests opened from a personal fork consistently fail at startup with:

The starting branch or commit "<source-branch>" does not exist in <gitlab-host>/<org>/<repo>. It may have been deleted after its pull request merged. Choose an existing branch and try again.

The source branch has not been deleted and the MR is still open — it simply resides in the contributor’s fork repository (source_project_id != target_project_id), not in the upstream target repository.

In contrast:

  • MRs opened from a branch inside the same upstream repository trigger the exact same automation and succeed every time.
  • Cursor Bugbot runs and succeeds on the exact same forked GitLab MR, so the GitLab integration and webhook delivery are working properly.

Steps to Reproduce

  1. Connect a self-hosted GitLab instance to Cursor.
  2. Create a Cursor Automation triggered on “PR opened” for an upstream repository (<org>/<repo>) by “Anyone”, with “Comment on Merge Request” enabled.
  3. Open a Merge Request from a personal fork (<user>/<repo>, branch <source-branch>) targeting <org>/<repo>:main.
  4. Observe the Automation triggers a run, but the Cloud Agent fails because it tries to look up <source-branch> on the upstream repository <org>/<repo>.

Expected Behavior

The Automation Cloud Agent should check out forked GitLab MRs properly — for example by fetching GitLab’s merge request ref (refs/merge-requests/<iid>/head) on the target repository, or fetching from the MR’s source fork repository — instead of looking up <source-branch> on the upstream repository.

Operating System

Other

Version Information

Cursor Automations (Web) with GitLab Self-Hosted (15.5.2-ee). Not IDE/CLI specific.

For AI issues: which model did you use?

N/A (fails during Cloud Agent branch checkout before model execution)

For AI issues: add Request ID with privacy disabled

Automation ID: 8ce6d842-a2ce-11f1-b532-320a589b8025
Failed Cloud Agent Run ID: bc-81d60c56-3e42-4924-8692-4dbd01401b09

Additional Information

This looks very similar to the GitLab fork MR issue previously fixed for Bugbot (Bugbot some times couldn't run on my GitLab Self-Hosted). Bugbot now handles these forked GitLab MRs fine, while Automations / Cloud Agent checkout still assumes the source branch exists on the target repository.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi @ray233, the failure isn’t from your GitLab setup. Automations don’t run pull request triggers on merge requests opened from a fork: the agent would be running the fork’s code with the upstream repo’s access, so those runs are refused. It’s covered in the note at the end of Source control triggers.

The message you got is misleading, though. It should tell you fork merge requests aren’t supported instead of suggesting the branch was deleted. I’ve passed that to the team, along with your request to support fork MRs through the merge request ref.

For now, pushing the branch to the upstream repo and opening the MR from there lets the automation run. Bugbot handles fork MRs separately, which is why it still works on the same MR.