Skip to content

ci: watchdog tells a head pushed after the label to re-apply merge-ready - #10209

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/watchdog-dark-notice-10136
Oct 25, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/watchdog-dark-notice-10136

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Summary

  • Leftover 1 from ci: labeled PRs that conflict before or after the merge-ready label stay silent #10136. A merge-ready head with no qualification run that is not conflicting was pushed after the label, or lost its label event. Until now that showed only as a ::warning in the watchdog job log. The sweep now comments once per head (marker merge-ready-dark:<sha>) telling the author to remove and re-apply merge-ready.
  • Guards against a wrong notice: only when mergeability is computed (an unknown state may be a conflict), no required check on the head, no merge-ready run in flight, same-repo, non-draft, head unchanged since the list call. Dirty heads keep the conflict report instead.
  • Tests: told once, not re-told, covered/in-flight/uncomputed stay quiet. Sabotage (drop the unknown guard, drop the dedupe) fails them. Run-block budget 100 to 120, docs and a changelog fragment.

Source-of-truth Links

Governing issue or accepted claim: #10136 (leftover, closed; follow-up requested in the project thread)
Acceptance delta (one sentence): a push after the label produces an actionable PR comment, not only a log warning.

Proof

10 watchdog tests, check-workflows, readiness contract tests and cargo xtask precommit pass locally on b9afcf8. Live check after merge: dispatch the watchdog and read the sweep summary and any posted notice.


Generated by Claude Code

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 168 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 41096315-e4e2-4ba9-b414-f2ced523074e
Commits

Reviewing files that changed from the base of the PR and between feea378 and e07ee0c.

Files selected for processing: 5
  • .github/workflows/pr-staleness-watchdog.yml
  • changelog.d/10136-watchdog-re-apply-notice.md
  • docs/CI.md
  • policy/workflow_allowlist.txt
  • xtask/tests/pr_staleness_watchdog_conflicts.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

Review of record, head b187d54

Angles: false-positive and noise risk, then shell correctness and injection, by an independent read-only reviewer on b9afcf8; fixes re-verified on this head.

Findings and resolutions:

  • A finished run without the required check (admission refused, cancelled) was blamed on a push. Now the notice names the cause: no run exists, or a run finished without the check. Sabotage fails a test.
  • No grace window: a label applied moments before a sweep looked dropped. The sweep now stays quiet for 10 minutes after any PR activity (updated_at). Sabotage fails a test.
  • Test weakness: the covered and in-flight cases shared one run, so a covered-check regression was masked. They run separately now, plus new cases for a finished run, a fresh head, and a head that moved after the list call.
  • Noise on a PR that keeps the label across many pushes (one notice per dark head, at most one per sweep): left as is. Each dark head is a real blocked PR, and a per-PR cap would hide later ones.
  • A failed comment listing could repeat the notice (|| true after grep -c): inherited from the conflict report, left as is.
  • Injection: none; the marker holds only the hex SHA and bodies go through -f body=.

Local: 11 watchdog tests, check-workflows (budget 130) and precommit pass.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 25, 2026 04:40
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown
Member Author

Independent exact-head review: REPAIR_REQUIRED (source/oracle finding; no merge clearance).

[P2] Recheck the newly visible run's status before recommending a restart — .github/workflows/pr-staleness-watchdog.yml:151–158, notify_dark.
The first runs lookup can return no run while delivery is delayed. If a queued/in-progress merge-ready run becomes visible by the second lookup inside notify_dark, that lookup counts every matching run without examining status. It calls the active run “finished without the required check” and posts “Remove and re-apply merge-ready.” Following that advice cancels the live qualification (routed-rust.yml:26–32). This violates the documented in-flight preservation contract; the second lookup already has the information needed to avoid the notice.

Observed bounded discriminator: unchanged production workflow; fake-gh test fixture returns {"workflow_runs":[]} on the first runs lookup, then {"workflow_runs":[{"status":"in_progress","display_title":"Merge-ready request abc"}]} on the second. Expected zero comment writes; observed one comment with the incorrect “finished” cause and restart advice. Assertion failed with exit 101 (1 failed, 11 filtered). Fix direction: have the final pre-notice lookup distinguish active versus completed requests and suppress the notice when any matching request is active; add this delayed-visibility regression case (including queued). Confidence: high.

