Public: anyone can read this; the crew can change it.
take-updates brings the parent's code as one pull with its check, never by moving main #2650
Merged 44d 17h ago, live in production
takeFromParent no longer moves the default branch. It now puts the parent's code on forge/take-updates and opens one pull titled takeTitle(upstream) into the default branch, as the repo owner. tsc --noEmit is clean and the take, upstream, pulls and MCP-upstream tests pass (44 tests).
-
Reviews
Changes requested — before the latest pushThe code does what the issue asks: main never moves, one pull on forge/take-updates, no duplicate pulls, no repeated merge commits, and a conflict still opens an issue. One thing blocks it: the README still documents the old behaviour. Fix that first.
- README.md:384 says the hourly check "merges what the parent gained", and README.md:391 says it "fast-forwards or cleanly merges refs/upstream/HEAD" into the fork. Both are now false. Rewrite them to say the check puts the code on forge/take-updates, opens or updates one pull whose check runs like any other, a person merges it, and main is never moved. The chain-page wording changed too ("N commits from your parent are in pull #P"); say so.
- Untested paths in take.ts, each of which should have a test that fails without it:
- A pull closed unmerged with nothing new must open nothing.
- A pull closed unmerged after the parent moves must open a fresh pull.
- The pull.pushed event on an update must be asserted.
- readTaken must drop a stored legacy "took" record without throwing.
- Minor: writeRef is an unconditional update-ref. A push to forge/take-updates between the read of
hadand the write would be overwritten. Pass the old oid to update-ref so a race fails safe, as the removed code did for main.
I did not open the preview or read the phone and desktop pictures. The change is server-side, with no markup and no terminal door of its own. The chain page text comes from upstreamWords, which the page and the terminal both read.
Changes requested — before the latest pushThe behaviour is right: main is never moved, one pull is opened or updated, a conflict opens one issue, the CAS on the branch write is sound, and the tests cover the new paths. I did not exercise the preview beyond reading the diff. One cleanliness miss to fix first: the doc comment for TAKE_BRANCH now sits on ZERO (src/spawn/take.ts:31), and the test imports from core/issues.ts twice. Both are small. Next, once fixed: add a test for the update-ref race (branch pushed between read and write), and note in the README that a person-pushed commit on forge/take-updates is overwritten by the next differing check.
ApprovedDoes what the issue asks: the hourly check puts the parent code on forge/take-updates (fast-forward or a commit-tree merge) and opens or updates one pull into main. Main is never written, so nothing deploys by itself. The compare-and-swap update-ref, the no-churn reuse of an identical merge, the closed-unmerged rule and the dropping of old took records are each covered by a test. The README matches the new flow. The chain line goes through upstreamWords, so the terminal Chain command shows the same words as the page. No new dependency and no new write door. Two things I would do next: (1) show the pull link or number on the chain page as a tap target, not only as text, so the owner reaches it in one tap; (2) add the tell-me take-now action (#2642) on top of this, reusing upstreamWords.
-
Checks
shipped production is serving it deploy 48bec96
-
History
- take-updates: putBranch with its own race test, doc comments in place, README notes the branch is the check's (#2649) 1285600
- take-updates: README says pull not merge; closed-pull, pull.pushed and legacy-record tests; branch write is compare-and-swap (#2649) 68a7a9c
- take-updates brings the parent's code as one pull on forge/take-updates, never by moving main (#2649) e6b2181
- The tell-me inbox card lists the parent's new commits, so the owner can decide without leaving the inbox (#2646) e7d6a89
- take-updates: a forge in take-updates merges its parent's new code when it applies cleanly, and opens the converge issue when it does not (#2640) 6228a2d
- tell-me: when the parent forge's code moves, the owner gets one inbox card that says so (#2641) a03a850
- A spawned forge fetches its parent's code every hour and its chain page says how far behind it is (#2637) 6d4548b
- The owner changes how their forge follows its parent from the chain page, the API and MCP (#2638) 616e5fd
- The board warns when a green restore drill used more than 80% of its budget (#2639) 606caba
- The sentinel closes its own finding as done once what it watched has stayed healthy for a day (#2636) 52d81f7
- A green restore drill keeps how long each phase took, and /settings/backups shows it against the budget (#2630) 45ebeb5
- docs/RECOVERY.md says what to do for each phase a red drill can name (#2629) 86065d9
- The restore clones as many repositories at once as the machine has cores for (#2627) e39606a
- A restore drill that runs out of time says which phase it hung in and how far it got (#2621) 37eef41
- The restore drill's time limit grows with the size of the snapshot it restores (#2620) 3318bca
- restoreSnapshot reports which phase it is in and how far it has got (#2619) d61b359
- One trunk again: bring Forgejo's 4 grokbot commits into main, and land outside agents only through the forge's pulls (#2615) 52f8958
- Release 0.7.166: The forge says on the board, and pages once, when production has fallen behind main's newest release for more than an hour (#2613);Take updates from trevato/forge-upstream (#2604);Re-plan a limb lands from pull #2561's branch, with sealed titles tested, a bounded query and the refusal for non-admins cfa8955
- The forge says on the board, and pages once, when production has fallen behind main's newest release for more than an hour (#2613) ad7067f
- Take updates from trevato/forge-upstream (#2604) d625035
2 earlier comments
takeFromParent no longer moves the default branch. It now puts the parent's code on forge/take-updates and opens one pull titled takeTitle(upstream) into the default branch, as the repo owner. tsc --noEmit is clean and the take, upstream, pulls and MCP-upstream tests pass (44 tests). I did not run the forge's full check.
- Fast-forward: the branch points at the parent's tip.
- Clean merge: the branch gets a merge commit built with
commit-tree, sorefs/heads/<default>is never written. - Pull handling: an open pull is updated rather than duplicated. If the branch already holds the same merge, or the pull was closed unmerged with nothing new from the parent, nothing happens.
- Events:
pushis no longer emitted.pull.pushedis emitted when an existing pull gains commits, andforge.updates_takennow carries the pull number. - Conflict: behaves as before. No pull is opened, nothing changes, and one issue names the files.
Taken: it is now{ kind: "pull", number, commits }. The chain page wording is "N commits from your parent are in pull #P" (singular "1 commit … is in pull #P").readTakeninsrc/spawn/upstream.tsreads the new shape. It drops any storedtookrecord from before this change, which shows as no taken line until the next hourly check.- Tests:
test/spawn-take.test.tsuses two local bare repos.- A parent ahead by one opens one pull with main's tip unchanged. The issue's "ahead by 2" setup is not reproduced: the tell-me test already fetches the first commit.
- One more parent commit updates the same pull (commits = 2). A repeat check says nothing again.
- A clean merge lands on the branch only, and is not re-made on a repeat check.
- A conflict opens the issue and no extra pull.
GATE: I added no test file, andscripts/gate.tsalready picks upspawn-take.test.ts.
I did not wire up the tell-me take-now action (#2642). src/ has no code for it, and the wording is shared through upstreamWords, which it can reuse. Nothing auto-merges.
To try it, set a forge to take-updates, push a commit to its parent, and wait for the hourly check. The chain page then names the pull.
🤖 Generated with Claude Code
All three points from the review are addressed on the same branch and pushed. tsc --noEmit is clean, and the take, upstream and pulls tests pass (27). I did not run the forge's full check.
- README: both passages now describe the new flow. The hourly check puts
refs/upstream/HEADonforge/take-updatesand opens or updates one pull into main. The fork's check runs on it, a person merges it, and main is never moved. They also give the new chain-page wording ("N commits from your parent are in pull #P") and say a pull closed unmerged is not reopened until the parent moves again. - Tests added in
test/spawn-take.test.ts:- A pull closed unmerged with nothing new opens nothing.
- After the parent moves, the same pull gets a fresh number.
- The update test now asserts the one
pull.pushedevent. - A stored
tookrecord is dropped byupstreamStatewithout throwing. - I did not confirm that any of these fail without the code they cover.
- Race: the branch write is now
git update-ref <ref> <new> <old>, using an all-zero old oid when the branch does not exist yet. A push toforge/take-updatesbetween the read and the write makes the write fail, and the next check looks again. I did not add a test for the race itself.
I made all four changes on the same branch and pushed. tsc --noEmit is clean, and the take and upstream tests pass (22). I did not run the forge's full check.
- Doc comment: it now sits on
TAKE_BRANCH, andZEROhas its own one-line comment saying the ref must not exist. - Test import: the two
core/issues.tsimports are merged intoimport { listIssues, setIssueState }. - Race test: the compare-and-swap write is now an exported
putBranch(dir, to, had)insrc/spawn/take.ts, andtakeFromParentcalls it. A new test moves the branch afterhadwas read and checks thatputBranchreturns false and leaves the other writer's commit in place. It also checks that a write with the right old oid succeeds, and that a create is refused when the branch already exists. CallingputBranchdirectly stands in for a push landing mid-check, since the real window can't be hit in a test. - README: it now says
forge/take-updatesbelongs to the check, and that a commit a person pushes there is overwritten by the next check that finds something different to put on it. It suggests building on a branch of your own instead.
takeFromParentno longer moves the default branch. It now puts the parent's code onforge/take-updatesand opens one pull titledtakeTitle(upstream)into the default branch, as the repo owner.tsc --noEmitis clean and the take, upstream, pulls and MCP-upstream tests pass (44 tests). I did not run the forge's full check.commit-tree, sorefs/heads/<default>is never written.pushis no longer emitted.pull.pushedis emitted when an existing pull gains commits, andforge.updates_takennow carries the pull number.Taken: it is now{ kind: "pull", number, commits }. The chain page wording is "N commits from your parent are in pull #P" (singular "1 commit … is in pull #P").readTakeninsrc/spawn/upstream.tsreads the new shape. It drops any storedtookrecord from before this change, which shows as no taken line until the next hourly check.test/spawn-take.test.tsuses two local bare repos.GATE: I added no test file, andscripts/gate.tsalready picks upspawn-take.test.ts.I did not wire up the tell-me take-now action (#2642).
src/has no code for it, and the wording is shared throughupstreamWords, which it can reuse. Nothing auto-merges.To try it, set a forge to
take-updates, push a commit to its parent, and wait for the hourly check. The chain page then names the pull.🤖 Generated with Claude Code
Closes #2649