Describe the bug
Clicking Start Contribution more than once for the same issue is not idempotent. If the branch already exists, the API overwrites it and creates another draft pull request.
Steps to reproduce
Sign in to RepoSage with GitHub.
Open any GitHub issue.
Click Start Contribution.
Wait for the draft PR to be created.
Click Start Contribution again for the same issue.
Check the fork’s branch and pull requests.
Expected behavior
RepoSage should detect the existing branch or draft PR and return the existing contribution details, without modifying the branch or creating another PR.
Actual behavior
The existing branch error is ignored, a new empty commit is created, and the branch is force-updated. Another draft PR is then created for the same issue.
Environment
RepoSage: current main branch - Browser: Any modern browser OS: Windows, macOS, or Linux GitHub integration: GitHub OAuth ,Affected file: app/api/issues/start-contribution/route.ts
Describe the bug
Clicking Start Contribution more than once for the same issue is not idempotent. If the branch already exists, the API overwrites it and creates another draft pull request.
Steps to reproduce
Sign in to RepoSage with GitHub.
Open any GitHub issue.
Click Start Contribution.
Wait for the draft PR to be created.
Click Start Contribution again for the same issue.
Check the fork’s branch and pull requests.
Expected behavior
RepoSage should detect the existing branch or draft PR and return the existing contribution details, without modifying the branch or creating another PR.
Actual behavior
The existing branch error is ignored, a new empty commit is created, and the branch is force-updated. Another draft PR is then created for the same issue.
Environment
RepoSage: current main branch - Browser: Any modern browser OS: Windows, macOS, or Linux GitHub integration: GitHub OAuth ,Affected file: app/api/issues/start-contribution/route.ts