Skip to content

fix(state): a PR opened non-draft never gets awaiting, so most loop PRs are invisible on the board #57

Closed

Description

@sydevs-bot

Four of the five loop PRs open this morning carried no awaiting label. This is the reason, and it is in our own source, not a dropped webhook.

Found by today's survey-routine reconciliation sweep, then confirmed against .github/workflows/state-machine.yml.

What is wrong

state-machine.yml:205-244 handles pull_request as one if / else if chain:

if (action === 'opened' && ours) await assignBot(n)

if ((action === 'opened' || action === 'reopened') && ours) {
  …                                    // closed-issue bookkeeping only
} else if (action === 'ready_for_review' && ours) {
  await setAwaiting(n, true, 'ready for review')   // :218
} else if (action === 'synchronize' && ours) {

setAwaiting(n, true, …) on :218 is the only place a PR gains awaiting at open. It runs on ready_for_review, and GitHub emits that action only on a draft → ready transition. A PR opened non-draft never emits it.

The chain makes it doubly unreachable: opened matches the first branch, so the ready_for_review arm cannot run for an opened PR whatever its draft state.

The evidence

PR Opened awaiting
SahajCloud#711 non-draft ❌
SahajCloud#712 non-draft ❌
SahajCloud#714 draft → ready ✅
claude-workflow#54 non-draft ❌
claude-workflow#55 non-draft ❌

#714 is the control: same repo, same author, same bot-only review state, and the one that took the draft → ready path.

What it costs

awaiting is the primary signal for human attention, and projects.url is a lens over it. A loop PR opened non-draft is therefore ready for review and invisible on the board.

This is not cosmetic. SahajCloud sat at wipCapPerRepo for two days with three PRs waiting, and journal #51 recorded "Nothing implementable for three runs" — while the three PRs holding the cap were unlabelled and so absent from the queue the reviewer reads.

Today's sweep corrected all four by hand. It is the only thing that would have noticed, and it runs once a night.

What to do

Set awaiting when the bot opens a non-draft PR. Keep the ready_for_review arm for the draft → ready path, which is still the finalize pipeline's route.

Roughly:

if (action === 'opened' && ours) {
  await assignBot(n)
  if (!pr.draft) await setAwaiting(n, true, 'opened ready for review')
}

pr.draft is already in scope on :205. setAwaiting is idempotent, so the draft → ready path is unaffected.

Verify

A non-draft PR opened by the bot gains awaiting within seconds, and a draft one does not until it is marked ready. Both paths land on the board exactly once.

⚠ One behaviour per PR. state-machine.yml reaches all five repos on the next event with no merge anywhere else, so this change ships alone.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions