Skip to content

Conflict forecast: predict merge conflicts between parallel worktrees before they happen #249

Closed

Description

@currentbits

Inspired by Clash (open-source worktree-conflict predictor, found via Nimbalyst's worktree-tools survey).

With many agents editing the same repo in parallel worktrees, warn early when two active threads are touching the same functions/classes/files, before either merges. Show overlapping-edit hotspots on the Planboard or thread cards. Complements #163 (reactive merge-conflict agent) with a proactive signal.

Activity

  1. added
    enhancement
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 17, 2026
  2. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Shipped on main (b8cb027).

    How it works: git merge-tree --write-tree --name-only does a real dry-run 3-way merge between every pair of active worktree threads — no heuristic function/class parsing. Each thread's changed-file set is git diff --name-only <base>...<branch> unioned with its uncommitted git status --porcelain; pairs whose sets intersect become hotspots. overlap = files both threads touched, conflicts = the subset git says would actually collide.

    Where it shows: a chip on thread cards in the Sidebar and Kanban (Kanban reuses ThreadCard) — red conflict when a pair really collides, amber overlap when they only share files, · N when a thread is in several pairs. Tooltip lists the other thread and up to four hotspot paths.

    Not on the Planboard: those cards are GitHub issues, not threads.

    Wiring: git:conflictForecast IPC channel, computed in electron/worktrees.js, memoized 15s per project. Renderer refetches when the thread list changes — no new polling loop.

    Deliberately skipped: function/class-level granularity (file-level first; add if it proves noisy), cache invalidation on thread change (15s TTL instead), background refresher, merge-tree on uncommitted work (uncommitted edits contribute to overlap but can't be dry-run merged).

    Tests: electron/test/conflict-forecast.test.js (4 cases incl. a real collision and an uncommitted-only overlap), test/conflictForecast.test.ts, test/conflictForecastBadge.test.tsx. Renderer suite 852/852; electron suite baseline-clean (the web-integration reconnect failure pre-exists on main, otel-runner is flaky under load and passes in isolation).

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 17, 2026
  4. added a commit that references this issue on Aug 17, 2026
  5. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Research note (CodeScaleBench): code-graph find-references gives the STRUCTURAL version of conflict forecast — before dispatching, compute affected files/symbols, pre-scope the task, and flag collisions with in-flight threads. This also attacks the silent-killer failure mode they measured: partial completion (agent refactors 2 of 7 affected files).

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

    enhancementplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions