Repository navigation
Automate more of the pinned-PR merge treadmill - #110
danielhanchen wants to merge 3 commits into
Conversation
A shared line only proves one construct was added twice when it is distinctive. A closing brace is not, and neither is a line the file already repeats outside the conflict, so both sides appending a block now unions instead of stopping the build. Sides that overlap must also each be brace-balanced. The RPC version triple gets a three-way merge per field, which settles the usual case (upstream bumps minor, a pin bumps patch) without encoding a bump convention, and refuses when one field moved on both sides or the major changed. The neighbouring op-count assert is checked against the merged enum rather than rewritten. Over the real history of the two pinned branches this takes files needing a human from 15 to 10, and still refuses the one case where the union would have been a redefinition.
… mix repin.py cloned the pin URL's owner with --filter=blob:none and then merged, so every blob came back from the promisor one at a time. When a pin's branch lives in a fork, or history names an object that has since been force-pushed away, that fetch fails and the merge dies. Clone in full and also fetch the PR's real head repo. Worse, any non-zero merge exit was labelled 'conflict, not resolvable automatically', including additive_merge crashing. Two pins reported that daily for weeks and it read as ordinary churn. A merge that leaves no conflicted file is not something a human can resolve by editing code, so it gets its own action and its own line in the report. Preflight also now compiles what it merged. Upstream deleting an enum value a pin still names, or changing a signature a pin still calls the old way, merges cleanly and does not build; both shipped on 08-26. CPU only with examples and tools on, which is what reaches the two files that broke, and it says in the alert what it did not check.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82a1be265c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # A closing brace is not, and neither is a line the file already repeats | ||
| # outside this conflict: both sides writing `common_chat_params data;` means | ||
| # they both wrote a function of that file's usual shape, not the same one. | ||
| distinctive = sorted(s for s in shared if not is_delimiter(s) and s not in elsewhere) |
There was a problem hiding this comment.
Keep repeated control lines out of automatic unions
When both branches add the same new block and its header already occurs elsewhere in the file, such as another if (flag) {, this condition removes the only non-delimiter overlap from distinctive; because each block is brace-balanced, the resolver then concatenates and commits both potentially conflicting implementations. An occurrence elsewhere does not prove that the additions are independent, so this case must remain unresolved unless their identities can be established independently.
Useful? React with 👍 / 👎.
| # A configure failure is usually the runner, not the code. Say so | ||
| # and stay green: a gate that cries wolf is a gate people mute. | ||
| echo "::warning::preflight compile could not configure; not treating this as a pin failure" | ||
| tail -30 configure.log | ||
| echo "status=skip" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Treat source configure failures as gate failures
In this added compile gate, every CMake configure failure is converted to status=skip. A merged pin can itself break configuration through invalid CMake, a missing source directory, or incompatible option changes; in that case the compile alert is skipped and the workflow remains green even though the nightly cannot build the tree. Environmental failures may warrant a retry, but a persistent configure failure must fail the gate rather than being unconditionally ignored.
Useful? React with 👍 / 👎.
| - name: Fail the run when the merged tree does not compile | ||
| if: ${{ steps.compile.outputs.status == 'failure' }} | ||
| run: | | ||
| echo "::error::pins merge but the merged tree does not compile; see the alert above" |
There was a problem hiding this comment.
Do not launch the repin bot for compile-only failures
For a tree that merges cleanly but does not compile, this new exit 1 gives the workflow a failure conclusion; the inspected .github/workflows/unsloth-repin-bot.yml runs on every failed preflight workflow_run. That bot can only merge the base into pinned branches, so it cannot repair the deleted-enum or changed-signature failures this gate targets and can instead push merge commits and open a repin PR whose tree still fails to compile. Compile failures need reporting without using the merge-conflict conclusion that triggers the repin bot.
Useful? React with 👍 / 👎.
An unused variable in a pinned arch compiled clean on every Linux leg and on this gate, then failed both macOS legs and sank a four-hour release that had already produced 39 green jobs and published nothing. macOS is the only release leg that configures LLAMA_FATAL_WARNINGS=ON, and cmake/common.cmake turns it into -Werror for GNU and Clang alike, so a gcc build here reproduces the mechanism rather than approximating it. Without the flag this gate is structurally blind to the entire warning class. Costs nothing. LLAMA_ALL_WARNINGS is already ON by default, so the diagnostics were being computed either way; -Werror only changes their severity. Verified by building the composed pin set both ways and comparing every object file: 215 of 215 byte-identical, so no effect on the code that ships or on build time. Does not touch any release workflow, and this gate is GGML_CUDA=OFF, so the CUDA legs are unaffected in both senses.
Three changes to cut the manual resync work on pinned PR branches.
add-inklingneeded 10 resync merges in a month; I did one of them by hand yesterday and went looking for why the existing automation was not doing it.1.
repin.pywas failing daily, and calling it a conflictThe repin bot works. On 08-25 it auto-repinned
#70and#95. On the same run it said this about the other two:Note its own words: "merge failed with no conflicts". That is not a conflict, it is the blobless clone failing to re-fetch an object. Of the three shas in that message, two are fetchable from both repos and
7b0249da97exists in neither, which is what a force-pushed-away object looks like from a partial clone.repin_one()cloned the pin URL's owner (ggml-org) with--filter=blob:none, so a PR whose branch lives in a fork has history the promisor cannot serve. Now it clones in full and also fetches fromhead.repo.full_name, which it already knew.The more useful half:
L143-152labelled any non-zero merge exit asconflict, includingadditive_merge.pyitself crashing. A merge that leaves no conflicted file is not something a human can fix by editing code, so it now getsaction="error", its own row in the report, and its own count in the bot, separate from "pins need a human".Honest limit: the original failure no longer reproduces. I A/B'd old and new clone flags against the same pin and base today and both reach a genuine conflict, so I have not demonstrated old-fails/new-succeeds. The reasoning about the mechanism is sound and a full clone removes the lazy-fetch path entirely, but it is untested against the live failure. The reclassification is the part I would defend hardest, and it stands on its own.
2. Preflight now compiles what it merged
Preflight proved only that pins textually merge. Nothing compiled the mix until the nightly published it, 3.5h later, with 39 build jobs already running. Both breakages I fixed on 08-26 merged perfectly cleanly:
RESIZE_ALGO_BICUBIC_PILLOWwhile a pin still named itcommon_jsonwrapper in front of nlohmann while a pin still called the old signatureNeither conflicted, so no amount of better conflict resolution would have caught either. The second is the nastier one: the prebuilt workflows build the diffusion example targets best-effort and never fail the job, so it would have shipped bundles quietly missing binaries.
New step after the merge probe, gated on it succeeding, building the already-merged
scratch/tree. CPU only,EXAMPLES=ONandTOOLS=ONbecause those are what reach the two files that broke (the nightly's own CPU child usesEXAMPLES=OFF). ccache via the action already pinned in the CPU child.Proved against both real breakages, each reintroduced in isolation and built with the gate's exact flags:
and the corrected carries build clean under the same flags (149/149).
A configure failure warns rather than failing the run; only a compile error goes red. The alert states what the gate did not check (CUDA, Metal, Vulkan, HIP, SYCL, anything at runtime) so a green result is not overread.
3.
additive_merge.pyresolves two more shapesMeasured over the real merge history of both pinned branches, the resolver already handled 16 of 31 conflicted files. Of the 15 refusals, 4 were false alarms.
Shared lines. It refused if both sides' additions shared any line. A shared line only proves "one construct added twice" when it is distinctive: a closing brace is not, and neither is a line the file already repeats outside the conflict. Both sides writing
common_chat_params data;means they both wrote a function of that file's usual shape. Sides that overlap must also each be brace-balanced, so the union is two complete blocks and never two fragments.The RPC version triple gets a three-way merge per field. Upstream bumps minor, a pin bumps patch, each field moved on one side only, so ordinary three-way settles it without encoding any bump convention. It refuses when a field moved on both sides or the major changed. The neighbouring
static_assert(GGML_OP_COUNT == N)is checked against the merged enum rather than rewritten, because a stale count there is exactly the silent wire mismatch that header exists to prevent.Validated against all five historical refusals using the human's actual resolution as ground truth:
clip-model.hx2,ggml-backend-meta.cpp};common/chat.cppmtmd-image.cppOn the RPC case it reproduces the hand resolution byte for byte, alignment included.
Net over the real corpus: files needing a human go from 15 to 10, and the one case where the union would have been wrong is still refused.
These rules run in the nightly's resolve step too, so the safety bar is a release build. Both refuse on ambiguity, and item 2 means a bad union now has to survive a compile.
test_additive_merge.pygains cases for every shape above including the must-refuse one, and the suite is wired into CI, which it never was.