Binding (2026-10-25T04:52Z):

  • Base acb0f4da401e4fa299bfce9b8f72cd124947ffc6, base tree 211bedb2ed906ec254e5ba77d2983df59273a0e0.
  • Head b187d545071b0668891fbdd5654fb3f766b59c11, head tree f9e01d8f4c9cca332a96dc2ec4f6ca193102bac4; re-read unchanged before publication.
  • Isolated test-only experimental tree 055133114992837fca62f43a684b45968ce1793e; patch SHA-256 546ff6eba387977e94d8cf8850b5fa17d4608e3d1046c8cc96f594e9d22dcb7f. Production bytes unchanged; test edits restored and checkout clean.

Reconciliation: canonical writer remains the existing Claude author lane on claude/watchdog-dark-notice-10136 (EffortlessSteven). Reused review of record; no submitted reviews, inline threads, or requested reviewers were returned. Gemini/CodeRabbit quota receipts are missing provider review, not passing review. The late-visibility race above is distinct from the already documented comment-list failure limitation.

Evidence:

  • Passed, observed: all 11 submitted watchdog tests on the exact head; one additional isolated old-head-success/old-head-marker case still posts the current head's notice (no stale result/marker reuse). Compiled the dependency-free integration harness directly with the installed Rust 1.95.0 rustc --edition 2024 --test, CARGO_MANIFEST_DIR=<isolated checkout>/xtask; real Bash and jq execute the shipped workflow run block.
  • Reported/reused: current-head check-workflows, precommit and prior sabotage receipts in the review of record; not rerun.
  • Not established: unconditional exactly-once delivery when comment-history reads fail (already acknowledged in the prior review); hosted required-check completeness, actual live event behavior and final merge/integration clearance. Normal dedupe, fresh/unknown/moved-head and already-visible in-flight cases pass; this does not eliminate API races.
  • Inspected all five changed files, workflow permissions/serialization, head-scoped checks/run queries and label-request cancellation consumer. No implementation/author-branch edits, relabel, dispatch, CI trigger, Ready, or merge actions.

Canonical owner's next action: repair notify_dark in this same candidate, retain the delayed-visibility discriminator, then obtain fresh exact-head review of the changed behavior.

Copy link
Copy Markdown
Member Author

Confirmed and fixed (commit not yet pushed at the time of writing, pushing now). notify_dark now reads the request runs for the head once, with status, and returns without commenting when any request is active, so a run that becomes visible between the sweep's first look and the notice is left alone (re-applying the label would cancel it). Only a head with no active request gets a notice, and it names "no run" or "finished without the check" from that same read. New test: the first runs lookup is empty and the second returns an in_progress (and a queued) request; zero comments are written. Sabotage (dropping the active-request return) fails it. 12 watchdog tests, check-workflows and precommit pass locally. Re-labeling after the push for a fresh exact-head run.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Independent repair review of #10209: REPAIR_REQUIRED — comment-path race repaired; rendered summary still recommends restart.

[P2] Propagate late-active suppression into the sweep disposition — .github/workflows/pr-staleness-watchdog.yml, notify_dark active guard and its caller.
The repaired function correctly returns without posting when its final lookup finds an active request. It returns success, however, so the caller increments told and appends “re-apply notice posted” to the existing “DARK; needs merge-ready re-applied” disposition. With the retained delayed-visibility fixture, the actual row is:

| #31 | `00000000` | `clean` | DARK; needs merge-ready re-applied (`b31`); re-apply notice posted |

Both queued and in-progress cases write zero comments/statuses but produce that row. The audit table still advises the operator to reapply a label that would cancel the live run, and falsely claims a notice was posted. Fix direction: distinguish posted/already-known/now-active outcomes and update the caller's row/counts to reflect in-flight suppression; assert the rendered summary as well as absence of writes. Confidence: high.

Observed proof (bounded; no full qualification):

  • Passed: independently replayed the retained first-read-empty / second-read-active counterexample for queued and in_progress: exactly two run reads and zero comment/status writes, no cancellation.
  • Passed: submitted late-visible regression and three affected control tests (no-run/dedupe; completed cause/fresh/moved; covered/already-active/unknown). Each selected test exited 0; unrelated tests were filtered.
  • Passed: independent second-read-completed case posts exactly one notice with the finished-without-check cause, not the no-run cause.
  • Failed: independent late-active summary discriminator: zero comments verified, then assertion rejecting “needs merge-ready re-applied” failed, exit 101, 1 failed/12 filtered. This is an observed output defect, not an actual live cancellation.
  • Not verified: hosted check completeness, live event behavior, all post-read races, unconditional once-only behavior after comment-history failure, or combined ci: watchdog tells a head pushed after the label to re-apply merge-ready #10209/ci: watchdog retires a stale merge-ready conflict status #10219 qualification. Existing author check-workflows/precommit/sabotage receipt remains reported evidence.

Exact subject: base acb0f4da401e4fa299bfce9b8f72cd124947ffc6, base tree 211bedb2ed906ec254e5ba77d2983df59273a0e0; head f445f8adbb3a6d7ec6acef8c435b84ec5e59ba36, tree 3d0e1c7b02c7909ab0b608f54045d9ca4ab0499c, parent b187d545071b0668891fbdd5654fb3f766b59c11. Head/base re-read unchanged before publication (2026-10-25T05:22Z).

Independent positive replay test-only tree 74e32de2f46299c2c8dcfb1cbfecd72ebdeb29b2, patch SHA-256 a74375a76e051f82593063783ad0c3605b47a723955231c180646d1ba6b2f4c5; summary discriminator tree 0d27d68f4b47da9e4595e822df1baf78aa75fdff, patch SHA-256 57cac9b4ad547bf1e702c63bc092f62e67d06c16dff46ef723a87915f9f5ff82. Same installed Rust 1.95.0/direct dependency-free harness, real Bash/jq, unchanged production workflow. Test edits restored; checkout clean. No implementation, label, status, dispatch, Ready or merge writes.

Reconciled author repair receipt and prior exact-head review; no concurrent same-slice independent technical review or requested reviewer was visible. Canonical writer remains EffortlessSteven's Claude lane on claude/watchdog-dark-notice-10136.

Causal disposition/order: the original comment-path failure at b187d54 is superseded by passing exact-head proof on f445f8a; the summary consumer above remains unresolved. Canonical owner next action: repair that outcome propagation in #10209 and obtain fresh affected review. #10219's separate stale-admission retirement race stays with its existing writer; review its material correction/composition only after a supplied combined subject. Separate heads establish no combined qualification.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the changed tests validate per-case notice behavior but do not exercise multiple PRs with distinct run/comment responses in one sweep.
  • Confirm the test harness does not cover GitHub API pagination for issue comments or workflow runs, nor failure behavior when those paginated calls fail; the implementation relies on gh api semantics and shell error propagation.
  • Confirm the new notice is limited to computed mergeability, stale PR activity, no required check, no active request, same-repo non-draft heads, and a stable head/base.

Refuted

  • The new notice path duplicates conflict-report behavior or broadens the write surface beyond the requested re-apply notice.; refuted because: The workflow retains the existing conflict-report path and adds a separate marker-scoped comment only after eligibility checks; the allowlist and documentation explicitly describe both boundaries.
  • The notice can be repeated on every sweep because marker detection is unreliable.; refuted because: The marker is a fixed HTML comment containing the full head SHA, and grep -F searches all paginated comment bodies; a fixture containing that marker verifies the quiet path.

Evidence gaps

  • The implementation introduces GitHub API reads and issue-comment writes, while workflow hardening analysis was unavailable because zizmor was not installed.
  • Model proof intent was rejected by deterministic validation.
  • The proof packet cannot independently establish the claimed test pass because ripr failed and cargo-test was only scheduled late.

…ow (#10136)

notify_dark now returns posted, already-posted or now-active; the sweep row and counts follow, so the table no longer advises a re-apply that would cancel a live run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M1HLQzDSYhzcGBd9baf3RV

Copy link
Copy Markdown
Member Author

Repaired in 190a1b5. notify_dark now returns three outcomes (posted, already posted, run became visible) and the sweep row follows: a late-visible active run is counted as in flight and the row reads "in flight (a merge-ready run became visible; do not re-apply the label)", with no "needs merge-ready re-applied" and no "notice posted". The already-posted case now reads "re-apply notice already posted" instead of being counted as a fresh notice. The late-visible test asserts the rendered summary and the count for both queued and in_progress, and the already-told test asserts its row; reverting the active-run return code makes the late-visible test fail. Workflow budget 130 to 135 for the added lines; cargo xtask precommit passes. Re-labeling now for the required check on this head.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Ripr Rust Small Result failed on 190a1b5, but the failure is inherited from main, not from this PR. In the Rust gates job all 21080 tests passed (21080 run, 5 skipped); the step that failed afterwards was cargo xtask goldens check: rust_qualified_foreign_receiver [human-full.txt] has 19 lines of drift, the Next: line that #9449 now prints, and the golden was never re-blessed. This PR changes only the watchdog workflow, its test, the allowlist, docs and a changelog fragment, so it cannot move that golden. #10253 already carries the re-bless and #10260 notes the same drift. I am not blessing it here, so the PRs do not conflict over the same golden. I'll re-apply merge-ready once main is green on goldens and I have merged main into this branch.


Generated by Claude Code

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Comment thread docs/CI.md Resolved
…10136)

A failed comment or run lookup no longer reads as no notice or no run; the notice is skipped and reported, and the next sweep retries. Also repairs the split audit-trail sentence in docs/CI.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M1HLQzDSYhzcGBd9baf3RV

Copy link
Copy Markdown
Member Author

Both Devin findings are valid and repaired in e07ee0c. (1) notify_dark now captures the comment listing and the run lookup and returns failure if either gh api call errors, instead of reading empty output as "no notice yet" or "no run". The sweep row then says "re-apply notice failed", nothing is posted, and the next sweep retries; new test a_failed_lookup_before_the_notice_posts_nothing_and_is_reported fails if the run lookup goes fail-open again. This also closes the comment-listing gap I had noted earlier. (2) The split "audit trail" sentence in docs/CI.md is rejoined. Workflow budget 135 to 140; cargo xtask precommit passes. Re-labeling for the required check on this head.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the test harness proves each notice scenario individually, but its shared workflow-runs and comments endpoints do not prove per-PR isolation when several PRs appear in one sweep.
  • Confirm the test harness uses shared files for run and comment responses, so multiple PRs with distinct qualification states in one sweep are not exercised.
  • Confirm paginated comments and workflow runs are relied upon through gh api --paginate, but the local fixture does not exercise multi-page API responses or a failure confined to a later page.
  • Confirm the new notice path is exercised for single-PR cases, but not multiple PRs with distinct run and comment responses in one sweep.
  • Confirm paginated API failures are not directly tested, although the implementation uses gh api --paginate and relies on command failure propagation.

Refuted

  • The notice path broadens write behavior beyond the requested conflict report.; refuted because: The new path is explicitly marker-scoped and requires computed mergeability, same-repo non-draft state, no required check, no active request, and stable head/base; policy and documentation were updated consistently.

Parked follow-ups

  • The sweep combines API reads, marker deduplication, active-run classification, comment publication, and operator-facing disposition in one helper and caller, duplicating lookup/error logic already present in report_conflict.

Evidence gaps

  • The new behavioral test execution is not independently evidenced because cargo-test is scheduled late and ripr failed with exit code 2.
  • Model proof intent was rejected by deterministic validation.
  • The scheduled cargo-test evidence was still pending in the cached review packet.

Copy link
Copy Markdown
Member Author

Review of record, head e07ee0c.

Angles: (1) correctness of the notice conditions and dedupe; (2) security shape of the workflow (no checkout, no dispatch, PR values only through env or quoted args, fixed status context, job-level pull-requests: write and statuses: write only); (3) tests and regressions (13 watchdog tests against a fake gh and real jq, each with a sabotage run); (4) docs and policy parity (CI.md, allowlist budget 140, changelog fragment).

Findings and resolutions, all repaired on this PR: an active run visible between the sweep's first lookup and the notice no longer gets restart advice (Steven, REPAIR_REQUIRED, repaired in f445f8a); the audit row and counts now report that case as in flight and the already-posted case as such, instead of "notice posted" (Steven, repaired in 190a1b5); a failed comment or run lookup now skips the notice and reports "failed" instead of reading as no run (Devin, repaired in e07ee0c); the split audit-trail sentence in CI.md is rejoined (Devin). Bot reviews from Gemini, CodeRabbit and the github-actions advisory were quota or advisory output and are not counted as review; their verification questions (multi-PR sweeps, multi-page pagination) are not covered by the fixture and stay as accepted limits.

Proof on this exact head: Ripr Rust Small Result and Rust gates green, Admit PR Candidate green, cargo xtask precommit green locally, no unresolved review threads, no Steven comment after the last repair. Not established: live event behavior until the post-merge dispatch check.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants