Repository navigation
fix(state,loop): open the PR as a draft, restore awaiting on reopen, and relax the one-behaviour rule - #61
Merged
Merged
Conversation
`finalize-pr/SKILL.md:232` is the only place the pipeline creates a PR, and its `create_pull_request` template omitted `draft`. The tool defaults to `false`, so every PR the loop opened was born ready for review — while the prose 13 lines below states the opposite as an invariant: "Every PR opens as a draft, without exception." Draft is the PR's baton (docs/why.md#draft-is-the-prs-baton). A PR born ready puts unfinished work in the reviewer's queue before CI has run, and makes the once-ever rung 5 review a moving target, because `draft:false` is what marks a PR as having been ready at least once. #57's table is the evidence: 4 of 5 loop PRs opened on 2026-09-06 were non-draft, three days after #36 landed the rule. #59 made those PRs visible on the board. This stops them being born ready in the first place. `version` bumped because a skill body changed and the cache key is the version (why: docs/why.md#an-installed-plugin-does-not-track-main). Follow-up 1 of 2 from #59.
The `closed` arm removes `awaiting` and nothing put it back, so a reopened non-draft PR was ready for review and invisible on the board — the same hole #59 closed one line up for `opened`. `ready_for_review` cannot cover it: GitHub emits that event only on a draft -> ready transition, and a reopened PR never transitions. It compounded. The `opened`/`reopened` arm below also clears the linked ticket's `awaiting` on reopen, on the grounds that the PR carries the signal now. It did not. After a reopen neither item carried it, and only the nightly drift sweep would have noticed. Widen the label gate to `reopened`, keeping the `!pr.draft` test. `assignBot` stays on `opened` alone — it is split out above rather than widened, because unassigning a PR is the kill switch for a delegated one, and re-adding on reopen would undo a deliberate removal. Follow-up 2 of 2 from #59.
The rule read as absolute in three places, and #61 hit it immediately: two follow-ups from #59, disjoint files, one commit each, and no reviewer benefit from splitting them into two rounds. What the rule is actually protecting is attribution — you cannot test a change here by running it, so when the next run behaves oddly you need to know which change caused it. One commit per behaviour gives that. A separate PR is a stronger form of the same guarantee, and it is not free: it costs a review round, and `wipCapPerRepo` bounds how many may be open at once. So the default stands and the prohibition goes, with one exception kept hard: a skill change and a ceiling change together. Those two move the next run's output in the same direction, so a combined PR is genuinely unattributable. reflect/SKILL.md:161 states that exception too, unchanged and still correct.
awaiting on reopenawaiting on reopen, and relax the one-behaviour rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both follow-ups #59 named and deliberately did not fix. #59 made a non-draft loop PR visible; these two stop it being born non-draft, and stop a reopen hiding it again.
finalize-pr's create template omitteddraft, so every loop PR opened ready for review — against the invariant stated 13 lines below it.reopenedhad the identical holeopenedhad, one line down:closedstripsawaitingand nothing restored it.Three commits, one per behaviour
CLAUDE.mdused to forbid this outright.7168345changes that: one behaviour per PR is now thedefault rather than a prohibition, with one exception kept hard — a skill change and a ceiling
change together, which is genuinely unattributable because you cannot re-run to find out which
one moved the output. These three are disjoint files with one commit each, so any of them reverts
alone.
Changes
dc29a0bworkflow/skills/finalize-pr/SKILL.md:232create_pull_requesttemplate gainsdraft:truedc29a0bworkflow/.claude-plugin/plugin.jsonversion0.2.4 → 0.2.5 — the cache key for a skill change53ef37b.github/workflows/state-machine.ymlreopened;assignBotsplits out and stays onopened7168345AGENTS.md(CLAUDE.mdis a symlink to it)1. The PR was born ready for review
finalize-pr/SKILL.md:232is the pipeline's only PR-creation site (grep -rn 'create_pull_request\|gh pr create' workflow/ docs/returns it and nothing else). Its template listedowner repo head base title bodyand nodraft. The tool defaults that boolean tofalse.So the prose 13 lines below — "Every PR opens as a draft, without exception" — was contradicted by the template a model actually copies. #57's table is the outcome: 4 of 5 loop PRs opened on 2026-09-06 were non-draft, three days after #36 landed the rule.
This matters more now that #59 is in. A PR born ready puts
awaitingin your queue atopened, before CI has run — the exact state the baton exists to prevent (docs/why.md#draft-is-the-prs-baton). Anddraft:falseis what marks a PR as having been ready at least once, which is what makes rung 5's once-ever review fire once.versionis bumped because a skill body changed and the cache directory is named after it (docs/why.md#an-installed-plugin-does-not-track-main).2. A reopened PR lost
awaitingand never got it backThe
closedarm removesawaiting. Nothing restored it, andready_for_reviewcannot: GitHub emits that event only on a draft → ready transition, and a reopened PR never transitions. So a reopened non-draft PR was ready for review and off the board.It compounded. The
opened/reopenedarm below also clears the linked ticket'sawaitingon reopen, on the grounds that the PR carries the signal now. It did not. After a reopen neither item carried it, and only the nightly drift sweep would have noticed.The fix widens the existing label gate to
reopened, keeping!pr.draft.assignBotis split out above rather than widened — unassigning a PR is the kill switch for a delegated one, so re-adding it on reopen would undo a deliberate removal. Its own doc comment ("Called ONLY onpull_request: opened… Never on reopened") stays true.All five callers already subscribe
pull_request_target: types: [opened, reopened, …], checked in each repo'sworkflow-state.yml. That payload carriespull_request.draft.Test results
claude plugin validate ./workflow --strictnode workflow/lib/rule-delta.mjs --base main workflow/skills→directives: 57 → 57, no directive disappeared.github-scriptbody passesnode --checkwhen wrapped asactions/github-scriptwraps it.origin/mainand on this branch:origin/mainawaitingawaitingawaitingawaitingawaitingawaitingsynchronize)One row changes, and it is the one targeted. The bot is assigned on
openedonly, on both revisions — reopen adds no assignee.Re-run with a linked ticket stubbed into
closingIssuesReferences, to prove the bookkeeping arm I moved code past is untouched:origin/mainImplemented, unassigned,-awaitingRevising,+awaitingsecurityReview.triggerPattern.finalize-pr's frontmatter is unchanged; the edit is one parameter inside a fenced example.docs/why.md#draft-is-the-prs-batonalready states both invariants correctly. Nothing stale — the defect was that the template disagreed with the docs, not that the docs were wrong.3. One behaviour per PR was a prohibition
Stated absolutely in three places in
AGENTS.md, and this PR hit it on the first try. What therule protects is attribution — a skill edit takes effect on the next run, never the current
one, so when that run behaves oddly you need to know which change caused it. One commit per
behaviour already gives that. A separate PR is a stronger form of the same guarantee and is not
free: it costs a review round, and
wipCapPerRepobounds how many may be open at once.The default stands, the prohibition goes, and the one case that is genuinely unattributable — a
skill change and a ceiling change together — stays forbidden.
reflect/SKILL.md:161states thatexception too, unchanged.
Manual verification
awaitingappears within seconds.Notes for reviewer
state-machine.yml@main, so merging changes behaviour in all five repos on their next event. The skill half reaches the routines on their next run.script:body from each revision, wraps it asactions/github-scriptdoes, and stubsgithub.rest.issues,github.rest.pulls,github.request,github.graphqlandcore.summary.awaitingat open #59's review asked for the durable fact only, so the new comment is three lines and defers the rest towhy: #57, matching thesynchronizearm below.