Repository navigation
feat(dispatcher): approve a contract sync that matches its source - #280
Conversation
A contract-sync PR has one correct content, yet each waited on the owner's approval: the ruleset needs one, and sydevs-bot cannot approve its own PR. A new contracts-verify job in dispatcher.yml re-runs the consumer's contractSync command on its own main and compares the result with the PR head. A byte-for-byte match on a ready bot PR that changes nothing but the copy is approved with the consumer's own token, as github-actions[bot], pinned to that head. Nothing from the PR executes: the head is only fetched and diffed. The verdict is posted as the contractSync.verifyContext commit status, as sydevs-bot so it wakes the dispatcher. decide asks the reviewer only on a failure or error verdict, never at a contract-only sync's mark-ready; the status is read only from the bot and kept out of CI, and the job's own check run joins ci.ignoreCheckNames. Needs every caller to grant pull-requests: write on its dispatch job first: a reusable job asking for more than its caller grants fails the whole run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is right, and narrower than #279: only a job in the consumer's own event can approve the bot's PR, the callers stay thin, and decide keeps the reviewer request. The re-derivation earns its cost — the gate alone would pass the one hand edit this has actually seen (WeMeditateWeb#292). The diff is the size of that problem. One gap: it withdraws the reviewer request on the strength of an approval the body itself says is unverified.
Findings
- should-fix —
dispatcher/decide.mjs:663: asuccessor missing verdict asks nobody, and mark-ready no longer asks either. If the ruleset does not count thegithub-actions[bot]approval, a sync stalls silently and so does the next. - should-fix — PR body, ⚠ Rollout order: "Those PRs are linked below" links nothing. Four of the five caller grants live in other repos; only #281 is reachable from here, and the merge order is the one thing a reader must get right.
- consider —
.github/workflows/dispatcher.yml:370: a runner starts on everyclaude/*PR event in five repos, though the gate only ever passes one branch.
What was checked
contracts.mjs and dispatcher.yml whole, decide.mjs (evaluateGreenPr, route), the gather status filter, loop-config.json, this repo's workflow-state.yml, and the why.md anchor. Ladder on the six new functions and the job: no repo or platform equivalent — Actions has no job-level step reuse, and why.md rules out a ruleset bypass. node --test on the branch: 386 and 143 pass, as claimed. Not raised: no pnpm install, and pnpm/action-setup on a consumer with no pnpm, both of which mirror contracts-sync as it runs today.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
From #279's run, which was superseded before it could land this. Its branch security review found that the contract check never dismisses its own approval: a head the gate later refuses still carries the approval of an earlier one, with auto-merge armed and no reviewer asked. Filed as #282, with a fix and tests on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
contracts-verify re-ran the consumer's sync command and diffed the result: a checkout, pnpm and node per sync PR, the same code from the same main as contracts-sync, and a false mismatch whenever the producer moved between the two runs. contracts-sync now posts contractSync.attestContext on each commit it pushes to the sync branch, as sydevs-bot. contracts-verify is one script step: on that status event, or a PR event on the sync branch, it approves a ready contract-only bot PR into main whose head carries the bot's status, with the consumer's token, and explicitly dismisses its own earlier approval when the head carries none (#282). decide asks the reviewer when the PR outgrows the copy, the sync did not write its head, GitHub's reviewDecision shows the ruleset does not count the check's approval, or a vouched-for head is still unapproved after contractSync.approveWithinMinutes, so a check that never runs cannot stall a sync silently. The verdict status, its CI filter and the three-state mapping are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs/claude-workflow#280 adds a contracts-verify job that approves a contract-sync PR matching its source, with this repo's own token. A reusable job asking for more than its caller grants fails the whole dispatcher run, so this grant must merge before #280. Unused until then. Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs/claude-workflow#280 adds a contracts-verify job that approves a contract-sync PR matching its source, with this repo's own token. A reusable job asking for more than its caller grants fails the whole dispatcher run, so this grant must merge before #280. Unused until then. Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs/claude-workflow#280 adds a contracts-verify job that approves a contract-sync PR matching its source, with this repo's own token. A reusable job asking for more than its caller grants fails the whole dispatcher run, so this grant must merge before #280. Unused until then. Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs/claude-workflow#280 adds a contracts-verify job that approves a contract-sync PR matching its source, with this repo's own token. A reusable job asking for more than its caller grants fails the whole dispatcher run, so this grant must merge before #280. Unused until then. Co-authored-by: Claude Opus 5.5 <[email protected]>
#280 adds a contracts-verify job that approves a contract-sync PR matching its source, with this repo's own token. A reusable job asking for more than its caller grants fails the whole dispatcher run, so this grant must merge before #280. Unused until then. Co-authored-by: Claude Opus 5.5 <[email protected]>
|
Nothing pushed —
Branch security review on Gates on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
contracts-syncvouches for what it writes. After each push tocontractSync.branch, it posts the commit statussydevs / contract-sync(contractSync.attestContext) on that commit, as sydevs-bot. The job already ran the consumer's command onmainand wrote exactly those bytes.contracts-verifyis one script step indispatcher.yml. It runs on that status event, or on a PR event on the sync branch. It approves a ready, same-repo bot PR into the default branch that changes only the copy'spaths, but only when the head carries the bot's status. The approval uses the consumer's own token, asgithub-actions[bot], pinned to that head. The dispatcher already arms auto-merge at mark-ready, so the merge queue runs CI and merges.decidealone asks the reviewer, never at a contract-only sync's mark-ready. It asks when:reviewDecisionshows the ruleset doesn't count the check's approval;contractSync.approveWithinMinutes(30), meaning the check failed or never ran. The sweeper catches this one.The first commit re-ran the sync command in the consumer and diffed the result. The second removes that: no consumer checkout, pnpm or node, no verdict status, no CI filter, and no false mismatch when SahajCloud
mainmoves between the sync and the check.Failure this prevents
Every contract-sync PR (17 of the 32 small bot merges in the eight weeks to 2026-10-20) waited on the owner's approval, though it has one correct content. sydevs/WeMeditateWeb#292 sat
BLOCKEDwith green CI and auto-merge armed. TheapproveWithinMinutesandreviewDecisionasks also close the gap the critic raised: if the approval is refused or doesn't count, the PR would otherwise stall silently.Safety
dismiss_stale_reviews_on_pushis on today, but the guarantee doesn't depend on it.⚠ Rollout order
All five callers must grant
pull-requests: writeon theirdispatchjob before this merges. A reusable job asking for more than its caller grants fails the whole dispatcher run in that repo. Merge these first, in any order:A sync PR already open when this merges carries no status, so it is asked for review as before. That includes sydevs/WeMeditateWeb#292, whose head is a hand edit anyway.
Test results
node --test dispatcher/test/*.test.mjs: 385 pass, 0 fail. The tests cover:decideasks in each of the four cases, waits inside the window, and stays quiet once approved and countedreviewDecisionnode --test workflow/lib/*.test.mjs: 143 pass.dispatcher.ymlparses. It hasn't run end to end. The first sync after rollout is the supervised check.Closes #282.
🤖 Generated with Claude Code