image_pdfimage_print

Automating cherry-picks with AI (as seen in our introduction to pickman) was a huge step forward for U-Boot Concept maintenance. However, as any maintainer knows, theory and practice often collide when you try to apply 260+ commits in a single session.

After several weeks of real-world use, we’ve identified three “stress points” in large-scale cherry-picking:

  1. The Detail Gap: It’s hard to see if a cherry-pick subtly mangled the code just by looking at a GitLab GUI.
  2. Ghost Commits: Effort is often wasted cherry-picking commits that were already merged via a different path.
  3. Delayed Failure: Building only at the end of a 200-commit series means catching a mistake at commit #5 requires a massive amount of backtracking.

A recent series introduces a suite of safety features to address these challenges.

1. The check Command: Catching “Mangled” Commits

The star of this update is the new check command. It provides a simple, high-level audit of the “delta” between an original commit and its cherry-picked version.

If a cherry-pick results in a significantly different file structure or line count compared to the original, pickman flags it for review:

 Cherry-pick Delta% Original   Subject
 ----------- ------ ---------- -------
 aaea489b2a     100 9bab7d2a7c net: wget: let wget_with_dns work with...
 e005799d8f      33 15e0c5e390 lmb: Remove lmb_alloc_addr_flags()
 c347fb4b1a      41 99145eec2d x86: select CONFIG_64BIT for X86_64
 12 problem commit(s) found

By adding the -d (diff) option, you can see a direct patch-to-patch comparison, making it easy to spot exactly where a conflict resolution went off the rails.

2. Move Fast, Check Often: Per-Commit Validation

We have updated the AI agent prompt to be much more proactive. Instead of blindly applying a series and hoping for the best, the agent now:

  • Checks Deltas Immediately: After every successful cherry-pick, it compares the new commit stat against the original.
  • Builds Every Commit: It runs buildman after every single commit. This ensures the tree remains in a “good” state throughout the entire process.
  • Self-Correction: If a delta is too large (>20%), the agent will now attempt to reset and manually apply the changes using git apply --3way before moving forward.

3. Smarter “Already-Applied” Detection

Duplicate commits are a constant headache. pickman now includes a robust detection system that looks for matching subjects in the target branch (ci/master) before it starts work.

It doesn’t just match text; the agent now compares actual patch content. It will only skip a commit if it can be verified as the same with good confidence, drastically reducing false positives.

Key Commands in this Series

CommandDescription
pickman checkIdentifies suspect cherry-picks based on delta ratio.
pickman check -dShows a source code diff of the patch differences.
pickman check -vShows detailed stats for all commits on the current branch.

Quality and Compliance

Beyond features, this series brings the pickman codebase up to production standards. We’ve enforced 80-column compliance, cleared numerous pylint warnings, and transitioned to using Named Tuples (like AgentCommit) to ensure the code is as readable as the commits it manages.

These refinements mark a step along the path to turn pickman from an experimental AI helper into a robust repository maintenance tool.

Author

  • Simon Glass is a primary author of U-Boot, with around 10K commits. He is maintainer of driver model and various other subsystems in U-Boot.

Leave a Reply

Your email address will not be published. Required fields are marked *