PostHog / PostHog/posthog

Detect when a PR is merged and open a new PR instead of pushing to it

Open
#76,220 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/desktop
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.