Cloud Agent API is not pushing to the right branch

Where does the bug appear (feature/product)?

Somewhere else…

Describe the Bug

When using the Cursor Cloud Agent API, the agent creates its own branch when we specify the branch that the agent must push in the payload. It is not doing this always but, but even if this happens, it will break our system. Instead of pushing to draft it is commmitting to /tree/cursor/ubicaci-n-madrid-espa-a-a107

Steps to Reproduce

Use /launch_agent endpoint with this parameters:
[CursorAgent] Request body: {

“prompt”: {

"text": "# SYSTEM INSTRUCTIONS\n## Role\nYou are a code generation agent for \"Project 1 \" (nextjs).\n\n## Language + Scope\n- Use the user’s language for ALL user-facing text.\n- Change ONLY what the user asked to change.\n\n## Rules\n- Branch you MUST commit/push is 'draft'. Do not create your own branches.\n- No Payload CMS imports.\n- No hardcoded English (match user language).\n- No duplicate data-cm-id.\n- No placeholder/example external image URLs.\n\n---\n\n---\n\n## USER REQUEST\n\ncambia \"Madrid, Comunidad de Madrid\" a \"Madrid, Comunidad de Madrid, espana\""

},

“source”: {

"repository": "my_repo",

"ref": "main"

},

“target”: {

"branchName": "draft",

"autoCreatePr": false

},

“model”: “composer-1.5”

}

Expected Behavior

The edited code from the agent must be committed to the draft branch

Operating System

MacOS

Version Information

Cursor Cloud Agent API

For AI issues: which model did you use?

composer-1.5, but the same for other models in the list.

For AI issues: add Request ID with privacy disabled

ID: bc-1713e862-3f5f-42cc-8f0b-822dfeb12cfa

Does this stop you from using Cursor

No - Cursor works, but with this issue

1 Like

Hey, thanks for the report. The payload looks correct based on the docs. With autoBranch: true by default, branchName: "draft" should create a branch with that exact name.

Another user reported a similar issue just yesterday: Issue with autoBranch parameter and autoCreatePr functionality. Their branchName is being ignored too.

Let me know if you spot any pattern, like whether it depends on the branch name length or format, or on a specific model.

Hello @deanrie ,

Could having already a branch called draft be an issue for the agent because the **target.branch** is seeing there is already a branch “draft“ and creating its own branch. (which used to be working, now not)

That’s a reasonable hypothesis, but based on other users’ reports, the issue happens regardless of whether the branch exists or not. In the related thread, even brand new branch names are ignored, and the API generates its own branch name instead of using the provided branchName.

I’ll update this thread when there’s any news.

1 Like

Makes sense, thank you!

I think some issue with latest release may be. facing same issue from last couple of days

Hi Cursor Team,
I’m still facing the same problem, when launching the agent with particular custom branch but It is not pushing in the right branch rather it’s creating new branch. Please fix this up asap..

1 Like

I’m using the below snippet

curl --request POST \

  --url https://api.cursor.com/v0/agents \

-u KEY: \

--header 'Content-Type: application/json' \

--data '{

"prompt": {

"text": "Is README.md file exist, add the current version in the this file"

  },

"source": {

"repository": "https://github.com/xx/xx",

"ref": "main"

  },

"target": {

"autoBranch": false,

"branchName": "auto/readme"

  }

}'

Hey everyone,

I found a workaround that would kind of solve this issue. If you are trying to specify the branch for the agent to work on, and still not functioning. When the agent finishes working, it returns the information about the branch it works on. Such as sha id of the commit, so you know what the agent has committed. You can just copy the last commit to your target branch manually within your code. Not as convenient as Cursor pushing automatically, however will work until the team fixes the bug.

Hope this helps :pinched_fingers: