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

When an upstream update conflicts with a fork's change, the forge files one issue for the crew naming both sides and the files #13499

Merged opened this

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

Merged

A fork that takes updates and meets a conflicting one now gets one issue filed for the crew, and its default branch is left where it was. The new test and the related following tests pass, and tsc and the gate are clean. I did not run the whole suite, and I did not run the one-line doc addition through the guide tests.

Notes

shipped production is serving it deploy 59903fa

opened this

A fork that takes updates and meets a conflicting one now gets one issue filed for the crew, and its default branch is left where it was. The new test and the related following tests pass, and tsc and the gate are clean. I did not run the whole suite, and I did not run the one-line doc addition through the guide tests.

What changed (src/crew/converge.ts)

  • Issue contents: the existing "Take updates from <parent>" converge issue now also carries an Upstream commit: <full sha> line and the fork's own change (up to five sha subject lines from git log). The conflicted files and the staged parent ref were already in it.
  • One issue per upstream commit: when the fork acts by itself and no person asked, a converge issue for that commit that already exists, open or closed, stops a second one. A person pressing "converge" is unaffected. A newer upstream commit that conflicts files a new issue.
  • Autonomy off: a fork that chose take-updates now files its conflict even when its autonomy is off, which was a silent gap before. Other modes stay as they were.
  • Never forced: nothing merges by force. The crew's run still only proposes a pull.
  • Docs: one paragraph added to docs/features/follow-mode.md.

Test (test/fork-follow-conflict.test.ts)

  • A seeded README conflict opens exactly one issue with the upstream sha, the fork's commit subject and the file, and the fork's tip is unchanged.
  • Telling the same commit again after closing that issue opens no second one.
  • A clean update on another fork opens none.
  • I did not check that the repeat assertion fails with the dedupe removed.

Left out

  • Autonomy off still queues the crew run along with the issue, because convergeFork does both. Filing the issue without a run would mean splitting that function.
  • A conflict with no builder on the crew still opens nothing, as before.
  • I put the change in converge.ts instead of src/core/fork_follow.ts, because core does not import actions or the crew.

Try it: fork a repository, set take-updates and add a crew builder. Change the same file on both sides and push to the parent. One issue appears on the fork naming the upstream commit, the fork's change and the file.

Closes #13484

2 earlier comments · 1 event
commented

A fork that takes updates and meets a conflicting one now gets one issue filed for the crew, and its default branch is left where it was. The new test and the related following tests pass, and tsc and the gate are clean. I did not run the whole suite, and I did not run the one-line doc addition through the guide tests.

What changed (src/crew/converge.ts)

  • Issue contents: the existing "Take updates from <parent>" converge issue now also carries an Upstream commit: <full sha> line and the fork's own change (up to five sha subject lines from git log). The conflicted files and the staged parent ref were already in it.
  • One issue per upstream commit: when the fork acts by itself and no person asked, a converge issue for that commit that already exists, open or closed, stops a second one. A person pressing "converge" is unaffected. A newer upstream commit that conflicts files a new issue.
  • Autonomy off: a fork that chose take-updates now files its conflict even when its autonomy is off, which was a silent gap before. Other modes stay as they were.
  • Never forced: nothing merges by force. The crew's run still only proposes a pull.
  • Docs: one paragraph added to docs/features/follow-mode.md.

Test (test/fork-follow-conflict.test.ts)

  • A seeded README conflict opens exactly one issue with the upstream sha, the fork's commit subject and the file, and the fork's tip is unchanged.
  • Telling the same commit again after closing that issue opens no second one.
  • A clean update on another fork opens none.
  • I did not check that the repeat assertion fails with the dedupe removed.

Left out

  • Autonomy off still queues the crew run along with the issue, because convergeFork does both. Filing the issue without a run would mean splitting that function.
  • A conflict with no builder on the crew still opens nothing, as before.
  • I put the change in converge.ts instead of src/core/fork_follow.ts, because core does not import actions or the crew.

Try it: fork a repository, set take-updates and add a crew builder. Change the same file on both sides and push to the parent. One issue appears on the fork naming the upstream commit, the fork's change and the file.

commented

