Skip to content

feat(dispatcher): approve the owner's own PR as the bot; arm claude-workflow - #271

Merged
Ardnived merged 6 commits into
mainfrom
feat/proxy-approve-owner-prs
Nov 17, 2026
Merged

Ardnived merged 6 commits into
mainfrom
feat/proxy-approve-owner-prs

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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 & Smoke finished, 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 under review.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:

  • The approval is pinned to the head SHA the dispatcher read.
  • If the head commit is the bot's own, the bot does not approve. It dismisses any earlier approval of its own and comments once per head. The PR then waits for the author's @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.
  • A push of the author's own on top of a bot commit counts as vouching for it.
  • approve from anyone else, or on anyone else's PR, is refused. On a draft, it is ignored until the PR is ready.
  • If the head commit can't be read, or GitHub resolves its author to nobody, nothing is approved.

approve is excluded from the mentions that fire address-review.

2. claude-workflow is armed like the product repos

The loopMayNotMerge list is now empty. CI gains the merge_group trigger, 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

  1. Merge this PR (claude-workflow's ruleset still requires 0 approvals).
  2. Then update the claude-workflow ruleset: 1 approval, required check test, merge queue. Also enable allow_auto_merge on the repo.

Applying the ruleset first would stall the queue, because the merge_group trigger would not exist yet.

Between the two steps every green PR here is armed for auto-merge, and GitHub refuses it while allow_auto_merge is 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-review over the branch (required for ^dispatcher/): one High finding — a vouch covering a relay commit landed after it — fixed in 3db3d30 with a test that fails without it. Nothing else found; the report walked route's comment gating, evaluatePr's outside-PR return, apply's two writes, and the merge_group and pull_request_target workflows.

🤖 Generated with Claude Code

Ardnived and others added 2 commits November 17, 2026 11:31
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 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
  • 18:41Z address-review · attempt 1 · session · done
  • 18:41Z address-review · attempt 1 · session
  • 18:32Z review-pr · attempt 1 · session · done
  • 18:32Z review-pr · attempt 1 · session

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

@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 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 — approve is 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

Comment thread dispatcher/decide.mjs Resolved
Comment thread dispatcher/decide.mjs Resolved
Comment thread loop-config.json 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
`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
@sydevs-bot

Copy link
Copy Markdown
Contributor

Adopted — the head-author guard fails open. !s.headAuthor joins the unread-head guard in fbb7088, so an author GitHub resolves to nobody holds the approval.

Adopted — the rollout window. Rollout order now names the refused armings, each a handback comment and an Awaiting status.

Rebutted — approve duplicates a vouching push. A push moves the head, so CI and the queue re-run for a commit that adds nothing.

Also fixed: the security review found the vouch covered a relay commit landed after it, approving code you never saw. 3db3d30 measures the vouch from the bot's ask instead.

Gates green. Commits wait on claude/relay-271-a34fb75.

🤖 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 moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 17, 2026
@Ardnived
Ardnived merged commit cfc5d5e into main Nov 17, 2026
7 checks passed
@Ardnived
Ardnived deleted the feat/proxy-approve-owner-prs branch November 17, 2026 20:16
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 17, 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