Skip to content

fix(loop): find our PRs by authorship, and read hasWorkflows off disk - #37

Merged
Ardnived merged 1 commit into
mainfrom
claude/fix-pr-discovery-and-workflows
Sep 3, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/fix-pr-discovery-and-workflows

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Two corrections to #36, both learned from watching the first real runs.

1. A PR is ours because we wrote it, not because it is assigned to us.

#36 made assignee:<bot> the gate for PRs as well as tickets. That forced a migration — every PR open at cutover needed the bot added by hand — and left all three carrying two assignees, yours and the bot's, with the field meaning two things at once.

author:<bot> was the answer already sitting there: exact, indexed, no write, no migration. The loop now sets no PR assignee at all, on creation or after.

That frees the field for the one thing it could not express before, and it points the other way:

Assigning sydevs-bot to a PR it did not write is how you hand that PR over. Unassigning withdraws it.

preflight gains a second, disjoint query (assignee:<bot> -author:<bot>) for exactly that case. Tickets are unchanged — assignment is still their queue and still your kill switch.

Shape Query
Merge is:pr is:open author:<bot> draft:false review:approved
Revise is:pr is:open author:<bot> updated:>=<last-run>
Crash residue is:pr is:open author:<bot> draft:true
Review is:pr is:open author:<bot> draft:false -reviewed-by:<bot>
Delegated to us is:pr is:open assignee:<bot> -author:<bot>

2. hasWorkflows is a filesystem check, not an API call.

mcp__github__list_workflows is not in the routine's MCP build. Four consecutive runs journalled its absence under ⚠️ Failed — every time for a fact sitting on disk. Every repo in repos is cloned into the run before Claude starts, so ls .github/workflows/*.yml answers it exactly, for free, and cannot 403.

The general rule, now in why.md: when the run already holds the checkout, read the checkout.

The failure was harmless — an absent hasWorkflows reads as this repo has CI, so the gate stayed closed rather than opening — but a recurring ⚠️ Failed line trains a reader to skim the one section that exists to be read.

Not changed, deliberately

The survey-vs-journal weekday mismatch the nightly run reported. At the real cron time (0 8 * * *) UTC and Vancouver agree year-round — 08:00Z is 01:00 PDT and 00:00 PST, the same weekday either way. It diverged only because I fired that run by hand at 04:19Z. Verified for both DST and standard time.

Test results

  • ✓ claude plugin validate ./workflow --strict
  • ✓ No is:pr … assignee: query remains except the intended delegation one
  • ✓ Every (why: docs/why.md#…) citation resolves

Manual verification

  1. The three open PRs still carry sydevs-bot as a leftover assignee from feat(fields): ticket state is a Stage field; a PR's state is its draft flag #36's migration — I am removing it after this merges, so the field starts clean.
  2. Next run's journal: ⚠️ Failed should no longer carry the list_workflows line, and the 👀 rows should still list #676, #679 and #681 — now found by author rather than assignment.

🤖 Generated with Claude Code

Two corrections to #36, both from watching the first real runs.

**A PR is ours because we wrote it.** #36 made `assignee:<bot>` the gate for
PRs as well as tickets, which forced a migration — every PR open at cutover had
to have the bot added — and left all three carrying two assignees, the
reviewer's and ours, with the field meaning two things at once. `author:<bot>`
was the answer already sitting there: exact, indexed, no write, no migration.

So the loop now writes no PR assignee at all, on creation or after. That frees
the field for the one thing it could not express before, pointing the other way:
**assigning the bot to a PR it did not write is how a human hands one over**,
and unassigning withdraws it. Preflight gains a second, disjoint PR query
(`assignee:<bot> -author:<bot>`) for exactly that case. Tickets are unchanged —
assignment is still their queue.

**hasWorkflows is a filesystem check.** `mcp__github__list_workflows` is not in
the routine's MCP build; four consecutive runs journalled its absence under
⚠️ Failed, every time for a fact sitting on disk. Every repo in `repos` is
cloned into the run before Claude starts, so `.github/workflows/*.yml` answers
it exactly, for free, and cannot 403. The general rule, now in why.md: when the
run already holds the checkout, read the checkout.

The failure was harmless — an absent hasWorkflows reads as "this repo has CI",
so the gate stayed closed — but a recurring ⚠️ Failed line trains a reader to
skim the section that exists to be read.

Not changed: the survey-vs-journal weekday mismatch reported last night. At the
real cron time (`0 8 * * *`) UTC and Vancouver agree year-round — 08:00Z is
01:00 PDT and 00:00 PST, the same weekday either way. It diverged only because
the run was fired by hand at 04:19Z.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 201e538 into main Sep 3, 2026
@Ardnived
Ardnived deleted the claude/fix-pr-discovery-and-workflows branch September 3, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant