Skip to content

shepherd: keep merge approval across a clean merge from main - #4979

Merged
squid-protocol merged 2 commits into
mainfrom
fix/shepherd-keep-approval-clean-merge
Oct 12, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/shepherd-keep-approval-clean-merge

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Problem

The merge shepherd dropped shepherd:merge and set shepherd:reapprove on ANY new PR head, including a plain no-conflict merge of main into the PR branch. On 2026-10-12 PRs #4948 and #4966 were approved, someone merged main in to update them, and they then waited overnight for a re-review nothing performs.

Change

gather() already knows the approved head (newest trusted shepherd:approved sha= marker). When the head moved and was not the bot's own update-branch, the new clean_main_merge() (GitHub API only: commit parents + compare endpoints) keeps the approval if:

  • the head has exactly two parents: the approved head and a commit already on the base branch (compare base...parent is behind/identical);
  • what the merge changed on the approved head equals what main changed since the merge base, file by file and blob by blob (so nothing extra, and no conflict resolution that dropped main's change);
  • the PR's own changed files do not overlap main's changed files (no three-way merges to judge, conservatively).

The head is then treated like the bot's own carried update: label kept, a fresh approval marker is written for the new sha. Any other head, an unreadable compare, or 300+ files falls back to reapprove as before.

Tests

tests/tools/test_shepherd_gh.py: clean merge keeps approval; merge with extra changes, overlapping files, off-main parent, unreadable compare, and an ordinary new commit all go to reapprove. pr_gates --fast passes 5/5.

Note: pr_gates --ratchets shows ports failing on the carddemo equivalence cases locally (unrelated files; likely missing JDK env in this shell); CI runs the full suite.

🤖 Generated with Claude Code

A new PR head dropped shepherd:merge and set shepherd:reapprove even when
it was only a plain merge of main into the approved head. Such a head is
now carried over (approval marker written for it) when its parents are the
approved head and a commit already on main, the merge changed exactly what
main changed since the merge base, and the PR's own files do not overlap
main's. Anything else, or any unreadable compare, still goes to reapprove.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 12, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 12, 2026 15:09
@squid-protocol
squid-protocol enabled auto-merge (squash) October 12, 2026 15:09
@squid-protocol
squid-protocol merged commit 441b17e into main Oct 12, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the fix/shepherd-keep-approval-clean-merge branch October 12, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant