fix(pr-status): make --watch usable on a draft PR - #238
Merged
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
CybotTM
force-pushed
the
fix/pr-status-draft-watch
branch
2 times, most recently
from
August 26, 2026 09:40
ce91209 to
17c348e
Compare
CybotTM
marked this pull request as ready for review
August 26, 2026 09:40
Draft sat near the top of the NEXT ladder and always answered ready, masking conflicts, red checks and open threads on a deliberately parked PR; ready itself was missing from ACTIONABLE, so the watch could neither return on it nor hold through it — --ignore-action refused the name and the loop heartbeated waiting: draft into the timeout. The back-to-draft-on-resume convention (#227) and the watcher were mutually exclusive. Draft now ranks below the real-work branches and above the review and merge advice, mirroring the queue-entry placement: a red check or an open thread surfaces normally, checks actually running report wait (the watch holds), and everything else answers ready — which is ACTIONABLE now, so the watch returns on it and --ignore-action can hold through it. checks_settled is deliberately not the gate for ready: it demands at least one registered context and zero undispatched required ones, which a draft often cannot satisfy (workflows that skip drafts or trigger on ready_for_review, fork runs awaiting approval) — the review round caught that gating on it left ready unreachable there, an endless wait of the very shape this commit removes. investigate joins ACTIONABLE too: it is the terminal check-branch-protection-manually verdict on settled checks, and a watch that heartbeats on it idles into the timeout on a state waiting cannot change (observed 2026-08-26 on #226, where classic-protection CodeQL contexts kept mergeState BLOCKED for over an hour of waiting lines). tests/test_pr_status_draft_watch.sh pins the ladder against a stubbed gh (hold on running checks; return on a thread, a red check, ready; ready reachable with zero registered checks and with a never-dispatched required context; plain status names a red check instead of ready) and pins the action vocabulary against every action literal the script emits. Watched failing against the respective pre-fix states: 9 assertions on the original script, 5 more on the version before the checks_settled correction. Closes #228. Assisted-by: claude-code:claude-fable-5 Agent-Session: https://claude.ai/code/session_01C7S9rbgu5giqCwnzwafrHA Agent-Host: 0493f0 Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
CybotTM
force-pushed
the
fix/pr-status-draft-watch
branch
from
August 26, 2026 09:42
17c348e to
3320d13
Compare
|
Member
Author
|
Self-review: 3320d13 The review this pull request demands is unsatisfiable (Copilot quota wall or repeated bot failures on this head). Per the documented fallback, the diff on this head was reviewed by the PR author; this comment is the on-the-record attestation the merge gate reads back. It stops matching on the next push. |
Merged
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.



Closes #228.
The issue's proposed fix was not enough, so this goes one step further. Adding
readyto the--ignore-actionallowlist (the issue's ask) would have made the flag accepted but the watch still useless:draftsat near the top of the NEXT ladder, so on a parked PR every poll answeredreadyand a red check, an open thread, or a conflict could never surface — with or without the flag. The ladder placement is the actual defect.Change.
draftnow ranks below the real-work branches (conflicts, stale base, red checks, open threads) and above the review/merge advice, mirroring the queue-entry placement and its rationale. Checks actually running reportwait— the watch holds and returns on the first real event. Everything else answersready, now in ACTIONABLE: the watch returns handing overgh pr ready, and--ignore-action readytakes the name (on a settled draft that return is labelledSETTLEDper the #165 semantics). This makes the back-to-draft-on-resume convention (#227) and--watchcompatible; the reference now says so.Review round caught a regression in the first cut, verified by the reviewer with a stubbed probe: gating
readyonchecks_settledleft it unreachable for a draft with zero registered check contexts or a never-dispatched required context (workflows that skip drafts or trigger onready_for_review, fork runs awaiting approval) — an endlesswaitof the very shape this PR removes.readyis now gated only on nothing actually running, and the why names undispatched required contexts when present.investigatejoins ACTIONABLE too — same family: it is the terminal check-branch-protection-manually verdict on settled checks, so a watch heartbeating on it idles into the timeout on a state that waiting cannot change. Observed on #226, where classic-protection CodeQL contexts keptmergeState=BLOCKEDthrough an hour ofwaiting:lines.rules-unavailablestays a heartbeat on purpose: an API blip can heal on the next poll, and--max-waitbounds the true-failure case. Known trade-off (reviewer-flagged, accepted): right after the last check greens, one poll can catchmergeStateStatusstill at BLOCKED and returninvestigatewhere the next poll would saymerge— a cheap exit-and-re-arm, preferred over the unbounded heartbeat.Tests.
tests/test_pr_status_draft_watch.sh(stubbedgh, no network) pins the ladder — hold on running checks; return on a thread, a red check, onready;readyreachable with zero registered checks and with a ghost required context; plain status names a red check instead ofready— and pins the action vocabulary: everyaction:"…"literal must be ACTIONABLE or a declared waiting heartbeat, and every ACTIONABLE entry must actually be emitted. Watched failing against the respective pre-fix states: 9 assertions red on the original script, 5 more on the version before thechecks_settledcorrection. Fulltests/*.shsuite green, shellcheck clean.Assisted by claude-code:claude-fable-5 — Session