Skip to content

ci: report colliding open PRs before claiming and confirming #2941

Closed

Description

@schlessera

Part of #2934 (Phase A, task 6).

Context

Workers claim issues by GitHub assignment plus a claim comment after checking open PRs; assignment is explicitly not an atomic lock (.agents/skills/work-issue/SKILL.md:80-96). Nothing compares in-flight branches against each other, so conflicts surface at merge or on main. Recent work is concentrated: of 177 squashes since 2026-10-18, 88 touched packages/ui-server and 57 packages/ui-sdk. Published data puts textual conflict rates between agent PRs at 19.8–41.7% (see the #2934 research findings), and build and semantic conflicts come on top of that.

The repository already computes affected closures per change (docs/decisions/ci-utility.md:83-100; discoverUnitImports, scripts/unit-test-consumers.ts:31-187).

Scope

  • A read-only command, bun scripts/collisions.ts, that lists open ready and draft PRs in this repository, trial-merges their heads pairwise with git merge-tree --write-tree, and compares their affected closures from the existing selection code.
  • Output in --json: for each colliding pair, the kind (textual with conflicting paths, closure with overlapping categories and paths), and both PR numbers and head SHAs.
  • A --pr <n> mode that reports only collisions involving one PR, and a --paths <glob...> mode that reports which open PRs touch an area before any branch exists.
  • work-issue consults --paths for the issue's cited files before claiming and prefers non-colliding candidates when several are ready, and consults --pr before confirm, recording the result in the PR.

Out of scope

  • Locks, reservations or messages between agents; this is detection only.
  • Automatic conflict resolution.
  • Semantic conflict detection beyond closure overlap.

Acceptance criteria

  • Against a fixture repository with three branches (two textually conflicting, one disjoint), the command reports exactly the one textual pair and no pair for the disjoint branch; proven by a test that fails before the change.
  • Two branches touching different files in the same closure are reported as closure, not textual.
  • When the selection graph cannot be built, closure overlap is reported as unknown, never as disjoint.
  • The command makes no writes to any ref, the index or the working tree, asserted by the test.
  • work-issue references the command at the claim and pre-confirm steps.

Verification

bun run test on the new test file, plus a restored mutation receipt (for example, treating an unknown graph as disjoint) showing the named test fail.

Contract impact

None: a repository script, not a brain command.

Activity

  1. added
    type: choreTooling, CI, release plumbing, dependencies.
    area: ciCI workflows, the gates they run, release scripts, packaging.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 25, 2026
  2. added this to the 0.45.0 milestone on Oct 25, 2026
  3. added
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    on Oct 25, 2026
  4. self-assigned this
    on Nov 2, 2026
  5. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claimed as part of working epic #2934 end to end (claim token wi-20261102-fd2d2f21). Order chosen for earliest queue-velocity benefit: #2938+#2939 rulings first (they unlock hosted draft feedback), then the red-main/merge-path chain (#2942, #2940, #2944); #2943, #2941 and #2937 run in parallel since they touch disjoint code. Intended branch: feat/2941-collision-report.

  6. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3275 (squash 2efe3fa1c52391f85c7c0c3472d7cc07412252be on main, milestone 0.45.0).

    • bun scripts/collisions.ts [--json] [--pr <n> | --paths <glob...>] is read-only. It trial-merges open PR heads pairwise with git merge-tree, compares their affected closures using the CI selection code (planUnitChecks, unitImportOwners), and reports textual, closure or unknown pairs. --paths also reports path.
    • An unbuildable graph or an unreadable head is reported as unknown, never as disjoint. Objects are fetched without writing a ref or FETCH_HEAD. The test asserts that refs, HEAD, the index, FETCH_HEAD and the working tree are unchanged.
    • work-issue consults --paths at the claim step and --pr before confirm.
    • Receipts are in the PR: a stub-before run and restored mutations failing ONE_TEXTUAL_PAIR, SAME_CLOSURE_IS_CLOSURE, UNKNOWN_GRAPH_NEVER_DISJOINT, COLLISIONS_READ_ONLY and BASE_DRIFT_IS_NOT_TEXTUAL.
    • Confirmation: candidate run 41421253027 passed. It checked out 18e449c2f, with parents 6dfdafe9e + a621b3a99 and tree 438ea9723. The squash has parent 6dfdafe9e and the same tree. The main-push run is being reconciled separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ciCI workflows, the gates they run, release scripts, packaging.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: choreTooling, CI, release plumbing, dependencies.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions