Repository navigation
ci shepherd: update a green PR's branch when it is behind main (#4790) - #4842
Merged
Merged
Conversation
A PR whose mergeable_state is `behind` was never merged: pr_check treats behind as not mergeable, so the shepherd waited forever (seen on the bot PR #4831). When a PR is behind with no failed and no pending checks, the shepherd now runs `gh pr update-branch` once per head SHA. The push restarts its checks, and a later pass merges it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TBJdDBRtJis5hzE244NQKV
Contributor
squid-protocol
marked this pull request as ready for review
October 10, 2026 13:17
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #4790.
A PR whose `mergeable_state` is `behind` never merged: `pr_check` treats behind as not mergeable, so the shepherd waited forever (seen on the bot PR #4831).
Change: in `step()`, when a PR is behind with no failed and no pending checks, run `gh pr update-branch N` once per head SHA (`once()` key `update-branch`) and log it. The push restarts the checks, and a later pass merges it. A failed check or a pending check does not trigger the update.
Tests (fake gh): behind+green gives one update-branch call; a second pass on the same head gives none; pending gives none; behind with a failed check gives none.
Gates: `pr_gates.py --fast` 5/5 pass; ruff audit and mypy audit show no new findings; `test_ci_shepherd.py` + `test_ci_digest.py` 23 passed.
Not queued with the shepherd (orchestrator reviews and queues).
🤖 Generated with Claude Code
https://claude.ai/code/session_01TBJdDBRtJis5hzE244NQKV