Skip to content

fix(dispatcher): a conflict merge keeps an approval; a bot commit buries one - #290

Merged
Ardnived merged 6 commits into
mainfrom
claude/keep-approval-on-conflict-merge
Nov 20, 2026
Merged

Ardnived merged 6 commits into
mainfrom
claude/keep-approval-on-conflict-merge

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Failure this prevents

On 2026-11-17 the five rulesets turned on dismiss_stale_reviews_on_push. After that, every conflict resolution dismissed every approval: the merge moves the merge base and changes the diff, and GitHub has no setting that spares a merge of the base. Each approved PR went back to its reviewer for a resolution that, per docs/why.md#a-resolved-conflict-is-not-a-new-question, asks nothing.

The setting is off again in all five rulesets as of 2026-11-20 (done by hand; no other ruleset field changed). That alone left two problems:

  1. Your own PRs: proxyPlan still dismissed the bot's approval and asked for @sydevs-bot approve, because a resolve-conflicts merge commit is the bot's own.
  2. Bot PRs: a person's approval now survives a later fix-ci or address-review push. Auto-merge is armed on those PRs, so the queue would merge code nobody approved.

What changes

  • buriedApprovals reads the PR's commits after each reviewer's standing approval:
    • A commit of the bot's own buries the approval. That covers fix-ci, address-review and a relay.
    • A merge of the base keeps it. That means two parents, with the second parent off the PR. A relay's merge has its second parent on the PR, so it buries.
    • A commit by the approver on top vouches again. For the bot's proxy approval, that is the PR author's commit.
    • Unread fails closed: a nameless commit, an approval whose commit left the PR, or a commit list never read all count as buried.
  • dismissStale: a person's buried approval is dismissed on every pass, ahead of the lock guard, like the disarm. Otherwise the queue would merge the moment CI goes green.
  • proxyPlan: on your own PR, a merge of the base keeps the bot's approval. Nobody is asked to approve again.
  • gather: one pulls.listCommits call, made only when an approval sits below the head.
  • docs/why.md: new section #a-bot-commit-buries-an-approval-a-conflict-merge-does-not, naming buriedApprovals rather than retelling its conditions. Two passages that assumed the setting was on are updated.
  • Joined, from review: vouched was exported with no importer, a screen below buriedApprovals and the same defect. Both exports are gone.

Unchanged: the contract check still withdraws its own approval, and an Actions app's approval is never touched by dismissStale.

