Repository navigation
fix(dispatcher): the owner arms their own PR; the bot never does - #272
Conversation
#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]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 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—disarmAutoMergeis missing fromMOVES, soquietSweepdrops it → decide.mjs:502.should-fix— the PR is ready, contradicting its own body (above).should-fix— theproxy-disarmedcomment names the bot where GitHub named nobody → decide.mjs:503.consider— the disarm writes ahead of thes.lockedguard → 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
`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
|
Four commits, branch at bf188e8. Every thread answered and resolved.
The Awaiting status this branch adds also hid
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
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
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".review.skipWhen, CI went green, and the bot approved and armed it. The queue merged it 11 minutes later, before anyone read it.Behaviour
proxyApproveauthor'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.proxy-disarmed).gathernow readsauto_merge.enabled_by, so the owner's own arming stands.MOVESaction, soquietSweepkeeps it. The sweep is the only pass an Awaiting, in-step PR gets, and SahajAtlasWeb#318 is one.evaluateOpenPr's lock guard on purpose: a lease runs 150 minutes and the queue does not wait for it. The code now says so.quietSweep, which would have droppedproxyPlan'sdismissProxy— 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.Prose:
docs/why.mdgains 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, theloop-config.json$comment, and one sentence infinalize-prstep 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 tomain, 5 fail.claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs): passes, 143 tests.rule-delta.mjsonworkflow/skills: 92 → 92 directives, none removed.^dispatcher/,^loop-config\.json$, and skill paths):/security-reviewover 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 aproxyApproveauthor's open, non-draft PR armed by the bot or by nobody.mayArmgained only a conjunct, so it cannot be true where it was false.autoMergeBycomes from the authenticated REST payload and fails closed when null. Theproxy-disarmedcomment now interpolates nothing. Its one defence-in-depth note — the dismissal the new Awaiting status exposed toquietSweep— is fixed in bf188e8.🤖 Generated with Claude Code