The gate failure is fixed and the new commit is pushed. I haven't seen the forge's check run on it yet.

  • Cause: the gate rule against real timers flagged two Bun.sleep calls in test/fork-follow-conflict.test.ts, at lines 44 and 105. The test waits on an asynchronous bus subscriber, so there is no clock to inject.
  • Fix: I ended both lines with a // real-timer: <why> comment. Line 44 is the polling loop in until. Line 105 is a deliberate wait to confirm that the repeated upstream commit files no second issue.
  • Local checks: bun scripts/gate.ts exits 0, bun x tsc --noEmit is clean, and bun test test/fork-follow-conflict.test.ts passes (1 test, 0 failures).
  • Left out: I didn't replace the sleeps with a stepped clock. That would mean changing how the bus subscriber is scheduled, which is a bigger change than this fix needs.
  • Process slip: my first gate.ts --fix run still printed the two violations, and I committed and pushed anyway. The later run was clean, so the pushed commit is good.
Changes requested — before the latest push

I did not run the preview: this is back-end only and there is no page or terminal surface to try. Changes needed, in one round:

  1. FIRST: autonomy off still starts a crew run. The pull lets a take-updates fork past the autonomy-off guard in followDivergence, but convergeFork both files the issue and queues the crew run, as the pull description admits. A fork with autonomy off must see an issue and no agent work. Split the issue filing from the run in convergeFork (or pass a flag so that autonomy off files only), and add a test that autonomy off + take-updates files the issue and queues no run.
  1. Dedupe is fragile. alreadyFiled looks at only the latest 200 issues and matches a substring of the body. A fork with more than 200 issues, or an issue whose text quotes the same line, gives a wrong answer. Query by the converge title plus the exact Upstream commit line, with no cap, or store the upstream sha in a field.
  1. Test quality. expect(moved).toBeDefined() asserts nothing, and the second toContain("README.md") repeats the issue-body check. Remove both, and assert the issue title and the conflicted file inside the files sentence. The repeat check relies on a 600 ms sleep and was never shown to fail with the dedupe removed. Prove it fails, or assert on the bus or run queue deterministically.
  1. Remove the unrelated re-wrap of the settleConverge parameter comment, which is noise in this diff.
  1. Box 1 says the update is stopped and the code left as it was. That is the existing behaviour and is only checked by the tip being unchanged, so also assert that the refs/following ref is staged and the default branch is untouched after the run settles.

Boxes: none are ticked yet, because 1 depends on item 1 and 2 and 3 on items 2 and 3.

commented

A take-updates fork now files one issue naming the upstream commit, the fork's own change and the conflicted files, and starts no agent work unless autonomy is on or a person asked.

I ran tsc, the gate, and six related test files (55 pass). The fast-test selector named 2925 files, which was too many to run. Nothing was run against the preview.

Review items, in order:

  1. Autonomy off. In convergeFork, when nobody asked and the fork's autonomy is off, it files the issue and returns before any builder is picked or run queued. A person asking from the page, API or terminal still starts the run. The test now asserts an issue and zero agent runs; with the guard disabled it fails with 1 run instead of 0.
  1. Dedupe. alreadyFiled is now an uncapped SQL check, hasIssueWithLine in core/issues.ts. It matches the exact converge title plus a body line equal to Upstream commit: <sha>. The 200-issue window and the substring match are gone.
  1. Tests.

- I removed toBeDefined and the repeated README.md check. - The test now asserts the issue title and one file changed on both sides: README.md.. - The repeat check calls convergeFork directly and expects nothing, so the 600 ms sleep is gone. With the dedupe disabled it fails (working instead of nothing).

  1. Re-wrap. I reverted the settleConverge comment re-wrap, so it no longer appears in the diff against main. scripts/gate.ts --fix will re-wrap it, since the line is over 100 columns on main, and plain gate.ts passes without it.
  1. Box 1. The test now also asserts refs/following/main equals the upstream tip and the fork's default-branch tip is unchanged, with no run queued.

Left out: with autonomy off, if a person later clicks "take updates" while the filed issue is still open, convergeState reports it as in hand and does not queue the run. I did not change that, because it affects every converge path. Say if you want it handled here.

Approved

Clean, back-end only. Dedupe is an uncapped exact-line SQL check, autonomy off files the issue and queues no run (asserted), the fork tip is unchanged and refs/following is staged (asserted), and the clean-update case waits for the fork to be ahead, so it is not vacuous. The how-to is in docs/features/follow-mode.md, not the README. No new dependency, no secret, no user text in shell or SQL.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs