Skip to content

ci: nothing notices when two open PRs claim the same issue (three times in one night, noticed by a reviewer each time) #2807

Closed

Description

@bong-water-water-bong

What

Three times in one night a second PR was opened for an issue another lane had already started, and a human reviewer noticed each time rather than an instrument:

#2778   #2784 (merged first) / #2786 (mine, closed)      "accel_sampler: write the summary by rename"
#2795   #2796 / #2797 / #2798 (mine, merged first)        "accel_sampler names the copy that wrote each summary"
#2779   #2790 / #2793                                     "fold_initializer_transpose"

The cost is not the duplicate diff. It is the review: two verdicts on the same change, a "which one is yours" thread on both PRs, and a merge order nobody chose — plus, for the two cases above, one lane closing its own PR as superseded after a reviewer flagged it.

The fleet already has the policy (two-open-prs-one-file) and the merge loop reads the verdicts; what it lacked is the one-line answer to "does anything else claim this issue right now" — which is a fact about the PR bodies, not a judgement.

Fix

tools/ci/duplicate_fixes_check.py: read the fleet's open PRs, extract Fixes #N / Closes #N / Resolve #N claims from title and body, and report every issue claimed by two or more open PRs with each PR's number, title, draft state and age.

  • Refs #N and a bare #N mention are NOT claims. That is the difference between a detector and noise: a PR that discusses an issue would otherwise look like a claimant. The self-test pins both directions.
  • A draft claimant still counts — a draft that claims an issue is a lane working on it, which is exactly what the second lane cannot see.
  • Exit 0 none / 1 at least one duplicate / 2 cannot tell (a failed API read must not read as "nothing claimed twice").

The claim is deliberately read from the PR text rather than from a label or a linked issue: Fixes #N is where lanes already put it, and the merge loop already depends on that convention.

Measured

Self-test (hermetic, fixtures are tonight's real numbers and titles): 12 arms, including the pair above, the draft case, and the two negative arms (Refs/bare mention). Live run on the fleet's open PRs at 01:0xZ: clean — no open issue is claimed by more than one open PR, rc 0 — because all three pairs have since been resolved; the value is for the next one.

Registered as ctest tool_selftest_duplicate_fixes (self-test only: the live run needs network and a token, so it stays a lane command, like pr_review_queue.py).

Activity

  1. bong-water-water-bong commented on Nov 17, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Correction to this issue's own third example, found while validating the tool against real PR texts. I listed #2779 as the third duplicate cluster (#2790/#2793). It is not one: #2793 claims nothing — its body says "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)", which is a reference, not a claim. (My first regex read that sentence as a claim on #2728, because the noun "fix" sat 24 characters from the reference; that false positive is fixed in #2809 and armed as a negative case.)

    So the tool would have caught two of tonight's three clusters — #2778 (#2784/#2786) and #2795 (#2797/#2798) — and misses #2796 by design: its body says "Part 1 of #2795" with no closing keyword. A PR that implements part of an issue without a line is not a claim, and I would rather write that limit down than widen the regex until it fires on prose.

  2. bong-water-water-bong commented on Nov 17, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Two words eaten by my shell in the comment above (backticks again — third time tonight, so it goes in the state file as a habit to break): "without a line" should read without a Fixes line, and the same for the sentence about widening the regex. Substance unchanged.

  3. bong-water-water-bong commented on Nov 20, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The gate has a hole this issue does not cover: a duplicate of a merged PR is invisible

    duplicate_fixes_check --gate compares open PRs against open PRs. So when a PR merges and another PR for the same issue is opened afterwards, the pair never exists from the gate's point of view and the row reports clean.

    Measured, first instance today:

    $ <scan: every open PR's closing claims vs PRs merged in the last 100 closed>
    
    open #2982 claims #2978, already merged as #2979 at 2026-11-20T15:10
    open PRs: 5   merged PRs scanned: 76   duplicate-of-merged hits: 1
    

    #2979 merged edb31b29f at 15:10 (if (pos[m] != have && pos[m] != 0) { — position 0 on a re-used slot), and #2982 was opened at 15:09 for the same issue with the same fix. The gate said clean, correctly: from its inputs there was nothing to compare.

    The fix is small and uses the data the tool already fetches: compare an open PR's claims against issues claimed by PRs merged within the last N days, in addition to the open-vs-open pass. Two more considerations:

    • it must not flag a legitimate sequel — a follow-up PR that says "Fixes #N" for an issue whose fix merged is exactly the shape that should be Refs #N, so the message should say so rather than "duplicate": "#N was closed by #M at ; if this is a follow-up, say Refs #N and what differs";
    • the window matters — unlimited history would red every long-running issue (strixhalo: 2361 NVMe IO_PAGE_FAULT events on the root SSD in the boot that died at 23:47:35 #2478 has 100 comments and many merged PRs), so it needs a time bound rather than a count.

    And this is the third way a run can be blind that we have found today, all in the same tool: it could not look at all (owner/name → skip, #2971), it could not tell a failure to look from a clean (#2974), and now it only looks at one half of the population. The first two are fixed; this one is not, and I cannot open the PR while engine sits at the cap.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions