Repository navigation
fix(ci): stop nightly failure reports cancelling each other (BS-011) - #603
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
lazyxeon
left a comment
There was a problem hiding this comment.
clear at 00a4fb3cf0418586a515faf320636f365dae16a1
TL;DR evidence:
- Key:
github.event.workflow_run.idis in theworkflow_runpayload and is unique per upstream run./tmp/actionlintonnightly-failure-issue.ymlexits 0.cancel-in-progress: falseis right; the oldgithub.event_name == 'pull_request'was always false here anyway. The real cause was the shared group: GitHub keeps only one pending run per group, and that's gone now. - Nothing else cancels: the
reportjob has no job-levelconcurrency, and the workflow has no other group. - Isolated mutations: switching the key back to
github.refmakestest_nightly_failure_issue_serializes_per_upstream_runFAIL, and so doescancel-in-progress: true. After reverting,test_workflow_policy.pypasses 14/14 and the tree is clean. - Trigger list: the 13 entries haven't changed. 12 match real
name:values. - PR body report: accurate (one file plus a test, the policy test passes, and Rust wasn't run, which is correct for a YAML-only change). Bot comments: Codex finished with no findings, and CodeRabbit skipped. Nothing to address.
Non-blocking (follow-ups, not added by this PR):
- Duplicate-issue race. The old shared group serialized runs. Now, if the same workflow fails twice within seconds (for example a schedule run and a main push run), both runs can miss the open issue in the find-then-create step (
nightly-failure-issue.ymlaround theexisting.find/issues.createbranch) and open twoNightly CI failure: <name>issues. Different workflows have different titles, so they can't collide. The race window is small and the worst case is a duplicate, never a lost report, so I'm accepting it. Possible fix: aftercreate, list again and close the newer duplicate with a comment pointing to the older issue. - Pre-existing trigger mismatch.
Determinism Replay(line 11) doesn't match the workflow's real name,determinism-replay(.github/workflows/determinism-replay.yml). That workflow's failures probably never reach this reporter. Fix: rename the trigger entry todeterminism-replay(or set that workflow'sname:to match), and add a policy test that checks every trigger entry against an existing workflowname:. I'll file this during triage.
lazyxeon
left a comment
There was a problem hiding this comment.
blocking at 27ea5219c4f2162e576d8e6b1aeea3e1f3e47a42 (2 small items, no logic rework)
TL;DR evidence:
- Names: the 13 watched entries resolve to real
name:values with 0 missing, anddeterminism-replay.ymlhasname: determinism-replay. Isolated mutationSanitizers→Sanitizermakestest_nightly_failure_issue_watched_names_match_workflowsFAIL with['Sanitizer'] != []. After reverting, the tree is clean. /tmp/actionlintexits 0, andtest_workflow_policy.pypasses 15/15.- Duplicate guard, two runs racing (A creates #N and B creates #N+1): each run only ever closes the issue it created itself (
created.data.number), and only when an older open issue with the same title exists. So it can't close the original or another run's issue. B closes #N+1 and comments on #N, and A keeps #N. It has no loop: at most 3 lists and 1 create.issues: writecovers create, comment and update(close). Worst case under list lag: both issues stay open, which is no worse than before.
Blocking:
.github/workflows/nightly-failure-issue.yml:126:const keep = sameTitle[0];isundefinedif the re-list right afterissues.createdoesn't return the new issue yet (the issue list is eventually consistent). Thenkeep.numberthrows, and the report job goes red after it has already filed the issue. Fix:const keep = sameTitle[0] ?? created.data;.- PR body is stale. The AGENTS.md report still says head
00a4fb3cfand lists only the concurrency change and one test. Fix: update Change and Report to cover thedeterminism-replayrename,test_nightly_failure_issue_watched_names_match_workflows, and the duplicate-close guard, with the new head SHA.
Non-blocking: the second listOpenIssues() before the create (the else branch's first re-check) does no harm, but it adds almost nothing because the post-create dedupe does the real work. Keeping it is fine.
lazyxeon
left a comment
There was a problem hiding this comment.
clear at 2a2e5d162bbbfd784a470d542339eb37229adbb3
TL;DR evidence:
- The diff from
27ea5219is one line,nightly-failure-issue.yml:126const keep = sameTitle[0] ?? created.data;. Nothing else changed. - The fallback is correct.
created.datais the issue object returned byissues.create, so it hasnumber. When it's used,keep.number === created.data.number, the dedupe branch is skipped, and the run logsOpened issue #N. Nothing else reads fromkeep. /tmp/actionlintexits 0, andtest_workflow_policy.pypasses 15/15.- The PR body is accurate. It lists head
2a2e5d16, the concurrency change, thedeterminism-replayrename, the names test, and the duplicate guard with its fallback. - Both blocking items from 5711671401 are resolved.
There was a problem hiding this comment.
Blocking at 2a2e5d162bbbfd784a470d542339eb37229adbb3 (2 items).
The concurrency change is the right fix for BS-011. A shared ${{ github.workflow }}-${{ github.ref }} group keeps one running run and one pending run; a third arrival cancels the previous pending run even when cancel-in-progress is false. Keying on github.event.workflow_run.id with cancel-in-progress: false gives each upstream completion its own group, so the 13 reporters no longer drop each other. There is no second concurrency block and no job-level group. github.event_name == 'pull_request' was never true on this workflow_run-only file.
All 13 workflows: entries match a column-0 name: (determinism-replay is determinism-replay.yml:12; CodeQL Analysis is the quoted name: with the quotes stripped). python3 scripts/ci/test_workflow_policy.py -v exited 0 (15 tests). The empty-list throw from the previous review is gone (sameTitle[0] ?? created.data), and the PR body matches this SHA. No Cargo.lock, no new crate, no hashed source. import re is the stdlib. Permissions stay contents: read and issues: write. The script does not check out the triggering SHA and does not download artifacts.
- Head SHA:
2a2e5d162bbbfd784a470d542339eb37229adbb3. Required checks were still running (Affected scope, Scorecard, cargo-deny, cargo-audit). This SHA is not green. - Commands:
python3 scripts/ci/test_workflow_policy.py -vexit 0.gh run listondeterminism-replay.ymlshows pull_request head refs such ascursor/nightly-failure-concurrency-2f4b(run41049637980). - Not run:
actionlintis not installed here. Replay hash jobs were not run (YAML and a Python policy test). Fullrun-gate.shwas not run. - Measurements: not measured.
- Replay hashes: unchanged by this diff (no sim or render crate). Hash jobs were not executed.
- Deferred issues: none.
#576 still asks for Fuzz, Mutation, Miri, Kani, Scorecard, Determinism profile, and frame-alloc-sites to open issues. This PR does not add them, and test_nightly_failure_issue_watched_names_match_workflows freezes the watched count at 13. Fixes BS-011, part of #576 does not meet that done-when. Coverage, Editor CI, SDK, PBR, and parts of Sanitizers still use continue-on-error, so a red step can finish as workflow success and skip this reporter. That behavior is unchanged.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
There was a problem hiding this comment.
Changes are required on 2a2e5d162bbbfd784a470d542339eb37229adbb3.
The concurrency key is the right fix for the pending-cancel bug. On workflow_run, github.ref is the default branch, so every watched completion shared Nightly Failure Issue-refs/heads/main. GitHub's default queue: single cancels the pending run when another one is queued, including when cancel-in-progress is false. github.event.workflow_run.id puts each upstream run in its own group. cancel-in-progress: false keeps a second delivery of that same run from aborting the reporter. determinism-replay now matches name: in determinism-replay.yml. All 13 watched strings resolve to a real workflow name. Permissions stay contents: read and issues: write. The script does not check out the triggering SHA. No hashed crate, no new dependency, no gate change.
Two defects are in the new behavior. The job if still files a failed fork pull request whose head branch is main as a mainline nightly failure, and the per-run group means those runs are no longer dropped. findByTitle updates the newest open issue while the post-create path keeps the oldest, so once two issues exist the keeper goes stale.
- Head SHA:
2a2e5d162bbbfd784a470d542339eb37229adbb3. Not green. - Commands:
python3 scripts/ci/test_workflow_policy.py -von that tree, exit 0, 15 tests. Watched-name audit: 13 names, 0 missing. - Not run: replay hashes (no hashed crate),
run-gate.sh(workflow and policy test only), GPU frame budget (not measured; this VM is not the 1660 Ti), actionlint (not installed). No workflow under.github/runstest_workflow_policy.py. - Measurements: not measured.
- Replay hashes: expected unchanged, not run.
determinism-replay.ymlitself is untouched. - Deferred: #576 stays open. Still unwired on a schedule: Determinism profile check (
30 5 * * *), Fuzz nightly, Mutation Testing, Miri UB Detection, Kani Formal Verification, OpenSSF Scorecard. #576 also names Frame alloc sites, which isworkflow_dispatchonly.assertEqual(len(watched), 13)locks that list.docs/current/CI_ARCHITECTURE.mdstill says every concurrency block usescancel-in-progress: ${{ github.event_name == 'pull_request' }}.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
|
Devastation T2 @ 00a4fb3: non-blocking. Grouping by |
When many scheduled workflows fail on main, they all triggered nightly-failure-issue with the same concurrency group (workflow+ref), so pending runs were cancelled and failure issues were dropped. Key concurrency on github.event.workflow_run.id and assert the policy in test_workflow_policy.py. Fixes BS-011 / #576. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Use determinism-replay in the workflow_run list so replay failures reach the reporter. Assert all 13 watched names match a workflow name: field. Re-list open issues before create and close a newer duplicate if two runs race on the same workflow title. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Require same-repo head and schedule or main push/dispatch so fork and pull_request workflow_run completions do not open nightly issues. Always comment on the lowest-number open issue, close reporter duplicates, and only close a just-created issue when a strictly older sibling exists. Run test_workflow_policy.py in the CI gate and assert the job guard. Rebased onto main (includes #599 Windows rate-limit flake fix). Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
2a2e5d1 to
56e15d4
Compare
lazyxeon
left a comment
There was a problem hiding this comment.
clear at 56e15d4afd350c5e9591e38b96277b96c52d4639
TL;DR evidence:
- range-diff
00a4fb3c~1..2a2e5d16vsorigin/main..HEAD: commits 1–3 are identical (=). The only new commit is56e15d4a, which touchesci.yml(+3),nightly-failure-issue.ymlandtest_workflow_policy.py. The rebase onto #599 is clean. - cursor[bot] fork/PR finding (both runs): fixed. The job
ifnow needshead_repository.full_name == github.repositoryplus eitherschedule, orhead_branch == 'main'withpush/workflow_dispatch. A fork PR fromfork:mainfails the repo check, and a same-repopull_requestfails the event check. Real scheduled and main push/dispatch failures still pass, because both have head_repository equal to this repo. A missinghead_repositoryevaluates to null, so the comparison is false and the job is skipped, which is the outcome cursor[bot] asked for. - cursor[bot] keeper findings (both runs): fixed.
pickKeepertakes the lowest-number open issue with this title, skipping PRs, in both paths. A run closes its own new issue only if one with a strictly lower number exists (issue.number < created.data.number).syncKeepercloses only non-keepers that carry the reporter marker. The lowest-numbered issue a run sees is never closed, so two racing runs can't close everything. That fixes cursor[bot]'s mutual-close case, the one my earlier?? created.datareasoning missed. The lagging-list residual is still a duplicate, never a lost issue. No loop:syncKeeperruns at most 3 times, and nothing calls it recursively. The existingissues: writecovers get, comment and update. - ci.yml gate:
Workflow policyruns unconditionally ingate, between existing steps. Job names,needsand triggers are unchanged. Mutating the fork-guard string makes the script exit 1, so the step fails. After reverting, the tree is clean. /tmp/actionlintonci.ymlandnightly-failure-issue.ymlexits 0, andtest_workflow_policy.pypasses 16/16.- PR body: the Change list and Report match this head (
56e15d4a, 16 tests, #599 rebase). There's no separate resolution table; the Change bullets cover both cursor[bot] items accurately.
Non-blocking:
nightly-failure-issue.yml:132:full.data.body.includes(...)throws if a manually opened issue with the same title has a null body. This happens after the keeper comment, so nothing is lost, but the job goes red. Fix:(full.data.body || "").includes(...).nightly-failure-issue.yml:196: on the fresh-create path,syncKeeper()comments on the issue that was just created, so a new issue gets its body repeated as its first comment. It's only noise. Fix: skip the comment whenkeeper.number === created.data.number.- cursor[bot]'s scope note: 6 scheduled workflows aren't watched (Determinism profile check, Fuzz nightly, Mutation Testing, Miri, Kani, Scorecard). That's the rest of #576, so it's out of scope here.
There was a problem hiding this comment.
Not blocking at 56e15d4afd350c5e9591e38b96277b96c52d4639. The two previous blockers are fixed. Two residuals in the new dedupe should be fixed here; neither one drops the only open report.
BS-011 holds. github.ref on workflow_run is the default branch, so the old group was one bucket (Nightly Failure Issue-refs/heads/main). GitHub's default queue keeps one running run and one pending run, and a new arrival cancels that pending run even when cancel-in-progress is false. github.event.workflow_run.id with cancel-in-progress: false gives each upstream completion its own group. There is no second concurrency block and no job-level group. This file has no pull_request trigger, so the old github.event_name == 'pull_request' expression was never true.
The job if now fails closed. head_repository.full_name == github.repository is false when head_repository is missing. A fork PR whose head ref is main fails the repo check. A same-repo pull_request (including main into develop) fails the event check. schedule still reports. push and workflow_dispatch report only when head_branch is main. The parentheses match that reading. determinism-replay matches name: at determinism-replay.yml:12, so replay failures on main now reach this reporter. A pull request can no longer supply run.name.
Permissions stay contents: read and issues: write. The script does not check out the triggering SHA and does not download artifacts. actions/github-script@v7 was already the step. No new dependency (import re is the stdlib). No Cargo.lock. No hashed crate. determinism-replay.yml is not in this diff. No sim write, no HashMap iteration into a hash, no find_path, no model call on a replayed tick.
Mutual close is gone. Closing is only created.data.number, and only when some open non-PR row has number < created. A re-list that misses this run and sees only a higher peer does not close this run (created 100 seeing only 101 leaves older undefined). pickKeeper sorts by issue number and keeps the lowest. syncKeeper comments that keeper, then closes other same-title rows only when the body contains Opened by \.github/workflows/nightly-failure-issue.yml`. The lowest row this run can see is never closed. python3 scripts/ci/test_workflow_policy.py -vexited 0 (16 tests). Watched names: 13, 0 missing. The gate step sits ingate` before Rust setup and is not skipped for docs-only diffs.
- Head SHA:
56e15d4afd350c5e9591e38b96277b96c52d4639. Not green.hash (ubuntu-latest)ondeterminism-replaypassed.hash (windows-latest)andhash (macos-latest)are still pending, socomparehas not reported. Cargo-audit and cargo-deny passed. Replay hash jobs on Aravath determinism are still pending. - Commands:
python3 scripts/ci/test_workflow_policy.py -vexit 0. Name audit: 13 watched, 0 missing. Node model oflistForRepoorder:findon[{100},{80},{50}]for< 100returns 80; the minimum is 50. Created 100 seeing only 101 does not select an older row. Created 101 seeing only 100 does. - Not run: replay hashes locally (no hashed crate; ubuntu hash job already passed on this SHA).
run-gate.sh(the gate step is one Python unittest).actionlintis not installed.player_facing_names.sh(the diff adds no player-facing copy). GPU frame budget (not measured; this VM is not the 1660 Ti). - Measurements: not measured.
- Replay hashes: expected unchanged. Ubuntu
determinism-replayhash job passed on this SHA. Windows and macOS hash jobs were still running. This diff does not touch a hashed crate ordeterminism-replay.yml. - Deferred issues: none. #576 stays open. Its done-when is still Fuzz, Mutation, Miri, Kani, Scorecard, Determinism profile, and frame-alloc-sites.
len(watched) == 13does not fail while those stay unwired. Also still scheduled and unwired: Benchmark Dashboard, Dependency Management & Security, Security Audit.docs/current/CI_ARCHITECTURE.mdline 34 still sayscancel-in-progressis${{ github.event_name == 'pull_request' }}on every workflow that has the block. This file has the block and setsfalse.falsestill does not cancel a push or a schedule; the sentence is what is stale. Job-levelcontinue-on-error: trueis unchanged on Code Coverage, Editor CI, SDK Header and C Harness CI, and PBR Pipeline CI, so a red job there can still finish the workflow assuccessand skip this reporter.
Prior threads: the fork/pull_request guard (:11, :28) and the mutual-close compare are fixed. The keeper-order thread is partial: pickKeeper uses the lowest number, and the post-create find below does not. The policy-test thread is partial: the gate runs the file and the new test rejects a pull_request event string; the count lock and the missing schedules remain.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
| repo: context.repo.repo, | ||
| issue_number: issue.number, | ||
| }); | ||
| return full.data.body.includes(REPORTER_MARKER); |
There was a problem hiding this comment.
Not blocking. issues.get returns body: null when the description was never set. An empty string is fine. null.includes throws.
This call sits after commentOnIssue(keeper.number), and only for a same-title row whose list body did not already contain the marker. A blank issue titled Nightly CI failure: <workflow> makes the reporter job red after the keeper comment is already stored. Rows later in open are then left open. The workflow's own issues always have a body, so this is the manually opened row.
(full.data.body || "").includes(REPORTER_MARKER) treats that row as not ours and does not close it.
| core.notice(`Opened issue #${created.data.number}`); | ||
| const open = await listOpenIssues(); | ||
| const reportable = open.filter(isReportableIssue); | ||
| const older = reportable.find( |
There was a problem hiding this comment.
Not blocking. listForRepo defaults to sort=created, direction=desc, and paginate keeps that order. find returns the first lower number, which is the newest older row, not the minimum.
On [{number:100},{number:80},{number:50}], find(number < 100) returns 80. pickKeeper returns 50. This branch then closes only the issue this run just created and comments on 80. It does not call syncKeeper, so 80 stays open beside 50 until a later failure takes the keeper path at the top of the script. The close comment names the wrong issue.
The mutual-close case is fixed. A higher peer is not < created. Created 100 with a re-list that contains only 101 leaves older undefined, and this run does not close itself.
Select the lowest number with pickKeeper, and run the marker close loop against that keeper. Close created only when keeper.number < created.data.number. A lagging list then leaves a duplicate, which is the residual that does not drop the report.
| run: bash scripts/ci/player_facing_names.sh | ||
|
|
||
| - name: Workflow policy | ||
| run: python3 scripts/ci/test_workflow_policy.py |
There was a problem hiding this comment.
This is the right job. gate checks out, runs this before Rust setup, does not skip it on a docs-only diff, and a failing unittest fails the step. python3 scripts/ci/test_workflow_policy.py -v exited 0 here (16 tests).
Nothing in test_workflow_policy.py reads ci.yml for this command. Deleting the step leaves the unittest green for anyone who runs the file, and the gate stops enforcing it. test_ci_gate_is_required_before_heavy_jobs already loads this workflow. Assert python3 scripts/ci/test_workflow_policy.py there.
The new event test is still a substring check. It stays green if the three event names remain in the file while the boolean around them changes. The expression on nightly-failure-issue.yml lines 40–46 is parenthesized correctly today.
|
Re-review @ 56e15d4: non-blocking. The name fix and the consistent-list race are fixed. Two mediums: duplicates are still possible when the issue list lags behind new issues, and with a 403 the keeper rule can close the real reporter issue in favor of a person's issue with the same title. The lows are unchanged. Details are in #604. |
BS-011 already keys concurrency on workflow_run.id with cancel-in-progress: false. Only extend the watched workflow list. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
* ci: extend nightly failure alerts and key concurrency by workflow Watch Mutation Testing, Fuzz nightly, Miri UB Detection, Kani Formal Verification, OpenSSF Scorecard, and Security Audit. Concurrency groups use workflow_run.name so upstream failure reports do not cancel each other. Refs #576 Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> * ci: leave nightly failure concurrency unchanged (#603) BS-011 already keys concurrency on workflow_run.id with cancel-in-progress: false. Only extend the watched workflow list. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> * ci: watch Determinism profile check in nightly failure alerts Refs #576 Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>


Fixes BS-011, part of #576.
Problem
nightly-failure-issue.ymllistened to 13 upstream workflows viaworkflow_run. They shared one concurrency group onmain, so pending reporter runs were cancelled and failure issues were dropped. The trigger list also hadDeterminism Replayinstead ofdeterminism-replay.Change
${{ github.workflow }}-${{ github.event.workflow_run.id }},cancel-in-progress: false.determinism-replay;test_nightly_failure_issue_watched_names_match_workflowslocks all 13 names.head_repository, and onlyscheduleorpush/workflow_dispatchwithhead_branch == main(no fork/pull_requestfalse positives).python3 scripts/ci/test_workflow_policy.pyin Comprehensive CI gate;test_nightly_failure_issue_job_skips_fork_and_pull_request_runs.Report
56e15d4afd350c5e9591e38b96277b96c52d4639(CI pending on push).python3 scripts/ci/test_workflow_policy.py -v— exit 0 (16 tests)git rebase origin/main— includes79171282d(test(net): fix Windows flake in steady_over_limit_closes_with_1008 #599 Windows flake fix)