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

The conflict sweep brings a pull whose check tries are spent up to date instead of closing it (#8022): bringUpToDate counts its own runs #17756

opened this From outside

Approved, waiting for its check

number 4 in the queue: lands in about 2 h

bringUpToDate gated on automaticRunsSince, which since #8022 counts only reworks for a red check. A pull whose check tries were spent was then released by the tick's sweep as soon as main moved, while the same pull's no-merge red (bringUpAfterNoMerge) brings it up to date and keeps it open.

Notes · 4 files · +48 −10

Combined with main

The preview is built from combined/17756 (c3b686cc1f): main merged into this pull's head. Merging lands that branch.

The checks line says which commit the check ran on.

What happens next

This pull cannot land as it is, whatever its review says, because it changes guarded paths: src/crew/conflict_release.ts (permissions or the contract's walls), src/crew/conflict_sweep.ts (permissions or the contract's walls).

opened this

bringUpToDate gated on automaticRunsSince, which since #8022 counts only reworks for a red check. A pull whose check tries were spent was then released by the tick's sweep as soon as main moved, while the same pull's no-merge red (bringUpAfterNoMerge) brings it up to date and keeps it open. Which one ran first decided, so crew-merge-conflict's first test flaked (closed instead of open) on a loaded box. bringUpToDate now bounds the bring-up-to-date runs it queues, the bound the sweep already applies, and a new test drives the sweep first: it fails before the fix and passes after.

Why

test/crew-merge-conflict.test.ts "a clash outside the list docs queues a bring-up-to-date run, is no try and parks nothing" goes red on a loaded box (Expected: "open", Received: "closed", with [autonomy] conflicted pull released … why="main moved under it 2 times and the branch could not be brought up to date" in its log). Two paths answer the same conflicted pull whose check tries are spent:

  • the red (bringUpAfterNoMerge in src/crew/dispatch.ts) queues a conflict run and keeps the pull open, as #8022 meant ("a merge conflict is not a failed try … its tries are kept");
  • the tick's sweepConflicts calls bringUpToDate, whose gate still read automaticRunsSince. Since #8022 that counts only check_failed reworks, so the gate released the pull for tries that have nothing to do with the conflict.

Whichever ran first decided the outcome, both in the test and on a real forge.

Change

bringUpToDate now bounds the bring-up-to-date runs it queues: finished conflict runs since the person's last word or the episode start, at the same CHECK_FAILED_LIMIT. The sweep already applies that bound before it calls bringUpToDate, so the sweep's own close ("… 2 attempts to bring the branch up to date failed") is unchanged. The person paths (MCP flow, TUI drift, studio action, fleet verb) and the landing paths keep a limit, now on the runs they would add. A rework for a red check still counts against the check's own limit in give_up.

Test

New test in test/crew-merge-conflict.test.ts lets the sweep see the spent-tries clash before any red. It fails on main (the pull is closed, 0 conflict runs) and passes with the fix. All 28 test files that touch the conflict sweep, bringUpToDate, finishing, land_gated/land_admit, the flow tool, the drift screen or landsim pass (284/284).

The gate's "0.88 like betSpentSince" note is a coincidence of shape: that function counts a wallet's spend, not runs.

No look: crew logic only, no page or route changes.

Validation

validate on 6100f8d9: pass in 82s (forge.json check.fast, verbatim, in a scrubbed env).

  • bun install --frozen-lockfile: ok (exit 0, 0s)
  • forge.json check.fast: ok (exit 0, 82s)
commented

Follow-up for @juniper's note, head now 8cc16670:

  • 35d13a2e: the count is bringUpRunsSince in src/core/runs.ts, beside automaticRunsSince, and conflict_release.ts imports it.
  • c07c9798: the wider check on that head found a regression in my first version. test/mcp-flow-drift-update.test.ts "a pull whose tries are used is refused" (#10909) needs a writer's drift update to keep refusing a pull whose check tries are spent, and 6100f8d9 had moved every caller to the conflict-run count. bringUpToDate now takes counts: "check tries" is the default and leaves the MCP flow, TUI drift, studio, fleet and landing callers as they were on main, and "own runs" is passed only by sweepConflicts. That keeps the fix where the flake was. The sweep no longer closes a spent-tries pull just because it reached the clash before the red did.
  • 8cc16670: merged main in (no rebase, no force-push).

The new test still fails with main's src/crew and passes here. The 31 test files that touch this path pass (352/352), and local validate (check.fast) on 8cc16670 passed in 492s. The gate's "0.88 like automaticRunsSince" note is the two counts sitting side by side. They differ on purpose: one counts reworks for a red check, the other the bring-up-to-date runs.

The approval was on 6100f8d9, so this head needs a fresh look.

commented

Thanks @juniper. On the non-blocking notes: the two counts differ on purpose. automaticRunsSince counts reworks for a red check (the check-tries budget #8022 and #10909 rely on). bringUpRunsSince counts the sweep's own finished conflict runs, which bounds the bring-up loop. The gate's "0.88 like automaticRunsSince" note is about shape, not duplication. I'm keeping the head as it is so the approval holds. If you want the counts mode split into two named functions, I can do that in a follow-up.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs