Skip to content

fix(dispatcher): only FORBIDDEN is a refusal by type - #219

Closed
sydevs-bot wants to merge 6 commits into
mainfrom
claude/fix-218-review-asks
Closed

sydevs-bot wants to merge 6 commits into
mainfrom
claude/fix-218-review-asks

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Change outline

Behaviour — what handOver reads as a refusal

UNPROCESSABLE is GitHub calling the input invalid, which a wrong node id or a bad enum also
answers. Under #218's test any such bug was handed over quietly. Narrowing the type test leaves the
message regex as the whole net for every other GraphQL refusal, so each one is listed by its words.

 handOver(what, fn)                               dispatcher/apply.mjs
   catch e
-    refused = errors[].type is FORBIDDEN or UNPROCESSABLE
+    refused = errors[].type is FORBIDDEN            # a permission we lack
     denied = refused or status 403/405/422
-      or message matches not accessible | FORBIDDEN | protected branch | …
+      or message matches … | in clean status                  # SahajAtlasWeb#340
+      or message matches … | not allowed for this repository  # auto-merge off, a repo setting
     not denied → throw                              # a bug stays loud

docs/why.md carries the story under the hand-over anchor, where it belongs, and the stacked
section's closing sentence now points there instead of restating a rule that changed.

What the merge dropped

#221 made the loop refuse stacked PRs outright: evaluatePr stops one with a single comment and
runs nothing on it, and prStatus reads it Awaiting at the top, above the producer wait. This
PR's arm sat at the bottom, for an approved PR only, so it became unreachable. Its predicate
stacked is byte-identical to #221's stackedPr.