Tests

  • node --test dispatcher/test/*.test.mjs: 398 pass. 8 new tests cover: a merge carried on the owner's PR; a fix under the merge; a relay merge; a person's approval carried; a person's approval dismissed, also under a lock; the unread cases; and approvals that are left alone.
  • node --test workflow/lib/*.test.mjs: 147 pass.
  • Nothing under workflow/ changed, so the plugin version stays the same.

⚠ Unverified until the first live dismissal

dismissStale is the first time sydevs-bot dismisses someone else's review. It has write in all five repos, and no ruleset restricts who may dismiss, so GitHub should allow it. If GitHub refuses, handOver reports the refusal instead of dropping it. The first bot push after a person's approval is the supervised check.

Notes for reviewer

  • Review threads are all answered and resolved. Four adopted, one rebutted with evidence (the dismissal requesting no reviewer: requestReviewer's already guard makes it a no-op).
  • Follow-up chosen, not deferred quietly: refactor(dispatcher): hold approval accounting in its own module #291 moves the ten pieces of approval accounting out of decide.mjs into dispatcher/approvals.mjs. It is a pure refactor and deliberately not in this PR — ten moved functions plus an import-cycle decision would make this diff unreviewable.
  • main is merged into the branch (clean), so the gate tested the merged result.

🤖 Generated with Claude Code

…ies one

The rulesets' dismiss_stale_reviews_on_push (on since 2026-11-17) dismissed
every approval on each conflict resolution: the merge moves the merge base,
and GitHub has no setting that spares a merge of the base. It is off again
in all five rulesets as of 2026-11-20, so the dispatcher now withdraws only
what warrants it.

buriedApprovals reads the PR's commits after each standing approval. A
commit of the bot's own (fix-ci, address-review, a relay) buries it. A merge
of the base (two parents, the second off the PR) does not. The approver's
own commit on top vouches again. Unread fails closed.

- A person's buried approval is dismissed (dismissStale) on every pass,
  ahead of the lock guard, so the queue cannot merge it once CI goes green.
- proxyPlan keeps the bot's approval on the owner's PR across a merge of
  the base, instead of dismissing it and asking for `approve`.
- gather reads the PR's commits only when an approval sits below the head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-bot

sydevs-bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 22:56Z address-review · attempt 1 · session · done
  • 22:56Z address-review · attempt 1 · session
  • 22:45Z review-pr · attempt 1 · session · done
  • 22:45Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 20, 2026

@sydevs-bot sydevs-bot left a comment

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.

🧐 Adversarial review

The shape is right, and the two halves cannot ship apart: turning the ruleset setting off is what opens the second hole, so proxyPlan alone would leave the queue merging code nobody approved. GitHub has no "dismiss on push, except a merge of the base", and disarmAutoMerge does not substitute, because armAutoMerge re-arms on the next pass unless it reads the same helper. So own code is forced, at 90 lines.

should-fix

  • docs/why.md:2334 — the middle paragraphs restate the two doc comments and the new tests.
  • dispatcher/apply.mjs:299 — the dismissStale case is dismissProxy's body again.

consider

  • dispatcher/decide.mjs:540 — ten pieces of approval accounting in one 82KB file.
  • dispatcher/decide.mjs:561 — buriedApprovals is exported with no importer.
  • dispatcher/decide.mjs:536 — the dismissal requests no reviewer, where contractSyncPlan does.

What was checked. Read: decide.mjs, apply.mjs and gather.mjs on the branch, plus status.mjs, relay.mjs, documentation.md and the resolve-conflicts skill. Traced both scenarios: an owner's conflict merge plans nothing, a fix over a person's approval plans dismissStale. The relay claim holds — applyRelay fast-forwards, and its repos.merge fallback commits under the bot's PAT, so that second parent is on the PR. resolve-conflicts forbids rebase, so an approval's commit never leaves the PR on a resolution. Gather's fetch condition cannot be false while a standing approval sits below the head, so "unread fails closed" cannot fire a false dismissal. dismissStale is in MOVES, ahead of evaluateOpenPr's lock guard. The other dismiss_stale_reviews_on_push mention is updated; no skill prose went stale.

One assumption nothing pins: the index walk needs pulls.listCommits oldest-first, and the fixtures cannot show it.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread docs/why.md Resolved
Comment thread dispatcher/apply.mjs Resolved
Comment thread dispatcher/decide.mjs Resolved
Comment thread dispatcher/decide.mjs Resolved
Comment thread dispatcher/decide.mjs Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 20, 2026
web-flow and others added 5 commits November 20, 2026 22:57
`dismissStale` was `dismissProxy`'s body with the message changed. Two
bodies that dismiss the same way drift apart on the next change to
either. One case now carries both, picking its message from `a.type`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVNCfuWhXrreDirTJ4
No module imported it: `status.mjs` does not read it, and the tests
reach it through `evaluatePr`. Its sibling `standingApprovals` is
private, which is the right shape. An export with no importer invites
one from outside the plan.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVNCfuWhXrreDirTJ4
The two middle paragraphs restated `buriedApprovals`'s and `stalePlan`'s
doc comments sentence for sentence, and the conditions the new tests
hold. documentation.md gives each fact one home and forbids paraphrasing
a symbol's logic, so a condition added to the code left the prose stale
with no gate to catch it. What stays is what the code cannot show: the
ruleset history, that a conflict merge asks nothing, that a person's
commit neither buries nor vouches, and why unread fails closed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVNCfuWhXrreDirTJ4
Found while dropping `buriedApprovals`'s export, one screen away and the
same defect: nothing imports `vouched` either. `proxyVerdict` is its
only caller, and the tests reach it through `evaluatePr` and the status
derivation. (joined per the join rule)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVNCfuWhXrreDirTJ4
@sydevs-bot

Copy link
Copy Markdown
Contributor

Every critic thread is answered and resolved. Merged main in first, clean.

Adopted

Rebutted

Its own ticket

Security review ran: no findings.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026

@sydevs-bot sydevs-bot left a comment

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.

Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is

@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 20, 2026
@Ardnived
Ardnived added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 09fcbb1 Nov 20, 2026
22 checks passed
@Ardnived
Ardnived deleted the claude/keep-approval-on-conflict-merge branch November 20, 2026 23:42
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants