Repository navigation
fix(controller): skip draft pull requests when labelling - #1195
Merged
Merged
Conversation
The cron labels every open PR, so a draft that nobody asked to review yet picked up `agent-pr` and `risk:T*` and sat in the review queue. `read_prs` already receives the pull list, which carries `draft`; it now records the field, and `plan` skips a draft with reason `draft` in the existing `skipped` shape, so the plan JSON gains no key and `apply` is unchanged. A skip is no add and no remove, so a draft keeps the labels it has; `hold` is still checked first. `draft: false` PRs are labelled exactly as before. AGENTS.md said the controller labels "open PRs"; it now says "open non-draft PRs", the one clause this change makes stale. Refs #1192
Collaborator
|
Review (Birfy) Tip SHA: 83bae39
|
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.
Fixes #1192.
What changed
.github/scripts/controller.py:read_prsrecordsdraftfrom the pull list it already fetches — no extra API request.planskips a draft PR right afterhold, with reasondraftin the existingskippedshape:{"number": n, "label": "*", "reason": "draft"}. A skip is no add and no remove, so a draft keeps the labels it already has;holdis still checked first, so an operator-held draft reportshold.plan()still returns{"ops", "skipped", "notes"},renderprints the entry as- #20?: draft,validate_planandapplysee exactly today's plan.applyis unchanged, so a PR converted to draft between plan and apply can still take one round of labels; that window is a recorded known gap, not fixed here.AGENTS.md: the controller paragraph now says "open non-draft PRs" instead of "open PRs" — the one clause this change makes stale.changelog.d/1192-draft-skip.md:Fixed.Why this is live, not hypothetical
Run
44773778580(event: pull_request,created_at 2026-11-20T16:28:42Z,head_sha cd5a608b…) was#1194's ownopenedevent executing that branch's new trigger with main's script. Itsplanjob reported "4 operation(s), 0 skipped" (16:28:54Z) andapplysucceeded; the labels landed as#1194agent-pr+risk:T3from16:29:04Zand the parked draft#1191risk:T2at16:29:05Z,agent-prat16:29:06Z— no cron, no dispatch. Once#1187merges, everyopened/ready_for_review/reopenedfires that full pass, so skipping drafts inplanis what keeps a parked draft out of the queue.Red first at
050235a4Clean worktree at
050235a4with only the new test file copied in (git status --short→?? tests/test_process_controller_draft.py):test_read_prs_records_the_draft_flag_it_already_fetches—KeyError: 'draft': the base record has no such field.test_a_draft_pr_is_skipped_and_keeps_the_labels_it_has— baseplan()for adraft: truePR returnsadd risk:T2+add agent-prwithskipped: [].test_a_ready_pr_next_to_it_is_labelled_normally— the same ops appear beside thedraft: falsecontrol row, which must stay untouched.test_the_draft_reason_needs_no_new_plan_key_and_renders— the base renders| PR #30 | add | risk:T2 | risk-tier |where the skip belongs.The one pass is the
holdcontrol, which must hold before and after.At this tip: 144 passed in the ten-file focused set;
python -m tools.changelog_fragments check→ 7 fragments OK. Full offline suite on the pre-rebase tree (b64388b0, identical diff): 7940 passed, 32 failed, 29 skipped — the same 32 environment rows red at the base (15test_era_*without numpy in the sandbox runner, 12test_sandbox_containerwithout a Docker daemon, 2test_integrations,test_genesis_example::test_a_shared_toolchain_directory_is_not_mounted,test_merge_golden,test_test_package_resolution).Tip SHA: 83bae39
Ran:
test_process_controller,test_process_controller_draft,test_controller,test_workflow_actions_pinned,test_process_labels,test_process_risk_gate,test_process_review_gate,test_process_merge_lane_base,test_changelog_fragments,test_safety_controller) at this tip → 144 passedpython -m tools.changelog_fragments check→ 7 changelog fragment(s) OKb64388b0, the same diff before the rebase onto050235a4→ 7940 passed, 32 failed, 29 skipped, the same 32 ids red at the baseNot run:
b64388b0onto050235a4; the focused set was re-run at the tipmkdocs build --strict— nodocs/ormkdocs.ymlchangeNo UI surface: the controller script, its tests, and one clause in AGENTS.md.