Skip to content

feat(github): Check for merge conflicts on pull request webhook events - #2501

Open
sentry-junior[bot] wants to merge 3 commits into
mainfrom
feat/github-heartbeat-merge-conflicts
Open

sentry-junior[bot] wants to merge 3 commits into
mainfrom
feat/github-heartbeat-merge-conflicts

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

GitHub sends no webhook when a pull request gets a conflict, and a conflicted pull request gets no new checks. So when the base branch moves under a Junior PR, nothing tells its maintenance watch. #2374 stayed conflicted until a person noticed.

This adds a pull_request.merge_conflict event. The GitHub webhook checks for it on other pull request events:

  • When a webhook delivers a comment, review, review comment, check result, or other event for an open PR, and a watch or event automation wants conflicts for that PR, the plugin reads the PR with a read-only installation token.
  • If GitHub reports a conflict (mergeable: false and mergeable_state: "dirty"), the plugin publishes the event to the PR and its repository. If GitHub does not know yet, the read starts its calculation, and a later event reads it again.
  • The event key names the head commit, so each head commit reaches a watch once. After Junior merges the base branch and pushes, a new conflict gets a new key.
  • The event matches only repo and pullRequest. That way the check before the read gives the same answer as the full event, and PRs that nothing watches cost no GitHub calls.
  • The watch made after Junior creates a PR always gets this event. Its default guidance is the existing feat(github): Check PR mergeability after each push #2302 flow: merge the base branch, never rebase, keep both sides, rerun checks, push, and report the conflicted files.

A PR that gets no other events is not checked. The github-code skill still checks mergeability after each push. This settles the open question from #2303: detection now lives in packages/junior-github code, not only in skill prose.

Refs #2416

--

View Session in Sentry

GitHub sends no webhook when a pull request gets a conflict, and a
conflicted pull request gets no new checks. When the base branch moves
while a Junior pull request is idle, nothing told the maintenance watch.

The GitHub plugin heartbeat now reads mergeability for open Junior pull
requests that a watch or event automation matches, at most every five
minutes, and publishes pull_request.merge_conflict once per head commit.
Core gives plugin heartbeats the same scoped event publisher as plugin
routes. The watch made after Junior creates a pull request always gets
the new event, with guidance to merge the base branch and never rebase.

Closes #2416

Co-Authored-By: BYK <[email protected]>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 1, 2026 9:27pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

3 screenshot changes — 3 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Child Agent Drawer · Desktop
Conversation Child Agent Drawer · Desktop
Changed
Conversation Child Agent Drawer · Mobile
Conversation Child Agent Drawer · Mobile
Changed
Conversation Event Log · Mobile
Conversation Event Log · Mobile
Changed

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…uests

Each check read the same newest open pull requests and stopped after 20
matches, so idle watched pull requests past that cap were never read.
Page through open pull requests in a stable order and keep a cursor in
plugin state, so each check goes on where the last one stopped.

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a fan of this polling approach. Do you think we can subscribe to more events or make our post-event checks more robust? For instance if I comment on, or review a PR we should check the merge state. Similar to right after a push?

…ling

Drop the heartbeat sweep. When a webhook delivers a comment, review,
check result, or other event for an open pull request that a watch or
event automation wants conflicts for, read the pull request and publish
pull_request.merge_conflict when GitHub reports a conflict. The event key
names the head commit, so each head commit reaches a watch once.

This reverts the core heartbeat event publisher, which nothing uses now.
@sentry-junior sentry-junior Bot changed the title feat(github): Detect merge conflicts on idle pull requests feat(github): Check for merge conflicts on pull request webhook events Nov 1, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7eb5492. Configure here.

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 7eb54929 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant