Repository navigation
Description
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 withgit merge-tree --write-tree, and compares their affected closures from the existing selection code. - Output in
--json: for each colliding pair, the kind (textualwith conflicting paths,closurewith 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-issueconsults--pathsfor the issue's cited files before claiming and prefers non-colliding candidates when several are ready, and consults--prbeforeconfirm, 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, nottextual. - 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-issuereferences 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
schlessera commentedon Nov 2, 2026
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.fix(ci): keep base-drift conflicts out of textual collision pairs
feat(ci): report colliding open PRs with a read-only collision command
docs(skills): consult the collision report before claiming and confir…
fix(ci): keep base-drift conflicts out of textual collision pairs
feat(ci): report colliding open PRs before claiming and confirming (#…
schlessera commentedon Nov 2, 2026
Delivered by #3275 (squash
2efe3fa1c52391f85c7c0c3472d7cc07412252beon main, milestone 0.45.0).bun scripts/collisions.ts [--json] [--pr <n> | --paths <glob...>]is read-only. It trial-merges open PR heads pairwise withgit merge-tree, compares their affected closures using the CI selection code (planUnitChecks,unitImportOwners), and reportstextual,closureorunknownpairs.--pathsalso reportspath.unknown, never as disjoint. Objects are fetched without writing a ref orFETCH_HEAD. The test asserts that refs, HEAD, the index,FETCH_HEADand the working tree are unchanged.work-issueconsults--pathsat the claim step and--prbeforeconfirm.ONE_TEXTUAL_PAIR,SAME_CLOSURE_IS_CLOSURE,UNKNOWN_GRAPH_NEVER_DISJOINT,COLLISIONS_READ_ONLYandBASE_DRIFT_IS_NOT_TEXTUAL.18e449c2f, with parents6dfdafe9e+a621b3a99and tree438ea9723. The squash has parent6dfdafe9eand the same tree. The main-push run is being reconciled separately.