Skip to content

codeSplitter: the platform runs the merge loop, agents fill the gaps (tracking) #938

Closed

Description

@QuinnsCode

Agents will crowd the same files. That's a given. codeSplitter should let them, with the policy in code: the platform runs the loop, and agents fill only the gaps it can't decide. Today an agent coordinates by prompt, one judgment at a time. That's what the PR agent did all of 2026-10-12, and it still got a merge order wrong once.

The loop, owned by codeSplitter

  1. Queue live. Agents claim a line or range, wait in line for a hot one, and announce intents. Nobody piles on, so conflicts don't start. codeSplitter line locks 1: leases everywhere #926 (leases), codeSplitter line locks 2: wait in line, and soft intents #927 (waiting line, soft intents).
  2. Stack what doesn't compete. Merge by line id lands non-overlapping lines and files. Branches land oldest first, each against main as the last merge left it (codeSplitter: merge every branch that merges clean in one go #903). Deterministic rules settle "both only added to it": codeSplitter merge 1: settle list and paragraph one-liners deterministically #933 (list and paragraph one-liners), conventions codeSplitter conventions: break up the hot one-liners and numbered registries #935.
  3. Only real problems go to someone. A build-checked AI fallback, then a person. codeSplitter merge 2: a build-checked AI fallback, and refuse conflict markers #934 (also refuses conflict markers).
  4. Offline people. Their choice. On reconnect their edits replay onto line ids, and a stale edit is rebased word by word instead of rejected (codeSplitter line locks 3: word-level rebase of stale line edits #928).
  5. Self-healing CI. A failure or a guard trip opens a fix task on that branch automatically, and CI runs again. The guards: CI: fail on leftover conflict markers; test that features.json parses #937 (reject committed markers, parse features.json).

Agents get a few MCP tools where the right way is the easy way. edit does the claim, the wait and the rebase underneath. land lands, or returns the one real conflict with both sides and why. An agent is called only for that leftover, and its answer must build and pass tests before it lands.

Policy per path, with defaults

As .gitattributes merge drivers and Mergify do it: a small table, defaults for about 90% of cases, and teams override only the hot spots.

Path pattern Live edits Merge rule Leftover goes to
features.json, route tables, registries wait in line merge by key, union the items AI, then a person
*.md lists free union the items AI
lockfiles locked regenerate CI
everything else free line-id merge person

Catch our own mistakes: shadow mode

Run codeSplitter's merge next to git's on real PRs. Every case where they disagree, or where a guard trips, becomes a test case or a fix task. That's the self-healing loop, pointed at the merge system itself.

Worked example, 2026-10-12

Prior art to build on, not reinvent

  • Merge queues: Bors (the "not rocket science" rule), Zuul (testing the queue ahead), Uber SubmitQueue (conflict prediction), GitHub merge queue, Mergify.
  • Short branches: trunk-based development, feature flags.
  • Structural and union merges: git's merge=union driver, Mergiraf (tree-sitter), SemanticMerge. One file per entry: changesets, towncrier.
  • Locks: Perforce and SVN exclusive checkout. Dropped because people forgot locks; leases that expire on their own fix that.
  • Live editing: operational transforms (Google Docs), CRDTs (Yjs, Automerge), Zed.
  • Patches that reorder safely: Darcs, Pijul. First-class conflicts: Jujutsu.

What's new is the load. Agents mean about 10x the writers at about 10x the pace, with no standup to coordinate. And agents are also cheap fixers, so the platform should call them for the leftovers instead of leaving it to their prompts.

Related

Design docs: #925 (line locks), #936 (merge solutions). Pieces: #903, #926, #927, #928, #933, #934, #935, #937.

🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions