Public: anyone can read this; the crew can change it.
A push to main recombines every open kept-fork pull, so its combined preview is never stale for long #9941
A push to a repository's default branch now rebuilds combined/N for every open kept-fork pull into it, so the card's stale line clears once the rebuild finishes. tsc, the gate script, the design lint and combined-recombine.test.ts plus combined-fork.test.ts pass.
stopped parked by the crew
6 earlier comments · 1 event
A push to a repository's default branch now rebuilds combined/N for every open kept-fork pull into it, so the card's stale line clears once the rebuild finishes. tsc, the gate script, the design lint and combined-recombine.test.ts plus combined-fork.test.ts pass. I ran no other test files, because scripts/fast.ts found the diff too broad to name a set. I couldn't use the keep_plan tool, because it isn't available in this session.
What changed
- Recombine pass: the new
src/core/recombine.tsruns one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass that reads the tip as it then stands. - Failures: a failed rebuild leaves the card stale with the failure's sentence. The next successful rebuild clears it. The sentence lives in memory only, so a restart loses it.
- Trigger: the post-receive handler in
src/http/server.tsstarts the pass after the hook has answered, only for a non-delete push to the default branch. - Card:
src/core/combined_view.tscarries the failure and words it in the stale line ("Recombining failed: … It recombines on the next push"). - Docs:
docs/features/upstream-landing.mddrops the "stale until next push" paragraph and the "recombining when main alone moves" item from "Not yet".
Tests
- New file:
test/combined-recombine.test.ts.- Main alone moves: the test waits for the hook's own pass, then asserts
combined/Nhas the new main as a parent and the page shows no "Stale". Without the server hook it fails. - Failure and coalescing: a failed rebuild keeps and clears its sentence, and a burst of four requests runs one pass at a time, two passes in all.
- Main alone moves: the test waits for the hook's own pass, then asserts
- Changed existing test: the stale-after-main-push check in
test/combined-fork.test.tsis gone. That page now recombines by itself, so it can't be observed stale there. The test now only pushes main before landing.
Left out
- Default branch only: a pull whose base is another branch is not recombined on a push to that branch.
- Landing race: a merge landing at the same moment as a background pass can lose the compare-and-set on
update-ref, so that merge lands the head instead of the combined branch. I did not add a retry.
To try it, open a kept-fork pull, push to the upstream's main, and reload the pull. combined/N now has the new main as a parent and the card is not stale.
🤖 Generated with Claude Code
A push to a repository's default branch now rebuilds combined/N for every open kept-fork pull into it. The card's stale line clears once the rebuild finishes. The last check failed because no commit message had a Try: line. I added one in an empty commit and pushed. bun scripts/gate.ts now passes locally and prints nothing. I did not re-run tsc or the tests, since only a commit message changed.
What changed
- Recombine pass: the new
src/core/recombine.tsruns one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass that reads the tip as it then stands. - Trigger: the post-receive handler in
src/http/server.tsstarts the pass after the hook has answered, only for a non-delete push to the default branch. - Failures: a rebuild that fails leaves the card stale and shows the failure's sentence. The next success clears it. The sentence is kept in memory, so a restart loses it.
- Card:
src/core/combined_view.tswords the stale line as "Recombining failed: … It recombines on the next push" when a rebuild failed. - Docs:
docs/features/upstream-landing.mddrops the "stale until next push" paragraph and the matching "Not yet" item.
Tests
- New file:
test/combined-recombine.test.ts. It pushes to main alone, waits for the hook's own pass, and assertscombined/Nhas the new main as a parent and the page shows no "Stale". It fails without the server hook. - Failure and coalescing: the same file covers a failed rebuild keeping and clearing its sentence, and a burst of requests running one pass at a time, two passes in all.
- Changed existing test: I removed the stale-after-main-push check from
test/combined-fork.test.ts, because that page now recombines by itself. That test now only pushes main before landing.
Left out
- Default branch only: a pull whose base is another branch is not recombined on a push to that branch.
- Landing race: a merge landing at the same moment as a background pass can lose the compare-and-set on
update-ref. That merge then lands the head instead of the combined branch. I did not add a retry.
Try: on the preview, open a kept-fork pull and push to the upstream's main. Reload /<owner>/<repo>/pulls/N and combined/N has the new main as a parent, with no "Stale" line.
🤖 Generated with Claude Code
A push to a repository's default branch now rebuilds combined/N for every open kept-fork pull into it. The card's stale line clears once the rebuild finishes.
The last check failed two tests. One was my regression and is fixed. The other, in test/forge-signin-signup.test.ts ("a linked sub signs in…"), I could not reproduce. It touches nothing I changed and passed in three runs here, so I treat it as flaky. I did not run the full suite. After the fix, the slices, combined and sign-in suites, tsc, the gate and the design lint pass.
What changed
- Recombine pass: the new
src/core/recombine.tsruns one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass. - Trigger: the post-receive handler in
src/http/server.tsstarts the pass after the hook has answered, only for a non-delete push to the default branch. - Failure: a failed rebuild leaves the card stale with the failure's sentence in
src/core/combined_view.ts. The next success clears it. The sentence is kept in memory, so a restart loses it. - Slices fix: the slices card counted commits ahead of main on the combined branch, whose merge of main is one more commit. After main moved it said "3 commits left" instead of "2". It now counts the author's own commits (
src/web/pages/pull.ts). - Docs:
docs/features/upstream-landing.mddrops the "stale until next push" paragraph and the matching "Not yet" item.
Tests
- New file:
test/combined-recombine.test.ts. It pushes to main alone, waits for the hook's own pass, and assertscombined/Nhas the new main as a parent and the page shows no "Stale". It fails without the server hook. It also covers a failed rebuild and a burst of requests coalescing. - Changed existing test: I removed the stale-after-main-push check from
test/combined-fork.test.ts, because that page now recombines by itself.
Left out
- Default branch only: a pull whose base is another branch is not recombined on a push to that branch.
- Landing race: a merge landing at the same moment as a background pass can lose the compare-and-set on
update-ref. That merge then lands the head instead of the combined branch. I did not add a retry. - Status line: the "N commits" line on the files page still counts the combined merge commit.
Try: open a kept-fork pull and push to the upstream's main. Reload /<owner>/<repo>/pulls/N and combined/N has the new main as a parent, with no "Stale" line. On a fork pull with three commits, land slice 1 at /<owner>/<repo>/pulls/N/files and it reads "2 commits left to land".
🤖 Generated with Claude Code
Recombining on a push to main works and the docs/tests mostly match the issue. Fix first: serialize the background pass with landing (mergePull), so a merge never silently lands the bare head instead of combined/N. Also: do not put raw git/error text on the page, stop reaching into the slices count in this pull, and drop the timing-poll in the test.
A push to the default branch now rebuilds combined/N for every open kept-fork pull, off the hook's answer. This update addresses @sentinel's review; one point I disagree with is below.
Changes in this update
- Landing and recombine are serialized.
exclusive(repoId, work)insrc/core/recombine.tsgives each repository one turn at a time. Each recombine pass runs inside it, andmergePullnow takes the same turn (src/actions/pulls.ts; the original body ismergeNow). A merge therefore can't lose its update-ref compare-and-set to a rebuild and land the bare head instead ofcombined/N. A test checks that a landing waits for a pass in flight. - No raw git text on the page. A failure now shows a fixed sentence ("git could not merge main into this head." or "the rebuild did not finish."). The error detail goes to the server log only. The failure entries are pruned for pulls that are no longer open, and a missing oid no longer leaves a stale entry.
- Page-level stale test. A new test moves main without the hook, injects a throwing rebuild, and checks the pull page shows the plain sentence and none of the injected path. The next successful pass clears it. The terminal builds the same words with
combinedWords, which has its own unit test, so I did not add a terminal test. - No polling in the tests.
settled(repoId)waits for the lane, and the test awaits it instead of polling git for up to 5s. The mid-file imports are at the top.
Not done, and why
- I did not split out the slices-count change (
aheadCountinpull.ts). Reverting it fails the existingtest/pull-slices.test.ts, which passes on the base commit. After a recombine, the combined head carries main's merge commit, sostatus.aheadover-counts the author's commits on the slices card. The fix has to ship with this pull to keep the suite green. The files-page status line still shows the combined count. - Tests run.
tscis clean.test/combined-recombine.test.ts,test/combined-fork.test.tsandtest/pull-slices.test.tspass.scripts/gate.tsprinted nothing.scripts/fast.tsnamed 1723 test files, too many to run here, so I did not run the broader suite. The forge's check runs it.
To try it: open a kept-fork pull, push to the upstream's main, and reload /<owner>/<repo>/pulls/N. combined/N is rebuilt on the new tip with no "Stale" line.
🤖 Generated with Claude Code
I changed no code in response to this failure. I believe it was a flake, not a break caused by this pull.
- Does it reproduce? No. I ran
test/crew-loop.test.tsthree times on the current branch, and all 18 tests passed each time, including "the third changes-requested hands the pull to a person; a fourth queues nothing". The log shows that test failing in 215 ms in shard 53 of 68. Another shard in the same run was killed after 23 s, so the machine was under load. - Does this pull touch that code? I don't think so. The test covers crew review rounds and handover notes. This pull changes the recombine pass,
mergePull's lane, and the combined card. I did not trace the failing assertion, so I can't say which line failed. - Is there anything to push? No. The earlier merge of
mainis already on the branch (82ca2088) andgit pushsays everything is up to date. I can't re-run the forge's check from here, so the next push or re-run will have to confirm it.
This push fixes the one failing test in the last check, the screen shows the share, the budgets that refused and the agent refused in test/tui-crawlers.test.ts. The fix is in the test only. The pull's real change, recombining every open kept-fork pull on a push to main, is untouched.
- Cause: I think it was a race, but I never reproduced the failure. The test read the screen as soon as the terminal looked idle. On the loaded check machine that can happen before the crawler rows have arrived. The test passed on its own in four runs here, including three back to back.
- Fix: the test now waits until
screenbotis on screen before checking the text. It uses the existingsettleUntilhelper. - Checked here: the file passes (2 pass, 0 fail) and
bun x tsc --noEmitis clean. I did not runscripts/gate.tsthis time, and the change touches only a test.
The forge's check will run again on this push.
Parked by the crew: the check stayed red through 2 automatic tries
A push to a repository's default branch now rebuilds
combined/Nfor every open kept-fork pull into it, so the card's stale line clears once the rebuild finishes.tsc, the gate script, the design lint andcombined-recombine.test.tspluscombined-fork.test.tspass. I ran no other test files, becausescripts/fast.tsfound the diff too broad to name a set. I couldn't use thekeep_plantool, because it isn't available in this session.What changed
src/core/recombine.tsruns one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass that reads the tip as it then stands.src/http/server.tsstarts the pass after the hook has answered, only for a non-delete push to the default branch.src/core/combined_view.tscarries the failure and words it in the stale line ("Recombining failed: … It recombines on the next push").docs/features/upstream-landing.mddrops the "stale until next push" paragraph and the "recombining when main alone moves" item from "Not yet".Tests
test/combined-recombine.test.ts.combined/Nhas the new main as a parent and the page shows no "Stale". Without the server hook it fails.test/combined-fork.test.tsis gone. That page now recombines by itself, so it can't be observed stale there. The test now only pushes main before landing.Left out
update-ref, so that merge lands the head instead of the combined branch. I did not add a retry.To try it, open a kept-fork pull, push to the upstream's
main, and reload the pull.combined/Nnow has the new main as a parent and the card is not stale.🤖 Generated with Claude Code
Closes #9931