Skip to content

docs: one source for when to stack pull requests - #15389

Merged
kyle-sexton merged 5 commits into
mainfrom
docs/stacked-pr-guidance
Nov 11, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
docs/stacked-pr-guidance

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

No related issue: owner-requested guidance on when to use native stacked pull requests.

Summary

Makes plugins/source-control/reference/stacked-prs.md (moved from skills/pull-request/reference/stacks.md so other plugins can cite it) the single source for when to stack. Stack dependent changes, a large change split for review, and ordered series ("part N of M", blocked-by chains). Keep independent changes as separate PRs off the trunk. The skills that plan, split or open PRs now point at it instead of restating it.

It also fixes a stale claim. The reference said the pipeline lanes skip a layer whose base is not the default branch. Since #9019 (2026-10-22), the trust gate fails such a layer, so the reference now says to check the pipeline first and use sequential PRs where it refuses layers. In this repository, #15400 now lets the review and run lanes accept a native stack layer whose stack base is main. The merge and issue lanes still do not handle layers (#15410), so the reference keeps unattended lanes from stacking until that lands.

Fix

  • source-control/reference/stacked-prs.md: the "When to stack" section now lists when to stack and when not to, adds a "check the repository's pipeline first" paragraph, and says unattended lanes do not stack until their pipeline accepts layers. Its records are re-stamped 2026-11-11, and the queue pointer now names Merging using a merge queue.
  • pull-request SKILL.md: a "Stack or separate" action default. The links in SKILL.md and merge.md now go to the new path.
  • worktree context/create.md: a stacked layer starts from the layer below it.
  • work-items reference/execution-shape.md: a new "Stacked per-item PRs" note under per-item PRs. It is not a new shape value, so the parser is unchanged. decompose (Blocked by), ship run (the gotcha about out-of-order merges) and work point at it. work also says CI mode never stacks.
  • implementation implement-dispatch reference/item-list.md: a caller may stack a dependent item; the skill never cuts a worker from another worker's branch.
  • docs/upstream/cursor-pstack.md: the link follows the move.
  • docs/conventions/pr-pipeline/pr-run-activity.md: a stacked PR's failure comes from step 3 (check-trusted-trigger, untrusted-base), not step 4.
  • Changelog fragments for source-control, work-items, implementation and pr-pipeline (patch).

Not edited:

  • code-tidying (batch-simplify and tidy each ship one PR by design, so a stack has no place there).
  • babysit-prs and babysit-loop (they already carry the babysit_stacked_prs opt-in).
  • Every path on the hold_patterns list (AGENTS.md, .claude/*, lane workflows, babysit scripts).

Verification

  • plugins/skill-quality/scripts/check-skill.sh over the source-control, work-items and implementation skills roots: 21 passed, 0 failed (the Gotchas warnings were there before this change).
  • markdownlint-cli2 on the changed reference files: 0 issues.
  • git grep stacks.md outside CHANGELOGs: no references left.
  • Local code review (fresh context): no blockers. One finding (the step-3 citation above) and two suggestions (cut the restated triggers from execution-shape.md; drop heading anchors from cross-plugin links) were fixed. Local security review: no findings.
  • gh stack is installed on the authoring machine (github/gh-stack v0.3.0, from gh extension list).

Follow-ups

Each item below is a lane that needs a code change before this repository's lanes can use stacks. Issue filing is paused, so they are listed here instead.

  1. Resolved by feat(pr-pipeline): accept native stack layers that target main #15400 (owner decision Q40): the trust gate now accepts a native layer whose stack base is main. As first found: .github/actions/check-trusted-trigger/check-trusted-trigger.mjs:1379-1381 throws untrusted-base when pull.base.ref is not the default branch. ADR 0055 (docs/adr/0055-load-nothing-head-controlled-into-a-pipeline-skill-activity.md:14-17) records why: a PR into an unprotected branch could choose its own base. The review lanes run this gate (.github/workflows/pr-review-main.yml:353), and ci-status requires both review lanes on the head (.github/workflows/pr-require-checks.yml:6969-6983), so an upper layer's ci-status cannot pass. One option is to accept a layer when the webhook's pull_request.stack.base.ref is the default branch, and read config from the default branch's tip instead of the layer's base (How workflows run for a stack). That loosens a security control, so it needs the owner's decision.
  2. The lane cannot open a layer (items 2 to 4 are tracked in pr-pipeline: merge and issue lanes for native stack layers #15410). .github/scripts/work-resolve-issue/report-outcome.mjs:2638-2641 and :2806 open every lane PR against the default branch, and check-blockers.mjs:142 skips an issue while its blocker is open. A stacked series needs the lane to start part N+1 on part N's open branch and open its PR on that base.
  3. Auto-merge sweep reads only PRs into main. .github/scripts/pr-merge/enable-auto-merge.mjs:291-295 queries baseRefName: "main", so it never sees an upper layer.
  4. Done evidence counts only merges into the default branch. .github/scripts/lib/done-evidence.mjs:65 and plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py:2526 require base.ref to be the default branch. The docs(source-control): re-stamp stacks reference at GA and correct queue text #7668 probe saw an upper layer merge in the same pass and keep its old base, so its merge would not count. UNVERIFIED: whether GitHub closes the issue named by an upper layer's Closes #N in that case; probe before relying on it.
  5. Other non-default-base skips (behavior to keep in mind, not defects). pr-refine fails a layer (docs(source-control): re-stamp stacks reference at GA and correct queue text #7668 probe). pr-unblock.yml:246-283 and resolve-conflicts skip with not-applicable (docs/conventions/pr-pipeline/README.md:241-242). babysit_stacked_prs is off by default (plugins/source-control/.claude-plugin/plugin.json:145-146), so babysit holds layers for a human.

Not blockers:

  • The rulesets (base, ci-gate, signing, trust-root, merge-queue) all target ~DEFAULT_BRANCH, and GitHub applies the trunk's rules to every layer.
  • The merge queue (SQUASH, ALLGREEN, 5 entries) takes a stack in order and may exceed the group size to keep it together (Merging using a merge queue).
  • No ruleset restricts branch names.
  • prune-branches.mjs:40 already spares a branch that open PRs use as their base.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe

kyle-sexton and others added 3 commits November 11, 2026 10:18
Move the stacked pull request reference to source-control's plugin
level (reference/stacked-prs.md) so other plugins can point at it, and
make its "When to stack" section the single source: dependent changes,
a large change split for review and ordered series stack; independent
changes stay separate PRs off the trunk.

Replace the stale line that said the pipeline lanes skip a layer whose
base is not the default branch: since the trust gate's untrusted-base
stop, such a layer gets a failure check, so the reference now says to
check the pipeline before stacking.

Point pull-request, worktree, work-items (execution-shape, decompose,
ship run, work) and implement-dispatch at it instead of restating it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
A skill spoke may not add a ${CLAUDE_PLUGIN_ROOT} path beyond its
baseline (check-spoke-plugin-root).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
A stacked PR stops at check-trusted-trigger (untrusted-base) in step 3
of the run job, before check-trusted-base; correct pr-run-activity.md
and stacked-prs.md. Drop the restated stack triggers from
execution-shape.md and the heading anchors from the cross-plugin links.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 11, 2026 15:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T18:03:46.495241Z 3909728 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A blob URL to the new file 404s until it merges (lychee-online-changed),
and an installed plugin cannot reach another plugin by a relative path,
so name the source-control plugin's file as the existing cross-plugin
citations do.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@kyle-sexton
kyle-sexton marked this pull request as draft November 11, 2026 18:01
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 11, 2026 18:01

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3909728ff7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 7ca8a242b3d76f3d15a05613701dbabf0a65e4b8: read 15 of 15 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no blocking findings. This pass reported blocking findings only, because the prior-findings file shows this lane already reviewed an earlier head (3909728f). I read every hunk of all 15 listed files, plus the deleted plugins/source-control/skills/pull-request/reference/stacks.md.

What changed since the earlier review. The one settled thread asked to drop the #when-to-stack heading anchors from cross-plugin links. The owner fixed it in 7ca8a242, and the thread's lines are unchanged since it was resolved. At head:

  • pull-request/SKILL.md and worktree/context/create.md link to stacked-prs.md with no anchor and name "When to stack" in the text.
  • The work-items and implementation files name the file without linking to it.

What I checked at head:

  • Relative links resolve. Each target below exists at head:
    • pull-request/SKILL.md → ../../reference/stacked-prs.md
    • merge.md → ../../../reference/stacked-prs.md
    • worktree/context/create.md → ../../../reference/stacked-prs.md
    • stacked-prs.md → ../skills/pull-request/reference/merge.md
    • ship/actions/run.md → ../../../reference/execution-shape.md
    • docs/upstream/cursor-pstack.md → ../../plugins/source-control/reference/stacked-prs.md
  • The decompose and work links use the same ${CLAUDE_PLUGIN_ROOT}/reference/... form those files already use for other links.
  • The stacked-prs.md text agrees with the PR description. The review and run lanes accept a native stack layer whose stack base is the default branch (feat(pr-pipeline): accept native stack layers that target main #15400). The merge and issue lanes do not handle layers yet (pr-pipeline: merge and issue lanes for native stack layers #15410), so unattended lanes do not stack. The work skill likewise says CI mode never stacks.
  • Changelog fragments are all bump: patch, which fits a docs-only change.

Not checked:

  • Closing issue. The PR names none, so there were no acceptance criteria to check.
  • Manifests. The diff changes no plugin manifest, so there are no manifest lines.
  • Author's verification. The check-skill.sh, markdownlint-cli2 and git grep results in the PR body are the author's claims. I did not run them.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 7ca8a242b3d76f3d15a05613701dbabf0a65e4b8: read 15 of 15 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15389, docs: one source for when to stack pull requests

No security issues found. I read every hunk of all 15 listed files and the deletion of plugins/source-control/skills/pull-request/reference/stacks.md. This lane already reviewed an earlier head (3909728f), so this pass reports only blocking findings. There are none to report.

Scope

  • Every change is Markdown: changelog fragments, skill and reference prose, one upstream attribution row, and one pipeline convention doc.
  • No script, workflow, action, manifest or config file changes.
  • No changed file matches a TRUSTED PATHS: glob. docs/conventions/pr-pipeline/pr-run-activity.md is not docs/conventions/pr-pipeline.yaml.

Since the last review: the head commit removes the #when-to-stack heading anchors from cross-plugin links. That matches the settled thread on pull-request/SKILL.md, which stays settled. No new security surface.

Instruction-surface lens. I read the deleted stacks.md against the new stacked-prs.md:

  • When to stack: this is wider. Stacking is now also allowed for a large change split for review and for an ordered series. That changes how PRs are grouped, not what any actor, token or lane may do.
  • Merge rules: every merge rule is carried over word for word:
    • re-verify readiness on every layer that will land;
    • get the user's approval for the whole set;
    • trunk rules govern every layer;
    • no bypass;
    • babysit_stacked_prs holds layers for a person by default.
  • Stale line: the claim that lanes "skip" a non-default-base layer is replaced with a more accurate description of the gate.
  • New limits:
    • "an unattended lane does not stack until that work lands" (stacked-prs.md);
    • "CI mode never stacks" (work/SKILL.md);
    • implement-dispatch "never cuts a worker from another worker's branch".

No removed rule loses its enforcement. I judged each rule by its consequence and did not consult the protected-class register (docs/contracts/instruction-exception-register/README.md).

Trust controls. Nothing changes check-trusted-trigger, the lane token scope, the kill switch, the token broker or any merge hold. The PR text says loosening the untrusted-base stop happened in #15400, not here. This diff changes no gate code.

PR context: I found no embedded instructions aimed at the review lane.

Manifests: no .claude-plugin/plugin.json or marketplace.json changes.

critical-findings: 0

Take #15400's pr-run-activity.md paragraph (native stack layers into
the default branch run their lanes), keeping this branch's step 3
correction for every other non-default base. Update stacked-prs.md to
match: the review and run lanes accept such a layer, the merge and
issue lanes do not yet (#15410), so unattended lanes still do not
stack. Drop the #when-to-stack heading anchors (Codex review).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQb9Q2ceZLXhTR4d1vkTCe
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit ccd448c Nov 11, 2026
65 checks passed
@kyle-sexton
kyle-sexton deleted the docs/stacked-pr-guidance branch November 11, 2026 19:43
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant