Skip to content

feat(loop)!: GitHub owns the merge, and five frictions it exposed - #98

Merged
Ardnived merged 5 commits into
mainfrom
claude/queue-and-fixes
Sep 15, 2026
Merged

Ardnived merged 5 commits into
mainfrom
claude/queue-and-fixes

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Eight frictions from a week of live running. Five commits, one behaviour each, each traceable to a specific item.

The merge model changes hands

The dispatcher no longer merges. At mark-ready it arms auto-merge — the first moment GitHub allows it, since auto-merge is refused on a draft and every bot PR opens as one. From there the repository ruleset decides and the merge queue rebases and tests before the PR lands.

Every condition the old gate enforced in code becomes a repository rule:

Was enforced in decide.mjs Becomes
approved by assignment.reviewer required_approving_review_count: 1
zero unresolved threads required_review_thread_resolution: true
green CI a required status check, CI only
loopMayNotMerge stays in code — GitHub cannot express "never here"

mergeVerdict leaves gather. merge-gate.mjs stays, because the dispatcher still needs to know CI is green before it marks a PR ready.

Railway is not a required check on purpose. Queued checks run on merge_group, and Railway builds PR previews, so requiring it would stall the queue permanently.

Three label and message bugs

  • SahajCloud#747 merged while a session held the lock. The session unlocked two minutes later, the unlock path found nothing to do, and called a merged PR the human's turn. It never checked the PR was open.
  • SahajCloud#780 carried awaiting at 08:23:07 and blocked at 08:23:09. A parked ticket waits on its blocker, not on you. blocked now removes awaiting everywhere it is applied.
  • The hand-over comment blamed the token for every refusal, which is why #750, #757 and #767 were merged by hand with no explanation. It now quotes GitHub verbatim and names nothing, and catches 405 and 422 as well as 403 — a protected branch answers with those, and a refusal that threw took the rest of the plan with it.

The queue owns staleness

resolve-conflicts and address-review stop merging main in to keep a branch fresh. The queue rebases, so being behind costs nothing. Acting anyway is what produced three conflict essays on #769 inside twenty-five minutes, two of them about conflicts that existed only because other bot PRs had landed meanwhile. resolve-conflicts now runs only when GitHub reports the PR conflicting, and reports in a line.

Preview links that work

"Preview URLs are discovered, never constructed" was right about Cloudflare and wrong as a rule. Cloudflare keys on a truncated branch slug, which can collide. Railway keys on the pull request number — eight SahajCloud PRs with eight unrelated branch names gave eight hosts differing only in the number.

A number cannot collide, so the host is known when the PR opens, and the session writes real deep links to the pages a reviewer should open. That replaces the "preview pending" that never resolved, because push-and-end means nobody returns to fill it in.

A proposal is reviewed before you read it

A ticket the loop files is now revised on issues.opened: open questions answered from the code, the plan argued with, the body rewritten. A ticket you file is left alone. Costs about three Opus sessions a day; dispatch.reviewProposals turns it off.

Rule delta

Six directives added, one removed: preflight's Never merge without all three. Its three conditions are now the ruleset, and what replaces it is narrower and truer — never merge. Adjudicated deliberately.

Test results

node --test dispatcher/test/*.test.mjs — 75 pass, five new: a merged PR is nobody's turn, a ticket born blocked never carries awaiting, a ready PR is armed rather than merged, claude-workflow is never armed, and mark-ready precedes arming because GitHub refuses auto-merge on a draft. claude plugin validate --strict passes.

Not in this PR

Code-comment density, which another session is handling. The repository settings and rulesets, which I apply directly, and merge_group in each product repo's CI, which ships as one PR per repo so its own run proves it.

Ardnived and others added 5 commits September 15, 2026 12:56
Three label and message bugs, each traced to a specific item.

SahajCloud#747 merged while a session held the lock. The session unlocked
two minutes later, the unlock path ran evaluatePr, got back only Done,
called the item idle and added `awaiting` to a merged PR. It never checked
the PR was still open.

SahajCloud#780 got `awaiting` at 08:23:07 and `blocked` at 08:23:09.
issues.opened added both because the blocked branch never removed the first.
A parked ticket waits on its blocker, not on you.

And the hand-over comment blamed the dispatch token for every refusal, which
is why three merges failed with no usable explanation. It now quotes what
GitHub actually said, and catches 405 and 422 as well as 403 — a branch rule
refusing a merge reads nothing like a missing scope.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The dispatcher no longer merges. At mark-ready it arms auto-merge, which is
the first moment GitHub allows it — auto-merge is refused on a draft, and
every bot PR opens as one. From there the ruleset decides: one approval,
every review thread resolved, CI green, then the merge queue rebases and
tests before it lands.

Every condition the old gate enforced in code is now a repository rule, so
mergeVerdict is gone from gather. What could not be expressed as a rule
stays here: claude-workflow is never armed, because merging it is the
deploy.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…re you read it

Two changes the merge queue makes possible.

resolve-conflicts and address-review stop merging `main` in to keep a branch
fresh. The queue rebases every PR before it lands, so being behind costs
nothing, and acting anyway is what produced three conflict essays on
SahajCloud#769 inside twenty-five minutes. resolve-conflicts now runs only
when GitHub reports the PR conflicting, and reports in a line.

A ticket the loop files is now revised before a human reads it: the open
questions answered from the code, the plan argued with, the body rewritten.
A ticket you file is yours and is left alone. dispatch.reviewProposals turns
it off.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
"Preview URLs are discovered, never constructed" was right about Cloudflare
and wrong as a general rule. Cloudflare names a preview after a truncated
branch slug, which can collide. Railway names one after the pull request
number: eight SahajCloud PRs with eight unrelated branch names produced eight
hosts differing only in the number.

A number cannot collide, so the host is known the moment the PR exists — and
the session writes real deep links to the pages a reviewer should open,
instead of the "preview pending" that never resolved because push-and-end
means nobody returns.

The rule is now about the key, not the platform. previewUrl.pattern in a
repo's .claude/workflow.json is how a repo says which kind it has.

docs/why.md also gains the stories behind the four commits on this branch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Merge authority was stated in four places — preflight, finalize-pr, README
and AGENTS — as a rule the loop enforced. GitHub enforces it now, so those
become one statement of where it lives, not four copies of a gate.

The one removed directive is preflight's "Never merge without all three".
Its three conditions are now a repository ruleset: one approval, resolved
threads, green CI. What replaces it is narrower and truer — never merge.

Every repo gets outputStyle concise in .claude/settings.json, which is the
only place the loop can state it: the routine config lives on another
account. handler-preflight's register section says the same thing in the
form a budget can check, so the two cannot drift apart.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 138d613 into main Sep 15, 2026
4 checks passed
@Ardnived
Ardnived deleted the claude/queue-and-fixes branch September 15, 2026 20:19
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 15, 2026
Ardnived pushed a commit that referenced this pull request Oct 7, 2026
…reason (#161)

* fix(loop): the base-merge rule rests on the trigger, not on a queue four repos have

Two of the seven dangling `docs/why.md` anchors were cited from `workflow/skills/`,
so each cited rule's only statement was its own one-line rationale. One of those
rationales was false.

`resolve-conflicts` and `address-review` both forbade merging the base branch in,
and both gave the merge queue as the whole reason: "the queue rebases before it
lands, so being behind costs nothing." The queue covers four repos. This one has
no queue and no CI at all. The rule was right and its reason was not portable.

Both now rest on ownership, which needs no per-repo knowledge: the base ref
belongs to a trigger, not to a session's judgement. `dispatcher/decide.mjs` fires
`resolve-conflicts` only on a non-draft PR GitHub reports `CONFLICTING`, and that
is the one state in which merging a base is anyone's job. `address-review` also
reaches a behind-but-mergeable PR, and it was merging anyway.

Both skills also say inline when a base merge is allowed, keyed on that state
rather than on a handler name - `finalize-pr` step 8 instructs one too, on the
same `CONFLICTING` condition. `address-review` adds that a reviewer asking in a
thread does not change it, which is what both skills already did
unconditionally. The ticket's open question about the `@sydevs-bot` channel is
recorded as open rather than decided here.

`## Staleness is not yours, conflicts are` replaces the cited
`the-queue-owns-staleness-you-own-conflicts`, because that title names the queue
as the rule's owner and the entry's own argument withdraws it. The three
citations are retargeted, except the comment-brevity rule at
`resolve-conflicts/SKILL.md:42`: that pointer was dangling on main, and the new
entry does not tell its story, so it is dropped rather than aimed somewhere it
does not belong. The imperative survives inline.

The entry keeps the recoverable cost - three conflict essays on one PR in
twenty-five minutes - and records that the `synchronize` re-flag it used to cite
is dead in `dispatcher/decide.mjs`.

`## Construct a number, discover a slug` keeps its slug exactly, because
SahajCloud's `previewUrl.$comment` cites it across repos. It sits beside its pair
and writes only the half that pair does not: why a unique key and a truncated one
fail in opposite directions. `finalize-pr/SKILL.md` keeps the mechanism, as the
sibling entry twenty lines up already says it does.

The manifest version is bumped because two skill bodies changed, and the install
cache is keyed on it (`docs/why.md#an-installed-plugin-does-not-track-main`).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01862uUBQgqktfXgU3N92Kjq

* docs(loop): the five why.md stories #98 cited and never wrote

The remaining five dangling anchors, all cited from outside
`workflow/skills/` - `README.md`, `loop-config.json` and three in
`dispatcher/`. Same defect as the two in the previous commit, one level out.

#98 is the single origin of all seven. It added every citation and never
touched `docs/why.md`, though its own message says "docs/why.md also gains
the stories behind the four commits on this branch." `git show 138d613
--stat` lists fifteen files and `docs/why.md` is not among them.

So every story here is recovered from that commit's message and checked
against the current tree, not invented:

- **GitHub owns the merge** - the dispatcher's old merge verdict failed three
  ways, each already a heading, and all three were bugs in re-deriving what
  the ruleset computes. Arming is the one write left. Scoped the queue clause
  to the four repos that have one, since `README.md:120` points the public
  at this entry and `claude-workflow` has neither queue nor CI.
- **blocked and awaiting are exclusive** - SahajCloud#780 carried both, two
  seconds apart, from one `issues.opened` plan.
- **A closed item is nobody's turn** - SahajCloud#747 merged under a held
  lock, and the unlock path's idle test inverts on a closed PR.
- **A proposal is reviewed before you read it** - the only one of the seven
  with no recorded incident. Rather than invent a failure, it uses this
  ticket: #160 was filed naming two dangling anchors and its revision found
  seven, because the filing's own check searched `workflow/skills` only.
- **Quote the refusal, do not name a cause** - the hand-over comment blamed
  the token for every refusal, and three merges failed with no usable
  explanation.

No dispatcher file is touched. The ticket expected some citations to need
retargeting into `dispatcher/` comments; all five stories turned out to be
recoverable, so the headings are written and the comments stand as they are.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01862uUBQgqktfXgU3N92Kjq

* fix(docs): a behind PR's cost is its preview

The cost claim in `Staleness is not yours, conflicts are` said a preview and
a CI run both build the branch head, and cited `A conflicted PR schedules
zero CI runs` for it. That entry says the opposite: it explains the zero by
there being no computable merge commit, and names non-Actions deploys as the
things that build the branch head. Actions CI builds the merge ref, so a
behind-but-mergeable PR's CI already has the base.

A story contradicting the entry it cites is the defect class this PR exists
to close, so the half that does not survive its own citation goes. The
preview carries the point alone, and the citation now supports what it is
cited for.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GBffGzrToa6yGEHqgk4ANU

---------

Co-authored-by: Claude <[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.

1 participant