Skip to content

fix(dispatcher): only FORBIDDEN is a refusal by type; clean status and auto-merge-off by their words - #222

Merged
Ardnived merged 4 commits into
mainfrom
claude/handover-forbidden-only
Oct 28, 2026
Merged

Ardnived merged 4 commits into
mainfrom
claude/handover-forbidden-only

Conversation

@Ardnived

@Ardnived Ardnived commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Failure prevented: #218 made handOver treat any GraphQL UNPROCESSABLE as GitHub refusing a write, and hand the step to a person. But UNPROCESSABLE is also GitHub's answer to invalid input, such as a wrong node id or a bad enum. Those are dispatcher bugs, and today they are quietly handed over as "cannot …" instead of failing the job. This PR keeps bugs loud.

What changes:

  • handOver counts only FORBIDDEN as a refusal by type.
  • The bare e?.status === 422 goes with it. 422 is the REST spelling of the same invalid input, so a Hold Until field id that does not exist, or an assignment.reviewer nobody can request a review from, throws instead of posting "cannot …" to a person who cannot fix it.
  • The two real refusals that arrive as UNPROCESSABLE are recognised by GitHub's words, like every other refusal:
    • "in clean status": arming a PR that could merge at once (SahajAtlasWeb#340);
    • "not allowed for this repository": auto-merge is switched off for the repo.
  • A wrong node id still throws. A permission still answers 403 on every path, and a branch rule's 422 is still caught by its words.
  • docs/why.md: the hand-over anchor carries the rule — only FORBIDDEN by type, every other refusal by its words — for both transports, and the stacked-PR section points to it, telling SahajAtlasWeb#340 once.

Provenance: the first two commits are the two from #219 still worth having (originally ed03d9b and b7bdd82, by the run that answered #218's review), cherry-picked onto main. #219 was closed because #221 superseded its other three commits. One of those would have run conflict and CI repair on stacked PRs, contrary to "nothing runs on a stacked PR". The last two answer this PR's own adversarial review.

Validation: node --test dispatcher/test/*.test.mjs workflow/lib/*.test.mjs passes 447/447. The assertions in lifecycle.test.mjs cover a clean-status refusal handed over, auto-merge-off handed over, an unmatched FORBIDDEN handed over, a wrong node id thrown, a REST 403 handed over, and a REST 422 thrown. The REST test fails without the apply.mjs change. No skill or config change, so the plugin version is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjX5JEB4FeoyxC34V5k

web-flow and others added 2 commits October 28, 2026 10:02
…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
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 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

🤖 no session running

recent dispatches
  • 17:09Z address-review · attempt 1 · session · done
  • 17:09Z address-review · attempt 1 · session
  • 17:02Z review-pr · attempt 1 · session · done
  • 17:02Z 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 code change is four lines, the right size for the problem. UNPROCESSABLE really does carry both a refusal and a wrong node id, so narrowing the type test is the only way to keep a bug loud, and the two words beside it close the hole it opens. The pair belongs in one PR.

One thing undercuts it. e?.status === 422 is still in the same expression, and 422 is REST saying the same thing. Invalid input is loud on one path, silent on the other, and the new why.md paragraph asserts a rule its own neighbour breaks.

No measured refusal is lost. handOver wraps three GraphQL mutations, and the one recorded refusal among them — markPullRequestReadyForReview on SahajCloud#744 — came as FORBIDDEN, which still matches by type. Auto-merge-off has no recorded incident, but the narrowing is what exposes it.

Findings

  • should-fix — a REST 422 is the same invalid input, still handed over silently (dispatcher/apply.mjs:99).
  • consider — the #340 story is now told twice in docs/why.md (docs/why.md:1120).

What was checked

  • dispatcher/apply.mjs whole: all three handOver GraphQL mutations (transferIssue, markPullRequestReadyForReview, enablePullRequestAutoMerge) and its REST writes, for refusals the narrowed type test drops.
  • dispatcher/decide.mjs:535-555 — markReady is planned only under pr.draft, so an already-ready UNPROCESSABLE is a gather/apply race, not a path this opens. Not filed.
  • dispatcher/projects.mjs — board writes raise BoardUnreachable, never reach handOver, so Status is untouched.
  • docs/why.md 1085-1135 — the anchors this diff touches or cites.
  • Validation, from a worktree: node --test dispatcher/test/*.test.mjs workflow/lib/*.test.mjs → 446/446, as the body claims.
  • No ## Preview to open: this repo deploys by merge.
  • Reviewer profile read.

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


Generated by Claude Code

Comment thread dispatcher/apply.mjs Resolved
Comment thread docs/why.md 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
sydevs-bot and others added 2 commits October 28, 2026 17:13
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
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
@sydevs-bot

Copy link
Copy Markdown
Contributor

Both findings from the adversarial review are built.

  • should-fix — a REST 422 is the same invalid input: 2c9efb8 drops the bare e?.status === 422. Both REST writes under handOver answer 422 only to a bug — a Hold Until field id that does not exist, a reviewer login nobody can request a review from. A permission still answers 403, and a branch rule's 422 still matches by its words.
  • consider — #340 told twice: eb8c60b cuts the why.md paragraph to the rule. The incident stays in the stacked-PR section, which links here.

Security review ran — ^dispatcher/ matches — and found nothing: the diff adds no sink, and a throw can only skip a later write, never make one.

Lean gate green. node --test dispatcher/test/*.test.mjs workflow/lib/*.test.mjs → 447/447, and the new test fails without the apply.mjs change.

Body refreshed for the 422 line and the test count.

🤖 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
Ardnived merged commit 421c590 into main Oct 28, 2026
34 of 36 checks passed
@Ardnived
Ardnived deleted the claude/handover-forbidden-only branch October 28, 2026 17:33
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Oct 28, 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.

4 participants