Skip to content

Conversation

@codegen-sh
Copy link
Contributor

@codegen-sh codegen-sh bot commented Apr 15, 2025

Motivation

When trying to create a PR on a branch that already has a PR, a Sentry error is generated and the agent is not shown a good error message.

Changes

  1. Modified GitRepoClient.create_pull to check if a PR already exists for the branch before attempting to create a new one
  2. Updated Codebase.create_pr to use get_or_create_pull instead of create_pull to handle the case when a PR already exists
  3. Added a test case to verify that creating a PR on a branch that already has a PR returns the existing PR

Testing

Added a new test case test_codebase_create_pr_existing_pr that verifies the behavior when trying to create a PR on a branch that already has a PR.

Fixes CG-17310


💻 View my workAbout Codegen

@codegen-sh codegen-sh bot requested review from a team and codegen-team as code owners April 15, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants