Skip to content

docs(stack): record what a stack push rebases away in the skill#1724

Draft
JulianMaurin wants to merge 3 commits into
devs/JulianMaurin/improve-mergify-stack-skill/refuse-amend-rebase-conflict-pause--a59c6db0from
devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab
Draft

docs(stack): record what a stack push rebases away in the skill#1724
JulianMaurin wants to merge 3 commits into
devs/JulianMaurin/improve-mergify-stack-skill/refuse-amend-rebase-conflict-pause--a59c6db0from
devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab

Conversation

@JulianMaurin

@JulianMaurin JulianMaurin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Fold the rebase-hazard knowledge that was drafted into a consuming repo's
AGENTS.md into the mergify-stack skill, where it travels with the CLI and
surfaces at the point an agent runs the commands. Woven into the adjacent
conventions rather than bolted on, and generalized (config-dependent behavior
stated conditionally) since the skill is repo-agnostic.

  • Amend notes: a note rides along with its commit through amends and rebases,
    so attaching it once is enough.
  • Mid-stack fixes / Conflict Resolution: amend only at a stack edit pause
    (clean tree, git tells you to), with git commit --amend --no-edit so the
    message — and its Change-Id — stays verbatim; the commit-msg hook only inserts
    a Change-Id when one is missing, so it won't rewrite yours. At a rebase
    conflict pause the pick hasn't produced a commit yet and HEAD is the
    last-applied commit, so git commit --amend re-maps your work to the wrong
    PR's Change-Id — the commit-msg hook refuses it, and the resolve path is
    git add + git rebase --continue.
  • Target notes and stack edit by Change-Id, not SHA — it maps a commit to its
    PR and survives every rebase. Both forms are accepted, and they diverge once a
    SHA is stale: stack edit matches against the commits in the stack and fails
    loudly, while stack note resolves any revision and silently attaches to a
    commit no push will read.
  • PR title & body: unless mergify-cli.stack-keep-pr-title-body is set, every
    push re-syncs bodies from commit messages, and a reword at the bottom of a
    stack re-syncs every PR above it — so hand-edits don't stick.
  • New "Reading CI status" section: gh pr checks exit codes (0 pass, 8 pending;
    non-zero is not always a CI failure — 1 is also gh's generic error, 4 is auth),
    the stale stack list CI column, and CANCELLED rollup entries being
    superseded-run history, not failures.
  • Draft PRs: a stacked draft may get no CI at all, so a wall of skipping is
    "never ran", not "green".

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Depends-On: #1730

Copilot AI review requested due to automatic review settings July 17, 2026 18:07
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 17, 2026 18:07 Failure
@mergify

mergify Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 3 of 7 protections blocking · waiting on 👀 reviews and ⛓️ dependency

Protection Waiting on
🔴 ⛓️ Depends-On Requirements ⛓️ dependency
🔴 👀 Review Requirements 👀 reviews
🔴 🔎 Reviews 👀 reviews
🟢 🤖 Continuous Integration
🟢 Enforce conventional commit
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 ⛓️ Depends-On Requirements

Waiting for

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

🔴 👀 Review Requirements

Waiting for

  • #approved-reviews-by>=2
This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

Waiting for

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

Show 4 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

Copilot AI 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.

Pull request overview

Updates the mergify-stack agent skill documentation to capture rebase-related hazards and operational conventions directly at the point where agents run mergify stack commands, with added guidance on notes, Change-Ids, PR body syncing, and interpreting CI status.

Changes:

  • Expanded guidance on amend notes, Change-Id targeting, and when/why to use stack push --skip-rebase.
  • Clarified stack-managed PR title/body syncing behavior and draft-PR CI implications.
  • Added a “Reading CI status” section and strengthened conflict-resolution guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/mergify-stack/SKILL.md Outdated
Comment thread skills/mergify-stack/SKILL.md Outdated
Comment thread skills/mergify-stack/SKILL.md Outdated
Comment thread skills/mergify-stack/SKILL.md Outdated
Comment thread skills/mergify-stack/SKILL.md Outdated
Comment thread skills/mergify-stack/SKILL.md Outdated
@mergify
mergify Bot requested a review from a team July 17, 2026 18:14
@JulianMaurin
JulianMaurin force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab branch from 9048f25 to 92e9144 Compare July 17, 2026 18:30
@JulianMaurin

JulianMaurin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 9048f25 2026-07-17 18:30 UTC
2 content 9048f25 → 92e9144 Address Copilot review + self code-review on #1724: correct the --no-verify/Change-Id rationale (the Gerrit commit-msg hook preserves an existing Change-Id; --no-edit is the load-bearing flag), make … 2026-07-17 18:30 UTC
3 content 92e9144 → 8896d57 (raw) 2026-07-20 13:25 UTC
4 content 8896d57 → cee6930 (raw) reorder: docs moved to the top of the stack so it describes the shipped behavior; adapt the Change-Id/SHA advice now that stack edit matches against the stack 2026-07-20 14:36 UTC
5 rebase cee6930 → 21fee1a (rebase only) 2026-07-20 15:20 UTC

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 17, 2026 18:31 Failure

@jd jd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Amend notes / Amend Notes: a note is keyed to the commit SHA, so a rebasing
push orphans it with a blank Reason. Push with --skip-rebase to pin the SHA
so the note lands, and keep the durable "why" in the commit message body.

Is that something that should be fixed in the code rather than in the workflow?

@mergify
mergify Bot requested a review from a team July 18, 2026 10:11
@JulianMaurin
JulianMaurin force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab branch from 92e9144 to 8896d57 Compare July 20, 2026 13:25
@JulianMaurin

JulianMaurin commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 fix(stack): carry the revision note onto the rewritten commit #1729
2 fix(stack): refuse an amend at a rebase conflict pause #1730
3 docs(stack): record what a stack push rebases away in the skill #1724 👈

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 20, 2026 13:26 Failure
@JulianMaurin
JulianMaurin force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab branch from 8896d57 to cee6930 Compare July 20, 2026 14:35
@JulianMaurin
JulianMaurin changed the base branch from main to devs/JulianMaurin/improve-mergify-stack-skill/refuse-amend-rebase-conflict-pause--a59c6db0 July 20, 2026 14:35
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 20, 2026 14:36 Failure
JulianMaurin and others added 3 commits July 20, 2026 17:19
A note is addressed by commit SHA, so every rewrite stranded it. The
rebase `stack push` runs before it reads notes back left the reason on
the pre-rebase SHA, and the revision history recorded a blank `Reason`;
a plain `git commit --amend` lost it the same way.

`stack setup` now adds a local `notes.rewriteRef`, which is what covers
the rewrites git runs on its own — `git commit --amend`, and the
`git rebase --continue` that finishes a conflicted rebase. The CLI's own
rebases pass the same settings with `-c` so they stay correct in
checkouts whose config predates this, and so a global
`notes.rewriteMode=ignore` cannot disable the copy. Existing checkouts
pick the config up on their next `mergify stack setup`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: I0e5503e0eeddcc02c689eb78581b8c211b2dd741
At a conflict the pick being replayed has not produced a commit yet, so
HEAD is the last commit the rebase applied — the trunk tip when the
bottom commit conflicted, otherwise an earlier commit of the stack.
`git commit --amend` there rewrites that commit and stamps the work with
its message and Change-Id, mapping it to the wrong pull request.

The commit-msg hook now refuses it. A `stack edit` pause records its
target in `rebase-merge/amend` and stays allowed, the sequencer's own
commit during `git rebase --continue` never reaches this hook, and
`--no-verify` overrides.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: Ia59c6db0b1f8e729ea2142f00c1c56db94dd51d5
Fold the rebase-hazard knowledge that was drafted into a consuming repo's
AGENTS.md into the mergify-stack skill, where it travels with the CLI and
surfaces at the point an agent runs the commands. Woven into the adjacent
conventions rather than bolted on, and generalized (config-dependent behavior
stated conditionally) since the skill is repo-agnostic.

- Amend notes: a note rides along with its commit through amends and rebases,
  so attaching it once is enough.
- Mid-stack fixes / Conflict Resolution: amend only at a `stack edit` pause
  (clean tree, git tells you to), with `git commit --amend --no-edit` so the
  message — and its Change-Id — stays verbatim; the commit-msg hook only inserts
  a Change-Id when one is missing, so it won't rewrite yours. At a rebase
  *conflict* pause the pick hasn't produced a commit yet and HEAD is the
  last-applied commit, so `git commit --amend` re-maps your work to the wrong
  PR's Change-Id — the commit-msg hook refuses it, and the resolve path is
  `git add` + `git rebase --continue`.
- Target notes and `stack edit` by Change-Id, not SHA — it maps a commit to its
  PR and survives every rebase. Both forms are accepted, and they diverge once a
  SHA is stale: `stack edit` matches against the commits in the stack and fails
  loudly, while `stack note` resolves any revision and silently attaches to a
  commit no push will read.
- PR title & body: unless `mergify-cli.stack-keep-pr-title-body` is set, every
  push re-syncs bodies from commit messages, and a reword at the bottom of a
  stack re-syncs every PR above it — so hand-edits don't stick.
- New "Reading CI status" section: `gh pr checks` exit codes (0 pass, 8 pending;
  non-zero is not always a CI failure — 1 is also gh's generic error, 4 is auth),
  the stale `stack list` CI column, and CANCELLED rollup entries being
  superseded-run history, not failures.
- Draft PRs: a stacked draft may get no CI at all, so a wall of `skipping` is
  "never ran", not "green".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: If60237ab0912ee50f65b2a3571047d5b343eb94e
@JulianMaurin
JulianMaurin force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/refuse-amend-rebase-conflict-pause--a59c6db0 branch from baa7a73 to b361ce0 Compare July 20, 2026 15:20
@JulianMaurin
JulianMaurin force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/record-what-stack-push-rebases-away-skill--f60237ab branch from cee6930 to 21fee1a Compare July 20, 2026 15:20
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 20, 2026 15:20 Failure
@mergify
mergify Bot force-pushed the devs/JulianMaurin/improve-mergify-stack-skill/refuse-amend-rebase-conflict-pause--a59c6db0 branch from b361ce0 to 8f8fc68 Compare July 21, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants