Detect when a PR is merged and open a new PR instead of pushing to it
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Description
When a PR has already been merged, PostHog Code keeps pushing new commits to that same now-dead branch instead of recognizing the work is done. Once a branch's PR is merged, further changes should start from a fresh main and go into a new PR, not pile onto the merged branch.
The app already knows the merged state. The indicator in the top right corner shows "merged", so the signal exists in the UI. The agent just does not act on it today. Getting this right would be a real advantage, since Claude Code frequently mishandles this exact case.
Proposed solution
When the agent detects that the current branch's PR is merged (the same signal that drives the top-right merged indicator), it should stop pushing to that branch. Instead it should pull fresh main, create a new branch off it, and open a new PR for any subsequent work.
Related (not a duplicate): PostHog/code#1090 covers the behind-main case, a different branch state.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the code that drives the top-right "merged" indicator, then follow the agent's current-branch PR and push handling. Update the merged-PR path so subsequent work starts from fresh main on a new branch and PR; verify that ordinary unmerged PR workflows remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github, python
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100