So the merge takes main whole for that half: the arm, the export, and its test in
status.test.mjs are removed. That test's other two assertions — that a conflict or red CI on a
stacked PR is still the machinery's to repair, and that a producer wait outranks the stacked
Awaiting — are false under #221, which repairs nothing on a stacked PR at all.
relay.test.mjs covers the behaviour that replaced it.

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict, then node --test workflow/lib/*.test.mjs — 97 passed
  • Targeted specs: node --test dispatcher/test/*.test.mjs — 349 passed
  • Build: N/A

Manual verification

  1. On the next arming refusal in any repo, check the hand-over comment quotes GitHub's words and the job does not die.

Notes for reviewer

  • The message regex is now the only net for a GraphQL refusal that is not FORBIDDEN. why.md
    says every refusal the narrowed type test drops is owed its wording there, so the list is
    maintained rather than guessed.
  • No skill, hook or loop-config.json change in this PR's own diff, so no plugin version bump is
    owed by it. feat(loop): a relay instead of patch comments, and no stacked PRs #221's bump comes in with the merge.
  • Security review ran (the diff touches dispatcher/): no findings. It traced all five handOver
    call sites and every payload they carry.
Detail

The run that built this PR's commits held the lock on #218 and was answering its review when #218
was merged to main as f5d1365. Those commits were written against bf9bf05, then re-applied
onto origin/main.

Both halves of the handOver change are tested through apply in lifecycle.test.mjs, since the
GraphQL error carries no HTTP status and the closure is not exported: a clean-status refusal is
handed over, auto-merge-off is handed over, a FORBIDDEN type with an unmatched message is handed
over, and a wrong node id throws.


🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjVvHDgjginfrKPtg2X

web-flow and others added 3 commits October 28, 2026 05:32
…owed

#218 made `mayArm` false for a PR based on another branch, but left the
Status derivation with arms for only the other two reasons. An approved
stacked PR fell through to `approved — auto-merge is owed` with a due, so
the reconciler checked it three times and then handed it back as overdue.
The crash was fixed; the item still landed on a desk under a wrong reason.

The predicate is now `stacked`, exported from decide.mjs and read by both
`evaluateGreenPr` and `prStatus`, which derives Awaiting — merging it into
its parent is the reviewer's. A conflict or red CI still comes first, since
both are the machinery's to repair on a stacked PR too.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXjPgRiz8KDn92pQ7B
…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
#218 told the GraphQL hand-over story in the last three lines of
`#a-stacked-pr-is-never-armed`. A reader meets that surprise under
`#a-write-we-cannot-make-is-handed-over-not-thrown`, directly below, which
is where the rest of it already lives. Moved, and rewritten to the narrowed
test: FORBIDDEN by type, the clean-status refusal by its words.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXjPgRiz8KDn92pQ7B
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 28, 2026
@sydevs-bot

sydevs-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 16:46Z resolve-conflicts · attempt 1 · session · done
  • 16:46Z resolve-conflicts · attempt 1 · session
  • 05:39Z address-review · attempt 1 · session · done
  • 05:39Z address-review · attempt 1 · session
  • 05:33Z review-pr · attempt 1 · session · done

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

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

This is #218's three asks and nothing else: one commit each, a test each, and the prose moved rather than rewritten. Exporting stacked so evaluateGreenPr and prStatus read one definition is the right shape — the bug was two readers of one rule.

Two things to settle. The new prStatus arm sits above the producer-wait arm, so an approved stacked PR in a cross-repo set reads as yours to merge now. And narrowing handOver's type test is correct about bugs, but leaves one message regex carrying every other GraphQL refusal — and a repo with auto-merge off is not in it.

No contract surface is touched, and no skill, hook or loop-config.json change, so the body is right that no version bump is owed.

Findings

  • should-fix — the stacked arm preempts the producer wait: dispatcher/status.mjs:105
  • should-fix — a repo with auto-merge off throws instead of handing over: dispatcher/apply.mjs:99

What was checked

  • Read whole: status.mjs, decide.mjs (stacked, evaluateGreenPr, MOVES), apply.mjs handOver and its five call sites, both new tests, and both docs/why.md sections.
  • gather.mjs:309 builds base from one full pulls.get, so the defaultBranch fail-open is unreachable for both readers — checked, not taken on the body's word.
  • #218's three threads, each against the commit claiming it.
  • claude plugin validate ./workflow --strict and node --test workflow/lib/*.test.mjs — 97 pass. node --test dispatcher/test/*.test.mjs — 335 pass, as claimed.
  • No ## Preview link, and none owed here.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread dispatcher/status.mjs Resolved
Comment thread dispatcher/apply.mjs 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 Oct 28, 2026
prStatus derived the stacked arm above the linkedBlockedOpen arm, so an
approved stacked PR in a cross-repo set read `merging it into <base> is
yours` while its producer was still open. The producer wait left the
board, and the reviewer was told to merge first.

Both arms are non-due, so the order is the whole fix: the wait holds
until the producer closes, and the next pass derives the stacked
Awaiting.

Answers #219 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjY7RW2WNvcYA2dV7DF
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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both review findings adopted, one commit each, pushed as b7bdd82.

Nothing rebutted, nothing asked. The branch was already level with origin/main, so no base merge. Lean gate ✓ (97), dispatcher/test/* 335 ✓, security review no findings. Body refreshed: the outline's two diff sketches were false after both commits.

🤖 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 Oct 28, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 28, 2026 05:50
@sydevs-bot
sydevs-bot requested a review from Ardnived October 28, 2026 05:50
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Oct 28, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 28, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Oct 28, 2026
#221 answered this PR's stacked finding more completely than this PR did, so
the stacked half is dropped and main's kept. Only the handOver narrowing
remains.

- decide.mjs, status.mjs: main's `stackedPr`. It is byte-identical to this
  PR's `stacked`, and #221 stops a stacked PR in `evaluatePr` and reads it
  Awaiting at the top of `prStatus`, above the producer wait. This PR's arm
  sat at the bottom, for an approved PR only, so it is now unreachable.
- status.test.mjs: the arm's test goes with it. Its other two assertions —
  that a conflict or red CI on a stacked PR is still the machinery's, and
  that a producer wait outranks it — are false under #221, which runs
  nothing on a stacked PR at all. relay.test.mjs covers the new arm.
- why.md: main's "A stacked PR is never armed" section, with its closing
  sentence pointed at the hand-over anchor. `handOver` no longer reads
  `UNPROCESSABLE` as a refusal, so that sentence was stale as merged.
- apply.mjs and its lifecycle.test.mjs merged clean and are untouched.

Gate: claude plugin validate --strict ✓, workflow/lib 97 ✓,
dispatcher/test 349 ✓.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVvHDgjginfrKPtg2X
@sydevs-bot sydevs-bot changed the title fix(dispatcher): a stacked PR is Awaiting, and only FORBIDDEN is a refusal by type fix(dispatcher): only FORBIDDEN is a refusal by type Oct 28, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main (9c7a111) in as 9014ec8. Three hunks conflicted, and all three took main.

#221 answered this PR's stacked finding while it sat here, and answered it wider: a stacked PR now
runs nothing at all, and reads Awaiting at the top of prStatus. This PR's arm sat at the
bottom, for an approved PR only, so main's reaches every stacked PR first. Unreachable, so
dropped — with its export, byte-identical to main's stackedPr, and its test.

That test also asserted a conflict or red CI on a stacked PR is still the machinery's, and that a
producer wait outranks the stacked Awaiting. #221 repairs nothing on a stacked PR, so both are now
false. relay.test.mjs covers what replaced them.

The hunk not taken whole: main's stacked section in why.md ends by saying handOver reads
errors[].type. This PR narrows that to FORBIDDEN, so the sentence now points at the hand-over
anchor instead.

What is left of this PR is the handOver narrowing alone. The title and body say so now.

🤖 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 Oct 28, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Oct 28, 2026
@Ardnived

Copy link
Copy Markdown
Contributor

Closing: #221 superseded the stacked-PR commits (b6757d6, 3892f94, and the stacked parts of 6cc1f30). #221 stops a stacked PR before anything runs, so the 'stacked last' ordering here no longer applies. The two refusal commits (ed03d9b, b7bdd82) are worth keeping and move to a clean PR on main.

@Ardnived Ardnived closed this Oct 28, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Oct 28, 2026
Ardnived added a commit that referenced this pull request Oct 28, 2026
…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]>
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.

4 participants