Skip to content

docs(agents): merge stacks forward with every layer green; merge down only for vendor upgrades - #588

Open
theCodeDrift wants to merge 1 commit into
mainfrom
docs/stack-forward-all-green
Open

theCodeDrift wants to merge 1 commit into
mainfrom
docs/stack-forward-all-green

Conversation

@theCodeDrift

Copy link
Copy Markdown
Member

Makes stacked, merging forward, every layer green the default delivery shape, landed with gh stack merge.

  • gh stack merge is all-or-nothing in both directions. It lands the whole stack at once, so units that are only correct together still reach main together, and one red layer blocks the whole stack. "Only correct together" is therefore a reason to put those units in the same layer, not a reason for a red intermediate one. Make the change that cannot be split into one layer, and move everything that is correct without it below.
  • Each branch is verified before pushing (typecheck, lint, full suite), not only the tip.
  • Merging down, or a lateral merge into the stack, is reserved for vendor upgrades. There the engine bump goes red in its own layer, so a reviewer sees what the new version broke, and the layers above it make it green.
  • The changeset and archive guidance is adjusted for stacks that land at once: the changeset still lives on the bottom branch, and growing it per layer becomes a review preference.

Prompted by #583–#586, where a red intermediate layer would have blocked gh stack merge. That stack has been regrouped to be green at every layer.

No changeset: this changes contributor guidance only.

@theCodeDrift

Copy link
Copy Markdown
Member Author

@claude /review

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @theCodeDrift's task in 1m 56s —— View job


Review complete

Review mode: incremental — read 0 prior review thread(s) before reviewing. .prior-review.json contained no prior review threads, reviews, or inline comments for this PR (only the triggering @claude /review comment), so this is the first review of this PR — the whole diff was assessed fresh.

Scope: docs-only change to AGENTS.md, restructuring the "Stacked PRs" section to make stacked-and-merged-forward (via gh stack merge) the default delivery shape, with merge-down reserved for vendor upgrades, plus corresponding updates to the changeset-growing guidance.

Findings:

  • AGENTS.md:123 — [New] The new sentence "Merge down only for a vendor upgrade, or a lateral merge into the stack" introduces a "lateral merge" concept that is never defined anywhere in the document. The table above it and the "Landing a vendor-upgrade stack" section below only describe merging down; there's no section explaining what a lateral merge is, when it would be used instead of a down-merge, or how to execute one. Posted inline.

Consistency checks that passed:

  • gh stack merge is an existing, previously-documented mechanism in this repo (used the same way in openspec/changes/archive/2026-10-08-feedback-channels/proposal.md and 2026-10-21-stdout-only-colour/proposal.md), so the new table row and "Landing a stack" section aren't referencing an invented command.
  • The table's "the tip archives the change" (forward) and the later archiving paragraph ("a change is archived exactly once, on whichever PR is the tip") agree.
  • The new "Landing a stack" / "Landing a vendor-upgrade stack" headers and the gating text ("This applies only to a stack whose bottom layer is red by design") are internally consistent with the revised table and the "Merge forward... / Merge down only..." paragraphs above.
  • The changeset section's new framing (growing per-layer is a review preference, not a correctness constraint, since both landing paths are atomic) is consistent with the rest of the PR's model.

No other correctness, security, or clarity issues found in the diff.

Comment thread AGENTS.md
**Merge forward, all green, by default.** `gh stack merge` is all-or-nothing in both directions: it lands the whole stack at once, so units that are only correct together still reach `main` together, and one red layer blocks the whole stack. So "these units are only correct together" is not a reason for a red intermediate layer. It is a reason to put those units in the **same** layer. Find the change that cannot be split (a renamed directory and everything that reads its name, say), make it one layer, and move everything that is correct without it into the layers below. Verify each branch, since "this layer is green" is a claim about behavior, not intent: run typecheck, lint and the full suite on every branch before pushing.

Note how this interacts with archiving: a change is archived exactly once, on whichever PR is the tip. **No check gates that anywhere any more, though the state is reported.** A PR-time gate could only guess at stack position, and guessed wrong often enough to be ignored; a `main`-only gate replaced it and turned `main` red for the entire time a forward-merging stack was draining, which is a red that means "work is in progress" rather than "something is wrong". A signal that is expected to be red is not a signal. Archiving is a step you perform on the tip, and what replaced the gates reports instead of failing: an `Open OpenSpec` label and a tip warning on pull requests, and on `main` a tracking issue and a stale-work sweep, which is the abandoned work neither gate measured.
**Merge down only for a vendor upgrade, or a lateral merge into the stack.** Bumping a vendored engine (ast-grep, Vale) is the one case where a red layer is the point. The bump goes in its own layer, so a reviewer sees exactly what the new version broke, and the layers above it are the codemods and fixes that make it green. That bottom layer cannot be green on its own by construction, so `gh stack merge` cannot land the stack, and it merges down instead (below).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] "a lateral merge into the stack" is introduced here (and in the PR description) but never defined anywhere in this doc — the table above and the "Landing a vendor-upgrade stack" section below only describe merging down. A reader following this guidance has no way to tell what a lateral merge actually is, when it differs from merging down, or how to execute one. Either define it inline or drop the phrase until there's a section for it.

This branch has not been deployed

No deployments
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.

1 participant