Skip to content

feat(loop): a relay instead of patch comments, and no stacked PRs - #221

Merged
Ardnived merged 4 commits into
mainfrom
claude/relay-no-stack
Oct 28, 2026
Merged

Ardnived merged 4 commits into
mainfrom
claude/relay-no-stack

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Failures this prevents

What changes (one commit per behaviour, each revertable on its own)

  1. a0c4b08 feat(dispatcher): the relay.
    • Every session fired at a PR now 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 fully works;
      • none: a fork, or a PR the loop only answers.
    • A relay session pushes to claude/relay-<pr>-<shortsha> and asks with sydevs-request {relay: {branch, head, sha}}.
    • On the unlock, decide checks the request against the PR as gathered now: open, same repo, full treatment, relay route, this PR's prefix, this PR's head branch.
    • apply checks the relay ref's sha, then fast-forwards the head branch (force: false). If the member pushed in the meantime, it does a server-side merge instead.
    • A conflict, a relay ref that moved or is missing, or a refused write (e.g. a workflow-scope 422) is handed back with GitHub's own wording. The relay branch is kept, so nothing is lost.
  2. 2543d77 fix(dispatcher): a stacked PR is handed back, and nothing runs on it.
  3. a1080bf feat(loop): skills push where flags.push says, and never stack.
    • The one rule lives in start-run, which every session reads.
    • address-review's author-keyed "A human's PR" stacked-PR section is replaced by one that keys on the branch.
    • resolve-conflicts loses its patch-in-a-comment fallback.
    • fix-ci pushes by route.
    • finalize-pr loses its base:<branch> parameter.
    • Plugin 5.0.0 → 5.1.0.
  4. 0d3409d docs.
    • New why.md anchors: #the-branch-decides-where-a-session-pushes and #the-relay.
    • #a-stacked-pr-is-never-armed keeps its heading but is rewritten for its new reason.
    • #you-cannot-push-to-a-humans-pr is retired.
    • README and routine-setup updated, including the PAT's Workflows permission for relays that touch .github/workflows/.

Why one PR: the user chose to ship it as one. The relay is how the branch-keyed push rule reaches member branches, and dropping stacked PRs removes the only other path address-review had. Splitting would leave one behaviour without the other.

Validation

  • node --test dispatcher/test/*.test.mjs workflow/lib/*.test.mjs: 445 pass, 0 fail. New dispatcher/test/relay.test.mjs (15 tests):
    • a fast-forward lands;
    • a non-fast-forward falls back to a merge;
    • a conflict is handed back and the branch kept;
    • a workflow-scope refusal is quoted, with no merge attempted;
    • a relay ref that moved or is missing is refused;
    • a 5xx isn't swallowed;
    • the route is keyed on branch: feat(dispatcher): run fix-ci and resolve-conflicts on a Sonnet lane #318's shape is direct, member and Copilot branches are relay, outsiders and forks are none;
    • a request is refused for a bad branch name, a different PR's prefix, a head mismatch, a foreign author, a fork, or a closed PR;
    • the request's shape is checked;
    • an unlock lands a valid relay and nothing else;
    • a refused relay hands the PR back, naming its branch;
    • a stale request is ignored;
    • every PR fire carries push;
    • a stacked PR fires nothing on unlock, sweep, CI or a mention, is never armed, and shows Awaiting.
  • claude plugin validate ./workflow --strict: passed.
  • rule-delta.mjs --base origin/main workflow/skills: 88 → 89 directives, none removed. Added: "Never open a PR based on another PR's branch." The stacked-PR steps were procedure, not counted directives. Their replacement is the start-run rule.
  • Read-only replay against all 12 open PRs (old decide/deriveStatus from main vs this branch, same snapshot): 0 differ in plan or Status, apart from the new push flag on fires (e.g. address-review[push=direct] on SahajCloud#1044).

Needs a person: confirm SYDEVS_BOT_PAT has Workflows: write if relays should be able to touch .github/workflows/. Without it, those relays are handed back with GitHub's refusal, and every other relay works.

🤖 Generated with Claude Code

Ardnived and others added 4 commits October 28, 2026 09:41
…nnot 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]>
#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]>
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]>
… 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]>
@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
  • 16:45Z review-pr · attempt 1 · session · done
  • 16:45Z review-pr · attempt 1 · session

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

@Ardnived
Ardnived merged commit 9c7a111 into main Oct 28, 2026
6 checks passed
@Ardnived
Ardnived deleted the claude/relay-no-stack branch October 28, 2026 16:45
@sydevs-bot sydevs-bot moved this from Working to Done in SYDevelopers Technical Roadmap Oct 28, 2026
@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 pushed a commit that referenced this pull request 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
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.

2 participants