pickman: Process review comments in step command

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().

Series-to: concept
Series-cc: heinrich
Cover-letter:
pickman: Add a manager for cherry-picks
This series adds pickman, a tool to help manage cherry-picking commits
between branches. It's designed to automate the tedious process of
cherry-picking large numbers of commits from one branch to another,
such as when maintaining a downstream branch.

Key features:
- Track source branches and cherry-pick progress in a SQLite database
- Find commits to cherry-pick up to the next merge commit
- Use Claude AI agent to automate cherry-picks with conflict resolution
- Create GitLab merge requests for review
- Handle MR review comments automatically
- Poll for continuous automated cherry-picking

The tool integrates with GitLab for MR management and uses the Claude
Agent SDK for automated cherry-picking and conflict resolution.

This tool is *very* experimental (so don't use it yourself!), but should
become usable sometime in the new year.
END

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-15 17:05:33 -07:00
committed by Simon Glass
parent 436bca1061
commit ecdd7969d3
2 changed files with 19 additions and 7 deletions

View File

@@ -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:

View File

@@ -608,8 +608,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'
@@ -635,6 +635,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