Repository navigation
fix(dispatcher): never arm a stacked PR, and hand over a GraphQL refusal - #218
Conversation
The first full reconcile after the Status lifecycle (#217) failed on SahajAtlasWeb#340, a review-asks refactor stacked on #318's branch. The plan armed auto-merge; GitHub refused with a GraphQL UNPROCESSABLE ("Pull request is in clean status"), which carries no HTTP status, so handOver rethrew it and the pass died before syncStatus. #340 was left with an empty Status, and every sweep would fail the same way. Two changes: - A PR whose base is not the default branch is never armed. Its base has no ruleset, so arming would merge an unreviewed change the moment it went green; the reviewer's merge is the gate, and the parent carries it to main. gather now records base.defaultBranch for this. - handOver treats a GraphQL FORBIDDEN or UNPROCESSABLE as a refusal, so any other refused mutation is handed to a person instead of crashing the job. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Both changes trace to the one SahajAtlasWeb#340 failure, and neither is bigger than it: 27 lines, no new abstraction, no refactor beside it. The guard pays rent — #340 carried no Blocked by line, so waitsOn never covered it, and s.repo holds no default branch, so pr.base.defaultBranch is its only source.
The gap is the half not changed. decide now has a third reason not to arm, and status.mjs has an arm for the other two and none for this one. So a stacked PR goes green, gets approved, derives approved — auto-merge is owed, and is handed back as overdue three checks later. The crash is fixed. The item still lands on your desk with a wrong reason.
Also: the two behaviours arrived in one commit. CLAUDE.md asks for one commit each when related changes ship together, and here the only rollback is a PR.
Findings
should-fix— the Status derivation has no stacked arm, so a stacked PR is handed back as overdue.dispatcher/decide.mjs:525.consider—UNPROCESSABLEin the denied set hands a bug over instead of throwing.dispatcher/apply.mjs:95.consider— the new anchor carries the hand-over story too.docs/why.md:1112.
What was checked
node --test dispatcher/test/*.test.mjsonbf9bf05from a worktree: 333/333, as the body claims.- Every
armAutoMergesite —decide.mjs:532and:552, both behindmayArm. No other arm path. gatherbuildss.pronce, fromrest.pulls.get(gather.mjs:274), which carriesbase.repo.default_branch. The|| nullfail-open only arms where that call omits the field, and it does not.status.mjs:95-105andstatus.test.mjs:86-87— the arms and the tests for the other twomayArmreasons.- No skill, hook or
loop-config.jsonchange, so no pluginversionbump is owed. - Reviewer profile read. No preview deploy here, no CI.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
This PR merged at 05:26Z while the run held the lock, so its three review findings land in #219 instead, one commit each. Adopted
Nothing rebutted, nothing asked. The review's note about two behaviours in one commit is answered by the split above. #219 is a draft against 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
* feat(dispatcher): a relay lands a session's commits on a branch it cannot push to A cloud session pushes only to `claude/*`, and member PRs are mostly on their own branches (fix/*, feat/*, copilot/*). The design that gave member PRs the full loop fell back to posting a patch in a comment for those, which puts the work back on the person. And address-review keyed "can I push" on the PR's author, not its branch, so on Ardnived's #318, whose branch is `claude/feat-147-submit-a-class`, it opened stacked #340 instead of pushing. Now every session fired at a PR carries `flags.push`, decided by the head branch alone: - `direct`: a `claude/*` branch in this repo, whoever wrote the PR - `relay`: another branch in this repo, on a PR the loop works in full - `none`: a fork, or a PR the loop only answers A relay session pushes to `claude/relay-<pr>-<shortsha>` and asks in a `sydevs-request` `{relay: {branch, head, sha}}`. On the unlock, decide checks the request against the PR as gathered now (open, same repo, full treatment, a relay-route branch, this PR's relay prefix, the PR's own head) and apply moves the head branch: a fast-forward (never forced), else a server-side merge when the member pushed meanwhile. A conflict, a moved or missing relay ref, or a write the token may not make (a workflow-scope refusal) is handed back in GitHub's words, and the relay branch is kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(dispatcher): a stacked PR is handed back, and nothing runs on it #218 stopped arming a stacked PR and reasoned that its review was the gate. But the loop should not stack at all: a stacked PR's base has no ruleset, so it needs two reviews merged in order, the parent's squash and branch deletion retarget it with the parent's commits back in its diff, and it contradicts "a change you ask for on a PR is built on that PR". #340 was the only one in recent history, and it was a mistake (address-review keyed on author, not branch). So a PR whose base is not the default branch now reads Awaiting with one comment (merge it into its base, or retarget it), and fires nothing: no critic, no fix-ci, no resolve-conflicts, no address-review on a mention. #218's never-arm check stays behind that, as the guard: armed, GitHub would merge it unreviewed once its checks passed. #218's GraphQL-refusal hand-over is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(loop): sessions push where flags.push says, and never stack a PR The rule for where a session may push now lives once, in start-run, and reads the route the dispatcher computed from the head branch: `direct` pushes, `relay` pushes to `claude/relay-<pr>-<sha>` and asks for it in a `sydevs-request`, `none` pushes nothing and describes a change in words. - address-review: its "A human's PR" section keyed on the PR's author and opened a stacked PR, which is how #340 came to sit on #318's `claude/*` branch. It now builds every ask on the PR itself whenever the route allows, and only answers threads when it is `none`. - resolve-conflicts: the patch-in-a-comment fallback for a branch outside `claude/*` is gone; that branch goes through the relay. - fix-ci: pushes by the route too. - finalize-pr: the `base:<branch>` parameter, which only a stacked PR used, is gone. A PR is always based on the default branch. - start-run: "Never open a PR based on another PR's branch." Plugin 5.0.0 → 5.1.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(loop): the branch decides where a session pushes, the relay, and no stacking - why.md: two new entries, "The branch decides where a session pushes" and "The relay". "A stacked PR is never armed" keeps its heading and is rewritten for the reason it now guards: the loop does not stack, and armed, a stacked PR would merge unreviewed. "You cannot push to a human's PR" moves to Retired with what replaced it. "A member's PR gets the loop" no longer promises a patch in a comment. - README: anyone else's PR gets answers and no code; a member's own branch is reached through the relay, and they pull before their next push. - routine-setup: the troubleshooting row, and the PAT's Workflows write a relay touching `.github/workflows/` needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…d auto-merge-off by their words (#222) * fix(dispatcher): only FORBIDDEN is a refusal by type; a clean status by words #218 put UNPROCESSABLE in the GraphQL type test. That type is GitHub saying the input was invalid, which also covers a wrong node id or a bad enum — a bug in our own mutation. Under the wide test any such bug would be handed over quietly, and a loud job is how we find one. So the type test keeps FORBIDDEN alone, a permission we do not hold, and the refusal actually seen on SahajAtlasWeb#340 is matched by its words: `in clean status` joins the message regex. The GraphQL error carries no HTTP status either way, so both halves are tested through `apply`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXjPgRiz8KDn92pQ7B * fix(dispatcher): auto-merge off is a refusal, not a bug Narrowing the type test to FORBIDDEN left one message regex as the only net for every other GraphQL refusal, and a repository with auto-merge switched off is not in it: `UNPROCESSABLE`, "Pull request Auto merge is not allowed for this repository". That threw, and the pass died before syncStatus — on a repo setting, not a bug. Adds `not allowed for this repository` to the words, with a test through `apply`, and says in why.md that every refusal the narrowed type test drops is owed its wording there. Answers #219 (comment) Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY7RW2WNvcYA2dV7DF * docs(loop): the hand-over rule, told once The new paragraph retold SahajAtlasWeb#340 — the clean-status refusal and the missing HTTP status — four lines below the stacked-PR section that already tells it, and that now links here. One incident told twice leaves the next reader reconciling two accounts of it. What is left is the rule: only FORBIDDEN by type, every other refusal by GitHub's words, and invalid input still throws. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5JEB4FeoyxC34V5k * fix(dispatcher): a REST 422 is invalid input, not a refusal 422 is the REST spelling of the GraphQL UNPROCESSABLE this PR just stopped trusting, and it sat in the same expression. Invalid input was loud on one transport and silent on the other, so the rule the why.md paragraph states was broken by its own neighbour. Both REST writes under handOver answer 422 only to a bug: `set Hold Until` with a field id that does not exist, and `request a reviewer` with a login nobody can request a review from — an `assignment.reviewer` typo. Each was posted as "cannot …" and handed to a person who cannot fix it. A permission on either path answers 403, which still hands over, and a branch rule's 422 is still caught by its words. The bare 422 was never a measured refusal: it arrived with 403 and 405 when handOver was introduced (d041272), wrapping no merge call. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5JEB4FeoyxC34V5k --------- Co-authored-by: sydevs-bot <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: sydevs-bot <[email protected]>
Failure prevented: the first full reconcile after #217 failed on SahajAtlasWeb#340. That PR is stacked on #318's branch (
claude/feat-147-submit-a-class). The plan armed auto-merge, and GitHub refused with a GraphQLUNPROCESSABLE("Pull request is in clean status"). That error carries no HTTP status, sohandOverrethrew it. The job died beforesyncStatus, which left #340 with an empty Status. Every sweep would fail the same way.Changes:
mainunder the ruleset.gathernow recordsbase.defaultBranch.handOvertreats a GraphQLFORBIDDEN/UNPROCESSABLEas a refusal. Any other refused mutation is handed to a person instead of crashing the job.docs/why.md#a-stacked-pr-is-never-armed.Validation:
node --test dispatcher/test/*.test.mjspasses 333/333, including the new stacked-PR test. No skill changed, so the plugin version is unchanged.🤖 Generated with Claude Code