Skip to content

A stack child must not block its parent out of the merge queue - #671

Merged
krasnoperov-coding-agent[bot] merged 2 commits into
mainfrom
fix/stack-child-must-not-block-parent
Sep 14, 2026
Merged

krasnoperov-coding-agent[bot] merged 2 commits into
mainfrom
fix/stack-child-must-not-block-parent

Conversation

@krasnoperov-coding-agent

@krasnoperov-coding-agent krasnoperov-coding-agent Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

MakeFX PR #164 was approved and green but Merge Steward evicted it as policy_blocked because its stacked child, PR #165, shared the parent's unlanded history. The child could not enter the queue until the parent landed, creating a deadlock.

Fix

  • include each open PR's declared base branch in ancestry analysis
  • do not treat a PR based directly on the current PR branch as a blocker of its parent
  • preserve the reverse safety rule: a parent still blocks its child from landing first
  • on service startup, re-evaluate unchanged heads previously evicted for environmental policy_blocked conditions, allowing policy upgrades to recover them
  • keep periodic scans and webhooks from repeatedly re-admitting genuinely blocked unchanged heads

Outcome

Declared stacks retain parent-before-child ordering without a child blocking its own parent. Unrelated shared unlanded history remains blocked, and head-local failures still require a new push.

A PR whose base is another open PR's branch deadlocked both of them. The
parent was admitted, found "unlanded history" shared with its child, and was
evicted `policy_blocked`; the child was never admitted because its base is not
the base branch. Neither could move, and nothing but a force-push to one of
them would break it.

The ancestry check guards a real hazard, but only in one direction. A stack
child's candidate carries its parent's commits, which GitHub reviewed against
the parent's branch rather than against main, so landing the child would
bypass a review gate and it must wait. A parent's candidate carries only its
own commits: the history it shares with the child is the parent's own, it is
in the parent's diff, and it was reviewed there. Nothing is bypassed.

The existing guard did cover a child that is current with its parent, through
`isAncestor(parentHead, childHead)`. It misses a child that sits on an earlier
parent commit — which is the ordinary state of a stack the moment the parent
pushes again. Ancestry cannot recover the relationship at that point, so this
reads the declared base, and `listOpenPRs` now returns it. A missing base
never counts as a match, so an API that stopped returning the field would
fail closed rather than disable the check in silence.

The second half is getting back: `tryAdmit` refuses a head that matches the
latest eviction, which is right for every class that is a fact about the head
and wrong for `policy_blocked`, which is a fact about the world around it. A
head evicted on environment is offered again by the startup scan and only
there — a webhook saying one PR moved is no reason to re-litigate a policy
decision, while a restart, which is when the policy itself can have changed,
is exactly the moment to.

@review-quill review-quill 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.

Verdict: ✅ Approve — The current head preserves parent-before-child safety, excludes declared children from blocking their parent, and limits unchanged-head environmental re-admission to startup scans.

@krasnoperov-coding-agent krasnoperov-coding-agent Bot added queue:testing Merge-steward is validating speculative CI queue:merging Merge-steward is merging this PR and removed queue:testing Merge-steward is validating speculative CI labels Sep 14, 2026
@krasnoperov-coding-agent
krasnoperov-coding-agent Bot merged commit 5bcb214 into main Sep 14, 2026
2 checks passed
@krasnoperov-coding-agent
krasnoperov-coding-agent Bot deleted the fix/stack-child-must-not-block-parent branch September 14, 2026 19:00
@krasnoperov-coding-agent krasnoperov-coding-agent Bot removed the queue:merging Merge-steward is merging this PR label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants