Repository navigation
feat(state): assign the bot to its own PR, once, at open - #53
Merged
Merged
Conversation
Rungs find the loop's PRs with `author:<bot>`, so nothing reads a PR's assignee when the bot wrote it, and nothing wrote it either. That was defensible and it read as broken: a queue of PRs with no owner, in a UI where every other row has one. The state machine now calls `assignBot` on `pull_request: opened`, for the bot's own PRs only. `assignBot` mirrors `unassignBot` — it reads the current assignees and returns early when the bot is already there, so it is idempotent like every other writer here. Assigning a PR fires `pull_request: assigned`, which no caller subscribes to, so it cannot recurse. The failure this prevents, and the reason for `opened` alone: on a PR the bot did NOT write, the assignee means the opposite thing — a human handing the loop that work — and removing it is the kill switch. Re-asserting the assignment on `reopened` or `synchronize` would undo a deliberate removal on the author's next push, and a kill switch that holds only until the next push is not a kill switch. `opened` fires once in a PR's life, which is the only safe place for this write. `preflight`'s delegated-PR query is `is:pr is:open assignee:<bot> -author:<bot>`, so the bot's own PRs stay out of it. Three skills stated the old rule as an absolute, one of them in Hard rules. Each is narrowed rather than deleted: the loop still writes no PR assignee in either direction, and no rung may start reading the new one, or authorship and assignment become two answers to one question. rule-delta: 57 -> 57 directives, 1 reworded, none dropped. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This was referenced Sep 5, 2026
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
Rungs find the loop's PRs with
author:<bot>, so nothing reads a PR's assignee when the bot wroteit — and nothing wrote it either. That was defensible and it read as broken: a queue of PRs with no
owner, in a UI where every other row has one.
state-machine.ymlnow calls a newassignBotonpull_request: opened, for the bot's own PRs:assignBotmirrors the existingunassignBot— it reads current assignees and returns early whenthe bot is already there, so it is idempotent like every other writer in this file. Assigning a PR
fires
pull_request: assigned, which no caller subscribes to, so it cannot recurse.The failure this prevents — and why
openedaloneOn a PR the bot did not write, the assignee means the opposite thing: a human handing the loop
that work, with removal as the kill switch (
preflight,triage-issue). Re-asserting theassignment on
reopenedorsynchronizewould undo a deliberate removal on the author's next push— and a kill switch that holds only until the next push is not a kill switch.
openedfires exactly once in a PR's life. That is the only safe place for this write, and theguard says so in the code, in the helper's comment, and in
docs/why.md.preflight's delegated-PR query isis:pr is:open assignee:<bot> -author:<bot>, so the bot's ownPRs stay out of it — verified in the checklist below.
The doctrine change
Three skills stated the old rule as an absolute, one in
Hard rules. Each is narrowed, notdeleted — the loop still writes no PR assignee in either direction, and no rung may start reading
the new one, or authorship and assignment become two answers to one question:
triage-issuebaton + hard ruleopened." Surface table splitsPR, oursfromPR, someone else'spreflightnever-write tableImplemented"finalize-prstep 7 + hard ruledocs/why.mdgains A PR's assignee is a record, never a signal, cited fromtriage-issue.rule-delta.mjs --base main: 57 → 57 directives, 1 reworded, none dropped.Version bumped 0.2.2 → 0.2.3 — the cache key, per cb46fca.
Verification
Not testable before merge: for
pull_request_targetGitHub always runs the workflow from thedefault branch. After merging, from a PR authored by
sydevs-bot(one authored by a humancorrectly gets nothing):
Stacked behind #52, which touches the same file in a different region.
🤖 Generated with Claude Code