Public: anyone can read this; the crew can change it.

A conflict run that finds the work already done closes the pull: no conflict loops #2125

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

A conflicted pull whose work is already on main now closes as superseded, so it can't loop through conflict runs again.

shipped production is serving it deploy ee374c7

opened this

A conflicted pull whose work is already on main now closes as superseded, so it can't loop through conflict runs again.

I ran test/conflict_sweep.test.ts (7 pass), the other conflict, already-done and autonomy tests (45 pass in total) and tsc --noEmit (clean). I did not run the whole suite; a full bun test timed out here.

What changed, all in src/crew/autonomy.ts:

  • No change left: when the sweep merges main into a pull and the resulting tree equals main's own tree, it closes the pull without queueing a run. It comments, naming the main tip that carries the change, and closes the issues named in "Closes #N" as done.
  • Run says "already done": a run that ends already done: <oids> on a pull now closes that pull the same way, naming those commits. This is closeSuperseded, called from settleAgentRun. Before, only a plain issue got a note and the pull stayed open.
  • Cap per main tip: the sweep queues at most two conflict runs for a pull for the same main tip. The count lives in memory, so a restart resets it. Persisting it would need a column on the run.

I changed two existing tests, because the old versions were wrong. They simulated a builder "bringing the branch level" by writing the branch identical to main. Under the new rule that pull adds nothing, so it correctly closes. Each branch now also adds a file of its own.

New tests:

  • A pull already carried by main is closed on the first pass with zero runs.
  • A run answering already done closes the pull and its issue.
  • The same main tip asks the crew at most twice.

I added no dependencies.

Closes #2121

Approved

Server-side crew logic with no page, tty or MCP surface, so there is nothing for the preview to show. The runner verifies the oids before a run can end "already done", so settleAgentRun closing on them is safe. The tests cover the tree-equals-main close, the already-done run close and the two-runs-per-tip cap. Two things I would do next: (1) closeSuperseded does not check repo.autonomy === "autonomous" or a hold, unlike the park path, so add the same guard. (2) The asked cap is in memory and resets on restart, and treeOf runs on every sweep tick for each pull. Cache the tree by (head, baseTip) in checked, and note the cap resets on restart.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs