Skip to content

A stacked pull request's diff reopens after the parent squash-merges, and nothing documents it #1742

Closed

Description

@ptr727

Nothing in the fleet's rules or skills covers a stacked pull request, and the fleet's own settings make one behave in a way that reads as a reviewer or tooling problem rather than as a consequence of a setting.

The shape

The fleet keeps delete_branch_on_merge off deliberately, to protect develop and main, since GitHub has no per-branch exception. drive-pr states that and relies on it. The fleet also merges feature branches with a squash.

Put those two together under a stacked pull request, meaning a child branched from a parent that is itself still open against develop, and merging the parent does this:

  • The parent lands on develop as a single squash commit, so the parent's own commits are not ancestors of develop.
  • The child still carries copies of those commits, and they are now unreachable from develop.
  • The merge base between the child and develop therefore falls back to a much older commit.
  • The child's diff reopens to include every file the parent touched.

Retargeting the child is not enough on its own, because retargeting changes the base branch and not the merge base. The child's diff stays wrong until the history is reconciled.

Why it costs a round every time

The reopened diff is not a display artifact. A reviewer reads it, so the child's next round reviews the parent's files again, and any coverage marker counts them. A driver seeing an unexpected file list naturally suspects the reviewer, the digest, or its own branch, which are the three things that are working.

The fix, and its ordering

Merge develop into the child. Rebasing is not an option, since it rewrites pushed commits and git-commit-conventions forbids the force push that would need.

The ordering matters:

  1. Retarget the child onto develop.
  2. Merge develop into the child and push.
  3. Re-run the local gates, because the merge brings in the parent's files.
  4. Re-request the review, because the head moved.

Expect GitHub to report the pull request DIRTY with a stale file list for a few seconds after that push. A driver reading mergeability in that window gets an answer that contradicts the one it gets shortly after, which is its own small trap.

What this issue asks for

Decide whether the fleet wants stacked pull requests documented at all, and if so where. operational-vs-release-workflow owns branching and promotion and is the natural home. drive-pr already states the branch-deletion setting and is where a driver would hit this.

There is a case for the opposite answer, that the fleet should say not to stack pull requests against develop and to serialize instead, in which case the rule is one sentence and this mechanism never needs describing. Filing rather than choosing.

Credit

Measured by another session on this machine, across three stacked pull requests in another fleet repository, all three of which needed the treatment.

Activity

  1. ptr727 commented on Sep 26, 2026

    @ptr727
    OwnerAuthor

    Another occurrence, in ptr727/ESPHome-NonRoot: ptr727/ESPHome-NonRoot#276 was stacked on ptr727/ESPHome-NonRoot#275. It adds two effects beyond the ones above.

    • A whole-file parent turns the reconcile into conflicts. docs: reconcile release model to gated single-branch publish (delete PUBLISH_ON_MERGE) #275 renormalized every tracked file from CRLF to LF, and lint: per-surface architecture — CI action wrappers, language-only hook, VS Code docker :latest #276 then edited several of the same files. After docs: reconcile release model to gated single-branch publish (delete PUBLISH_ON_MERGE) #275 squash-merged, git merge origin/develop into the child conflicted on all 8 files both commits touched, even though git diff <parent head> origin/develop was empty. Taking the child's side for each file is correct, and the merge commit's tree is byte-identical to the reviewed child head. But nothing tells a driver that "conflicts everywhere, parent content identical" means "take ours". An EOL-normalization parent is the case most likely to hit it.
    • Coverage is not carried across the reconcile. After the merge and retarget, pr_review.py status reported COVERAGE IS NOT CARRIED: ... the pull request changes a different set of files at the two commits. The earlier round had stated full coverage at the child head, measured against the parent branch. The content is identical, but the change set differs because the base branch differs. So every stacked child loses its coverage statement at the parent's merge, and the next two Copilot rounds on the reconciled head stated no coverage at all. The maintainer merged on the earlier full-coverage round by explicit decision.

    A driver can avoid both by not stacking a child on a whole-tree mechanical parent: land the parent first, then branch the child from develop.

  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions