Skip to content

fix: regenerate PR title and body when updating existing pull request#1520

Closed
zerone0x wants to merge 1 commit intopingdotgg:mainfrom
zerone0x:fix/reset-pr-title-state
Closed

fix: regenerate PR title and body when updating existing pull request#1520
zerone0x wants to merge 1 commit intopingdotgg:mainfrom
zerone0x:fix/reset-pr-title-state

Conversation

@zerone0x
Copy link
Copy Markdown

@zerone0x zerone0x commented Mar 29, 2026

Summary

  • When a branch already has an open PR, the runPrStep in GitManager now regenerates the PR title and body from the current diffs instead of returning the stale original title
  • Added editPullRequest method to GitHubCliShape service (using gh pr edit) to update existing PRs
  • The existing PR's title and body are updated via the new editPullRequest call before returning

Root cause

In runPrStep, when findOpenPr found an existing open PR for the current branch, the code returned early with status: "opened_existing" and the original PR title — without regenerating content from the latest diffs. This meant subsequent pushes to the same branch never refreshed the PR metadata.

Changes

  • apps/server/src/git/Services/GitHubCli.ts — Added editPullRequest to the service interface
  • apps/server/src/git/Layers/GitHubCli.ts — Implemented editPullRequest using gh pr edit
  • apps/server/src/git/Layers/GitManager.ts — Restructured runPrStep to always generate fresh PR content from current diffs, and call editPullRequest when an open PR already exists

Test plan

  • Create a branch, make changes, commit+push+PR — verify PR is created with correct title/body
  • Push additional commits to the same branch, run commit+push+PR again — verify the existing PR's title and body are updated to reflect the new diffs
  • Verify that creating a PR on a fresh branch (no existing PR) still works as before

Fixes #1487

🤖 Generated with Claude Code


Note

Medium Risk
Changes PR orchestration to edit existing GitHub PRs via gh pr edit, which affects a user-facing workflow and depends on external CLI behavior and temp-file handling.

Overview
runPrStep now always regenerates pull request title/body from the current commit/diff range, even when an open PR already exists for the branch.

When an existing open PR is found, it updates that PR in-place via a new GitHubCli.editPullRequest (implemented with gh pr edit --title/--body-file) instead of returning the stale original title, while still cleaning up the generated temp body file in both edit and create paths.

Written by Cursor Bugbot for commit c62c862. This will update automatically on new commits. Configure here.

Note

Regenerate and update PR title and body when an existing pull request is found

Previously, runPrStep returned early with the existing PR's title and body unchanged when a matching open PR was found. Now it generates new PR content and calls gh pr edit to update the existing PR's title and body.

  • Adds editPullRequest to GitHubCliShape and implements it in makeGitHubCli using gh pr edit <number> --title --body-file.
  • Reorders makeGitManager.runPrStep to resolve the base branch before searching for an existing PR, so that path is no longer skipped.
  • Behavioral Change: existing PRs now have their title and body overwritten on every run of runPrStep.

Macroscope summarized c62c862.

When a user pushes new commits to a branch that already has an open PR,
the PR title and body are now regenerated from the current diffs and
the existing PR is updated via `gh pr edit`. Previously the stale
title/body from the original PR creation was returned unchanged.

Fixes pingdotgg#1487

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7171f805-649d-4a86-bf45-f712f53dc6d1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 29, 2026
@zerone0x
Copy link
Copy Markdown
Author

Closing duplicate — already addressed in #1519.

@zerone0x zerone0x closed this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Generated PR title keeps being reused on new PRs

1 participant