Skip to content

fix(dispatcher): the owner arms their own PR; the bot never does - #272

Merged
sydevs-bot merged 6 commits into
mainfrom
claude/owner-arms-own-merge
Nov 18, 2026
Merged

sydevs-bot merged 6 commits into
mainfrom
claude/owner-arms-own-merge

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Failure prevented

An owner's PR merging with no person having decided to merge it.

#271 had the bot approve the owner's own PR (mergePolicy.proxyApprove) and then arm auto-merge on it, as on a bot PR. Nothing waited on the owner. A ready PR meant "the loop reviews this first", and it was read as "merge this".

  • SahajCloud#1192 (1 file, 6 lines) was opened ready from a local session. The critic skipped it under review.skipWhen, CI went green, and the bot approved and armed it. The queue merged it 11 minutes later, before anyone read it.
  • Four more owner PRs merged the same way within two hours of feat(dispatcher): approve the owner's own PR as the bot; arm claude-workflow #271 shipping: SahajCloud#1188 and #1189, SahajAtlasWeb#424, and SahajAtlasWordpress#88.
  • SahajAtlasWeb#318 (97 files) has the bot's approval and the bot's arming from 2026-10-28. Only one unresolved thread is holding it back.

Behaviour

  • The bot never arms a proxyApprove author's PR. It still approves at the same gates: CI green, the critic run or skipped, threads answered. The owner enables auto-merge in GitHub when they want the PR merged. That keeps the merge in the queue rather than the admin bypass feat(dispatcher): approve the owner's own PR as the bot; arm claude-workflow #271 replaced. The approval comment now says so.
  • An arming the bot already made on an owner PR is disarmed on the PR's next pass, ahead of every other step, and the owner is told once (proxy-disarmed).
    • gather now reads auto_merge.enabled_by, so the owner's own arming stands.
    • An arming that GitHub attributes to nobody fails closed, because it could be the bot's. The comment names nobody either, so it is true whichever of them armed it.
    • Drafts are left alone, since GitHub drops auto-merge on a draft anyway.
    • The disarm counts as a MOVES action, so quietSweep keeps it. The sweep is the only pass an Awaiting, in-step PR gets, and SahajAtlasWeb#318 is one.
    • It runs ahead of evaluateOpenPr's lock guard on purpose: a lease runs 150 minutes and the queue does not wait for it. The code now says so.
  • Status reads Awaiting, "approved — enable auto-merge when you want it merged", until the owner arms the PR.
  • A dismissed approval counts as a move too. That Awaiting status puts the owner's approved, unarmed PR under quietSweep, which would have dropped proxyPlan's dismissProxy — the bot's stale approval left standing over a commit of its own the owner never vouched for. Found reviewing this branch, fixed with it.
  • Other members' PRs and bot PRs are unchanged.

Prose: docs/why.md gains The owner arms their own PR, and the proxy approval and GitHub owns the merge sections now link to it. I also updated the README merging bullet, the loop-config.json $comment, and one sentence in finalize-pr step 8. That sentence is why the plugin version goes from 5.7.0 to 5.7.1.

⚠ Opened as a draft on purpose

The dispatcher runs from main, so until this lands, the #271 rule applies to this PR too: ready, it goes through the critic and is then approved, armed, and merged by the bot.

It is ready now, and its threads are answered, so the next pass approves and arms it. Put it back to draft if you do not want that, or merge it yourself. A session cannot set the draft flag.

