[Concept,17/17] pickman: Process review comments in step command

Message ID 20251217022611.389379-18-sjg@u-boot.org
State New
Headers
Series pickman: Add a manager for cherry-picks |

Commit Message

Simon Glass Dec. 17, 2025, 2:26 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Have the step command also process review comments when there are open
MRs. This integrates the review functionality into step, so a single
poll loop can handle the full workflow: process merged MRs, handle
review comments, and create new MRs when ready.

Refactor process_mr_reviews() as a helper function used by both
do_review() and do_step().

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 tools/pickman/README.rst | 18 +++++++++++++-----
 tools/pickman/control.py |  8 ++++++--
 2 files changed, 19 insertions(+), 7 deletions(-)
  

Patch

diff --git a/tools/pickman/README.rst b/tools/pickman/README.rst
index 07b9408afa0..b469470138b 100644
--- a/tools/pickman/README.rst
+++ b/tools/pickman/README.rst
@@ -25,9 +25,15 @@  The typical workflow for using pickman is:
 
 4. **Repeat**: Go back to step 2 until all commits are cherry-picked.
 
-For automated workflows, use ``step`` instead of ``apply -p``. It checks for
-open pickman MRs first and only creates a new one if none are pending. Use
-``review`` to have the agent address MR comments.
+For fully automated workflows, use ``poll`` which runs ``step`` in a loop. The
+``step`` command handles the complete cycle automatically:
+
+- Detects merged MRs and updates the database (no manual ``commit-source``)
+- Processes review comments on open MRs using Claude agent
+- Creates new MRs when none are pending
+
+This allows hands-off operation: just run ``poll`` and approve/merge MRs in
+GitLab as they come in.
 
 Usage
 -----
@@ -122,11 +128,13 @@  This command performs the following:
 1. Checks for merged pickman MRs and updates the database with the last
    cherry-picked commit from each merged MR
 2. Checks for open pickman MRs (those with ``[pickman]`` in the title)
-3. If no open MRs exist, runs ``apply`` with ``--push`` to create a new one
+3. If open MRs exist, processes any review comments using Claude agent
+4. If no open MRs exist, runs ``apply`` with ``--push`` to create a new one
 
 This is useful for automated workflows where only one MR should be active at a
 time. The automatic database update on merge means you don't need to manually
-run ``commit-source`` after each MR is merged.
+run ``commit-source`` after each MR is merged, and review comments are handled
+automatically.
 
 Options for the step command:
 
diff --git a/tools/pickman/control.py b/tools/pickman/control.py
index aaed06c1e35..86ecc5574e7 100644
--- a/tools/pickman/control.py
+++ b/tools/pickman/control.py
@@ -600,8 +600,8 @@  def do_step(args, dbs):
     """Create an MR if none is pending
 
     Checks for merged pickman MRs and updates the database, then checks for
-    open pickman MRs and if none exist, runs apply with push to create a new
-    one.
+    open pickman MRs. If open MRs exist, processes any review comments. If no
+    open MRs exist, runs apply with push to create a new one.
 
     Args:
         args (Namespace): Parsed arguments with 'source', 'remote', 'target'
@@ -627,6 +627,10 @@  def do_step(args, dbs):
         tout.info(f'Found {len(mrs)} open pickman MR(s):')
         for merge_req in mrs:
             tout.info(f"  !{merge_req['iid']}: {merge_req['title']}")
+
+        # Process any review comments on open MRs
+        process_mr_reviews(remote, mrs)
+
         tout.info('')
         tout.info('Not creating new MR while others are pending')
         return 0