Repository navigation
fix(state): label a non-draft PR awaiting at open - #59
Conversation
`setAwaiting(n, true, …)` on the `ready_for_review` arm was the only place a PR gained `awaiting` at open. GitHub emits `ready_for_review` only on a draft -> ready transition, so a PR opened non-draft never reached it. The `if` / `else if` chain made it doubly unreachable: `opened` matches the arm above, so the `ready_for_review` arm cannot run for an opened PR whatever its draft state. `awaiting` is the primary signal for human attention and the board is a lens over it, so a loop PR opened non-draft was ready for review and invisible to the reviewer. Four of the five loop PRs open on 2026-09-06 carried no label. SahajCloud sat at wipCapPerRepo for two days with three such PRs waiting. Set the label on `opened` instead, gated on `pr.draft`. `setAwaiting` reads the current labels first and returns early when they already match, so the draft -> ready path is unaffected. Closes #57 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XTcZqseu9xNXP1inapLV4q
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Holistic. Eleven lines, one file, one behaviour: the diff is exactly the size of #57, smuggles nothing in, and correctly declines the chain restructure. The evidence holds up — the harness reproduces the defect on origin/main and only on the targeted case, and the callers do subscribe pull_request_target: [opened, …], whose payload carries pull_request.draft. The open question is shape, not code. Under docs/why.md#draft-is-the-prs-baton a bot PR is never non-draft at opened, so this new arm is a backstop for a state the system forbids — and #57's own table is unexplained evidence that the finalize pipeline skipped the baton on four PRs out of five. Labelling the symptom removes the only visible sign of that.
Findings
should-fix— root cause vs symptom: why did those PRs open non-draft?finalize-pr/SKILL.md:231omitsdraft:truefrom the create template while :244 mandates it. (:218)consider—reopenedleaves the identical hole; its own PR, but name it. (:221)consider— the seven-line comment narrates the defect thatwhy: #57already holds. (:209)
What was checked
- #57 and the PR body against the diff:
git diff origin/main...origin/claude/fix-awaiting-on-open— 1 file, +11/−1,state-machine.ymlonly. state-machine.ymlread whole on both sides:setAwaiting's read-before-write (:86-96),assignBot(:152), and the fullopened/reopened/ready_for_review/synchronize/closedchain, plus the header's division of labour.- Callers, two of five: this repo's
.github/workflows/workflow-state.ymlandsydevs/SahajCloud's both subscribepull_request_target: [opened, reopened, ready_for_review, synchronize, closed]— theopenedreachability claim holds. - Consumer prose for staleness:
finalize-prsteps 7–9 and hard rules,preflight§"never write state the state machine owns",survey-routine's drift-sweep table,work-routinerungs 2/4/5,README:88-90,docs/why.md#draft-is-the-prs-baton. Nothing contradicts the change; the body's "docs: nothing stale" checks out. git log -S"Every PR opens as a draft"→ the draft-baton rule landed 2026-09-03 (#36), i.e. before the 2026-09-06 PRs #57 cites, so those four are deviations and not pre-rule history.- Reviewer profile: read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Addresses the review on #59. Seven comment lines for three code lines, four of them narrating the broken chain. The fact that outlives the incident is one: `ready_for_review` fires only on a draft -> ready transition. `why: #57` carries the rest, matching how the `synchronize` arm below already reads. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015PxdvGktTVasmM1TrVUwi2
|
Revised in
Neither is fixed here. Each is its own PR under this repo's one-behaviour rule, and this one is still the backstop worth landing — a PR with no 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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.
…, and relax the one-behaviour rule (#61) * fix(loop): pass draft:true when creating the PR `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. * fix(state): restore `awaiting` when a non-draft PR is reopened 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. * docs: make one-behaviour-per-PR a default, not a prohibition 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.
Summary
awaiting, so it was ready for review and invisible on the board.setAwaitingnow runs onopenedtoo, gated onpr.draft. The draft → ready path is unchanged.Changes
.github/workflows/state-machine.yml— theopenedarm assigns the bot and setsawaitingwhen the PR is not a draft.The failure this prevents
setAwaiting(n, true, …)on theready_for_reviewarm was the only place a PR gainedawaitingat open. GitHub emitsready_for_reviewonly on a draft → ready transition, so a PR opened non-draft never reached it. Theif/else ifchain made it doubly unreachable:openedmatches the arm above, so theready_for_reviewarm cannot run for an opened PR whatever its draft state.awaitingis the primary signal for human attention and the board is a lens over it. Four of the five loop PRs open on 2026-09-06 carried no label (#57 has the table). SahajCloud sat atwipCapPerRepofor two days with three such PRs waiting, while journal #51 recorded "Nothing implementable for three runs".This is a backstop. Two follow-ups it does not fix
Review raised both. Each is its own PR under this repo's one-behaviour rule, and neither belongs here.
1. A loop PR should not be opening non-draft at all.
finalize-pr/SKILL.md:244states it as an invariant — "Every PR opens as a draft, without exception" — anddocs/why.md#draft-is-the-prs-batonis why. So #57's table is also evidence that the pipeline skipped the baton on 4 of 5 PRs, three days after that rule landed (#36, 2026-09-03). One verified suspect: the create template atfinalize-pr/SKILL.md:231omitsdraft:true, whilecreate_pull_requesttakes that boolean and the prose 13 lines below mandates it.That matters beyond bookkeeping: with this fix in, a PR born ready puts
awaitingin the reviewer's queue atopened, before CI has run — the exact state the baton exists to prevent. Invisible is still worse than premature, so this lands; the create template is the real repair.2.
reopenedleaves the identical hole, one line down.closedremovesawaiting(:246) and nothing restores it, so a reopened non-draft PR is again ready for review and absent from the board. That arm also clears the linked ticket'sawaitingon reopen (:225), so after a reopen neither item carries the signal. Today the nightly drift sweep is the only thing that would notice.Test results
claude plugin validate ./workflow --strictgithub-scriptbody passesnode --checkwhen wrapped asactions/github-scriptwraps it.origin/mainand on this branch:origin/mainawaitingawaitingawaitingawaitingThe defect reproduces on
origin/mainand only on the case the fix targets. The three paths that must not change do not.securityReview.triggerPattern.0299d27only shortens a comment. YAML re-parsed and the validator re-run; no behaviour touched, so the harness table above still stands.Manual verification
awaitingappears within seconds.awaitinguntil it is marked ready.setAwaitingreads current labels first.Notes for reviewer
state-machine.yml@main, so merging changes behaviour in all five repos on their next event, with no merge anywhere else. One behaviour, shipped alone, per this repo's rule.pull_request_target: types: [opened, …], and that payload carriespull_request.draft.openedarm still falls through to the closed-issue bookkeeping below it — the secondifis untouched.Detail
Why not restructure the chain. Folding
ready_for_reviewinto a shared branch would be a second behaviour in the same PR. The two arms answer different questions — "is this ready now?" at open, and "did it just become ready?" on the transition — andsetAwaiting's read-before-write makes the overlap free.The harness is not committed. This repo has no test suite by design (
CLAUDE.md: the validator is the entire automated gate, because the skills are prose). Adding a lane for one workflow would be a second behaviour. The harness extracted thescript:body from each revision, wrapped it asactions/github-scriptdoes, and stubbedgithub.rest.issues,github.request,github.graphqlandcore.summary.Tool limitation hit.
/code-reviewran against the session's launch directory rather than this checkout and reported "not a git repository", so the review pass here was manual: reachability, event wiring, idempotency under the workflow's own re-trigger, and that no existing arm loses behaviour.Closes #57
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_015PxdvGktTVasmM1TrVUwi2