Checks

  • node --test dispatcher/test/*.test.mjs: 374 pass. The cases cover: no arming on the owner's PR (first or later pass); another member still armed; the bot's arming disarmed first, even while CI runs and while a session holds the lease; the owner's own arming kept; an unattributed arming disarmed; the disarm write sent by node id and skipped when auto-merge is already off; the Awaiting status; and a sweep of an Awaiting owner PR keeping both the disarm and a dismissal. With the four source files reverted to main, 5 fail.
  • Lean gate (claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs): passes, 143 tests.
  • rule-delta.mjs on workflow/skills: 92 → 92 directives, none removed.
  • Security review (required for ^dispatcher/, ^loop-config\.json$, and skill paths): /security-review over the branch diff found no newly introduced HIGH or MEDIUM issue. Every new write lowers what the bot can do: one GraphQL mutation that turns auto-merge off, sent by node id with no interpolation, on a proxyApprove author's open, non-draft PR armed by the bot or by nobody. mayArm gained only a conjunct, so it cannot be true where it was false. autoMergeBy comes from the authenticated REST payload and fails closed when null. The proxy-disarmed comment now interpolates nothing. Its one defence-in-depth note — the dismissal the new Awaiting status exposed to quietSweep — is fixed in bf188e8.

🤖 Generated with Claude Code

#271 had the bot approve the owner's own PR and then arm auto-merge on
it, as on a bot PR. Nothing waited on the owner: a ready PR meant "the
loop reviews this first" and was read as "merge this". SahajCloud#1192
(1 file, 6 lines) was opened ready, skipped by the critic under
review.skipWhen, approved and armed by the bot, and merged by the queue
eleven minutes later, unread. Four more owner PRs merged the same way
within two hours (SahajCloud#1188, #1189, SahajAtlasWeb#424,
SahajAtlasWordpress#88).

On a mergePolicy.proxyApprove author's PR the bot still approves, but
`mayArm` is false: enabling auto-merge is the owner's decision, made in
GitHub's UI, and still goes through the queue, not the admin bypass.

An arming the bot already made there (SahajAtlasWeb#318 carries one
from 2026-10-28) is disarmed on the PR's next pass, ahead of every other
step, and the owner is told once. gather reads auto_merge.enabled_by;
the owner's own arming stands, and an arming GitHub names nobody for
fails closed. Status reads Awaiting until the owner arms it.

Failure prevented: an owner's PR merging with no person having decided
to merge it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived marked this pull request as ready for review November 17, 2026 23:39
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 17, 2026
@sydevs-bot

sydevs-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 23:45Z address-review · attempt 1 · session · done
  • 23:45Z address-review · attempt 1 · session
  • 23:39Z review-pr · attempt 1 · session · done
  • 23:39Z review-pr · attempt 1 · session

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

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 17, 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 diff is the size of the failure. One mayArm clause stops the arming; the disarm, the enabled_by read and the Awaiting status undo what already shipped. Six pieces, all on the existing gather → decide → apply seams, no new layer, and mayArm is the only arming path left. Two things to fix: the disarm is discarded on the sweep pass, which is the only pass SahajAtlasWeb#318 gets, and the comment explaining it can state a false cause.

This PR is ready, against its own "Opened as a draft on purpose" section. main still carries the old rule, so once these threads are answered the bot approves it, arms it, and the queue merges it unread — the bug it fixes. Put it back to draft, or merge it yourself.

Findings

  • blocker — disarmAutoMerge is missing from MOVES, so quietSweep drops it → decide.mjs:502.
  • should-fix — the PR is ready, contradicting its own body (above).
  • should-fix — the proxy-disarmed comment names the bot where GitHub named nobody → decide.mjs:503.
  • consider — the disarm writes ahead of the s.locked guard → decide.mjs:500.

What was checked

Read whole on the branch: decide.mjs — evaluatePr, evaluateGreenPr, proxyPlan, quietSweep, MOVES, and all 13 call sites; apply.mjs arm, disarm and proxyApprove; status.mjs prStatus; the gather.mjs snapshot line; all three test files. Ladder: disarmAutoMerge mirrors armAutoMerge, autoMergeBy comes from the REST payload already fetched, no dependency added. git grep armAutoMerge confirms no second arming path. sweep-orphan's own move list is draft-only and botArmedOwnerPr excludes drafts, so it is unaffected; reconcile concatenates and keeps the disarm. .claude/workflow.json declares no preview, so no link or fixture check applies. Plugin version bumped for the finalize-pr edit.

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


Generated by Claude Code

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 17, 2026
`sweep-pr` wraps its plan in `quietSweep`, which replaces any plan holding
no `MOVES` action with a note. An approved, bot-armed owner PR held by one
thread plans `[disarmAutoMerge, comment, comment]` — no move — so the sweep
dropped the disarm the pass was there to run.

SahajAtlasWeb#318 is the PR this fixes, and it sits Awaiting and in step, so
`reconcile` never targets it: the sweep is the only pass it gets. Turning a
merge off moves an item as surely as arming one does.

Failure prevented: the bot's arming surviving on every owner PR that only
the sweep ever reaches.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXEWN7ExBUigcUroex
`botArmedOwnerPr` also fires when `auto_merge.enabled_by` is null, which
fails closed because the arming could be the bot's — but it could equally
be the owner's. The comment named the bot regardless, so an owner who armed
their own PR read a false cause for an arming the loop just undid.

The message now states only what is true either way: auto-merge is off, and
on their own PR the merge is theirs. That also leaves the comment with no
interpolated text at all.

Failure prevented: telling the owner the bot did something the owner did.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXEWN7ExBUigcUroex
The disarm and its comment are the one thing `evaluatePr` writes before
`evaluateOpenPr`'s `s.locked` guard, where the dispatcher otherwise only
rechecks. Both are deliberate, and nothing said so.

A lease runs up to 150 minutes and the merge queue does not wait for it, so
an armed, approved owner PR would land mid-session. The comment has to ride
with the disarm because `botArmedOwnerPr` is false once auto-merge is off,
so no later pass plans that key again. It carries a dispatcher marker, which
`isDispatcherComment` excludes from `botLastWordAt`, so a running session
cannot read it as a word of ours.

A test now pins the locked pass.

Failure prevented: a later edit moving the disarm behind the lock guard, or
gating the comment on it, and losing one of the two.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXEWN7ExBUigcUroex
The quiet-sweep section listed `merge`, which no plan has carried since the
dispatcher stopped merging, and omitted the disarm this branch adds. A reader
checking whether their action survives the sweep read a list naming one that
cannot happen and missing one that can.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXEWN7ExBUigcUroex
This branch makes the owner's approved, unarmed PR record Awaiting, so
`quietSweep` now judges its sweeps. `proxyPlan` returns `[dismissProxy,
comment]` when the head is a commit of the bot's own that the owner has not
vouched for — no move beside it — so the sweep dropped the dismissal.

Before this branch that PR recorded Pending and the sweep ran the plan. The
paths that see a new head dismiss it ungated (`synchronize`, `ci`, `unlock`,
`reconcile`), so reaching this needs a lost event or a refused write — the
same narrowness as the disarm the sweep dropped. Dismissing the approval that
would allow a merge moves an item as surely as arming one does.

Failure prevented: the bot's approval surviving on a head of the bot's own,
ready for the owner's arming to merge a commit they never read.

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

Copy link
Copy Markdown
Contributor

Four commits, branch at bf188e8. Every thread answered and resolved.

The Awaiting status this branch adds also hid proxyPlan's dismissProxy from the sweep. bf188e8 adds it to MOVES.

/security-review: no new HIGH or MEDIUM. Lean gate green. Dispatcher tests 374 pass, 5 fail with the source reverted.

🤖 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 17, 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, so it merges through the queue. 🤖 Written by the sydevs autonomous loop — see what this is

@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 17, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 17, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 17, 2026
Merged via the queue into main with commit 406ae3d Nov 18, 2026
52 of 55 checks passed
@sydevs-bot
sydevs-bot deleted the claude/owner-arms-own-merge branch November 18, 2026 00:00
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 18, 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