Repository navigation
feat(dispatcher): approve the owner's own PR as the bot; arm claude-workflow - #271
Conversation
Every product ruleset needs one approval, and GitHub refuses an author's own. A PR the owner opened from a local session (as Ardnived) had nobody to approve it, so the owner disabled the auto-merge the dispatcher armed and merged with the admin bypass. That skipped the merge queue: on SahajCloud 4 of 16 such merges (#1163, #1172, #1180, #1184) landed before `Lint, Test & Smoke` finished, and each run then went red. `mergePolicy.proxyApprove` names the authors whose own ready PR the bot approves, at the point a bot draft is marked ready: CI green, the critic run or skipped, threads answered. The approval is pinned to the head it read. A head commit of the bot's own (fix-ci, address-review, a relay) is never approved on the author's behalf: an earlier bot approval is dismissed, and the PR waits for the author's `@sydevs-bot approve` after that commit. The verb from anyone else, or on anyone else's PR, is refused. Failure prevented: owner PRs merged by admin bypass, skipping the queue and landing before required CI finished. Co-Authored-By: Claude Opus 5.5 <[email protected]>
claude-workflow's ruleset required 0 approvals and no CI, so a sydevs-bot token with write access could merge a change to the loop's own instructions, and merging here is the deploy. The ruleset is moving to the product repos' gate: one approval, the `test` check, resolved threads and the merge queue. The approval is the person deciding, so `loopMayNotMerge` no longer needs to name this repo, and the dispatcher arms auto-merge here too. CI gains the `merge_group` trigger the queue needs (without it the required check never reports and the queue stalls), and the version-bump step reads the merge group's base and head when there is no pull request. Failure prevented: an unreviewed or untested merge to the loop's live main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The failure is counted — four admin-bypass merges, named — and standing in for the approval GitHub refuses its author is the smallest thing that reaches the queue. The approval itself is about ten lines. The guard around it is most of the other 250, and that is the part to weigh: the bot-head hold earns its place, because the loop does push to member PRs. The approve verb beside it does not, because line 626 already treats the author's push as vouching. One guard fails open.
Contracts hold. resolve.mjs:141 already resolves a gh-readonly-queue/* branch, so the CI runs the new merge_group trigger adds land on a path that exists, and status.mjs:102 degrades correctly once loopMayNotMerge is empty.
Findings
- should-fix
dispatcher/decide.mjs:626— the head-author guard fails open when GitHub resolves the commit's author to nobody. - should-fix
dispatcher/decide.mjs:628—approveis a second path to the vouching a push already gives. - consider
loop-config.json:206— between this merge and the ruleset, every green PR here gets a refused arming and a handback.
What was checked
Read whole on the branch: decide.mjs, gather.mjs, apply.mjs, ci.yml, status.mjs, resolve.mjs, the new tests. Ladder walked on each new piece — proxyApproves, proxyPlan, vouched, dismissProxy, headCommittedAt, the verb, two apply cases: no new file, no dependency, and both writes use pulls.createReview/dismissReview rather than a hand-rolled call. Consumers of the emptied list followed: status.mjs:102, merge-gate.mjs:187, migrate-to-status.mjs:71. CLAUDE.md is a symlink to AGENTS.md, so the one prose edit covers both. No fixture or previewUrl in .claude/workflow.json, so no link check. rule-delta.mjs not owed: no skill changed.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`getCommit` returns `author: null` when the commit's email maps to no account. `gather` then set `headAuthor: null` with `headCommittedAt` filled, so `proxyPlan`'s unread guard let it through, `isBot(null)` was false, and a commit of the bot's own was approved as the author's — the one thing the bot-head hold exists to stop. `!s.headAuthor` now joins that guard, so an unresolved author holds the approval instead of giving it. `gather` already defaults the same field the other way for the repair cap. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVdknt5Rcj6ujnAcad
The anchor said the approval never covers a commit of the bot's own, which left the null-author case invisible: the only guard is who pushed the head, so an unanswerable question has to fail closed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVdknt5Rcj6ujnAcad
… date `vouched` compared the author's `approve` against the head commit's own committer date. A session commits to a relay branch and Actions lands it only when the session ends — up to `dispatch.timeoutsMinutes` later — so a commit made at 09:00 and landed at 11:30 was covered by a vouch written at 09:20 for the head it replaced. The bot then approved code the author had never seen, which is the one thing the bot-head hold exists to stop. The clock is now the bot's own hold comment for this head: a vouch counts only after the bot has asked about the commit it covers. The ask always precedes a real vouch, because the ask is what tells the author to write one, so the documented flow is unchanged. `commentOnce`'s mark moves to markers.mjs, which neither module imports from the other, so `decide` can read back a key `apply` writes. Found by the branch-level security review required for `^dispatcher/`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVdknt5Rcj6ujnAcad
The anchor described the hold but not what makes a vouch cover one commit and not the next. The relay's delay between committing and landing is the reason the commit's own date cannot be that clock. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVdknt5Rcj6ujnAcad
|
Adopted — the head-author guard fails open. Adopted — the rollout window. Rollout order now names the refused armings, each a handback comment and an Awaiting status. Rebutted — Also fixed: the security review found the vouch covered a relay commit landed after it, approving code you never saw. Gates green. Commits wait on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Two behaviours, one commit each, plus four commits from review. They ship together because both change how a PR here and in the product repos reaches the merge queue, and the claude-workflow ruleset change below depends on both.
1. The bot approves the owner's own PR (
mergePolicy.proxyApprove)Failure prevented. Every product ruleset needs one approval, and GitHub refuses an author's own. PRs opened from a local session as Ardnived had nobody to approve them. The owner disabled the auto-merge the dispatcher had armed and merged with the admin bypass, which skips the merge queue. On SahajCloud, 4 of the last 16 such merges (#1163, #1172, #1180, #1184) landed before
Lint, Test & Smokefinished, and each of those runs then went red.Behaviour. For an author listed in
mergePolicy.proxyApprove(["Ardnived"]), the bot approves at the point where a bot draft would be marked ready: CI green, the critic run (or the PR underreview.skipWhen), and its threads answered. No reviewer is requested. From there the PR takes the bot PRs' path: the ruleset is satisfied, and the queue tests the PR against its base.Guard. The loop pushes fixes onto member PRs, and the ruleset keeps an approval through later pushes. So:
@sydevs-bot approve, posted after the bot asks about that commit. The ask is the clock, not the commit's date: a relay commit is made before Actions lands it.approvefrom anyone else, or on anyone else's PR, is refused. On a draft, it is ignored until the PR is ready.approveis excluded from the mentions that fire address-review.2. claude-workflow is armed like the product repos
The
loopMayNotMergelist is now empty. CI gains themerge_grouptrigger, and the version-bump step now reads the merge group's base and head. Without that trigger the required check never reports and the queue stalls.Rollout order
test, merge queue. Also enableallow_auto_mergeon the repo.Applying the ruleset first would stall the queue, because the
merge_grouptrigger would not exist yet.Between the two steps every green PR here is armed for auto-merge, and GitHub refuses it while
allow_auto_mergeis off. Each refusal becomes a handback comment and an Awaiting status. It is harmless and clears itself at step 2, so do both in one sitting.Checks
node --test dispatcher/test/*.test.mjs: 369 pass. New cases cover approve, the bot-head hold and dismissal, the vouching verb before and after a commit, refusals, and a head whose commit or author is unread.node --test workflow/lib/*.test.mjs: 143 pass.claude plugin validate ./workflow --strict: passes.node workflow/lib/rule-delta.mjs: not run, because no skill was edited./security-reviewover the branch (required for^dispatcher/): one High finding — a vouch covering a relay commit landed after it — fixed in3db3d30with a test that fails without it. Nothing else found; the report walkedroute's comment gating,evaluatePr's outside-PR return,apply's two writes, and themerge_groupandpull_request_targetworkflows.🤖 Generated with Claude Code