Skip to content

feat: add @cldmv-bot <command> PR comment commands, starting with @cldmv-bot rebase #371

Closed

Description

@Shinrai

Summary

Add a comment-command interface to the CLDMV bot: a maintainer comments @cldmv-bot <command> on a PR and a reusable v4 workflow runs the matching automation. The first command is @cldmv-bot rebase.

Motivation

Open PR branches regularly fall behind next, most visibly after a release when next-reset resets next to master and every open branch suddenly carries the already-released commits (see the "After a release: rebase open PR branches cut from the old next" routine). Rebasing today means a local clone, a rebase, a re-run of the gates and a --force-with-lease push. A bot command would make the common case a one-line comment.

Proposed behaviour: @cldmv-bot rebase

  • Triggered by an issue_comment event on a pull request whose body starts with @cldmv-bot rebase.
  • Only acts for commenters with write access or higher (checked with the collaborator permission API); anyone else gets a short refusal comment or a silent ignore.
  • Rebases the PR head branch onto the current tip of the PR's base branch (next, or hotfixes), keeping only the branch's own commits. After a release, where the branch was cut from the pre-release next, it uses git rebase --onto <base> <old merge-base> so the released commits drop out.
  • Re-signs the rebased commits with the bot signing key (same CLDMV_BOT_* GPG secrets the other bot commits use), so the PR stays Verified, then pushes with --force-with-lease.
  • Replies on the PR with the result: the new head sha and commit count, "already up to date", or the conflicting files when the rebase cannot complete. On conflict nothing is pushed and the branch is left untouched.
  • Reacts to the triggering comment (eyes while running, then thumbs up or confusion) so the state is visible without opening the run.

Guard rails

  • Never touches next, hotfixes, master or main, and never runs for the persistent release PRs.
  • Skips fork PRs (the token cannot push to them) and says so.
  • Refuses when the head branch moved between checkout and push (the lease fails) and reports it instead of retrying blindly.
  • One run per PR at a time (concurrency group keyed on the PR number).
  • The command text is parsed strictly (@cldmv-bot <word> [args]); unknown commands get a short help reply listing the supported ones.

Design notes

  • Implemented as a reusable workflow_call workflow (for example workflow-bot-commands.yml@v4) plus a thin caller template under examples/individual-repo-workflows/automation/, added to the standard v4 workflow set and the release-merge.yml workflow list handling as needed.
  • Dispatch through a small command table so further commands slot in without new workflows. Candidates once the mechanism exists: update-branch (merge base into head), retarget (change the PR base), rerun (re-run failed checks), docs-check (report whether the release changelog is current).
  • The comment body is untrusted input. Use it only for matching a fixed command word, never interpolate it into shell.

Acceptance

  • @cldmv-bot rebase on a normal fix/* PR whose base moved results in a rebased, signed, force-with-lease-pushed branch and a result comment.
  • The post-release case (branch cut from the old next) ends with only the branch's own commits in git rev-list --count origin/next..<branch>.
  • A conflicting rebase pushes nothing and lists the conflicts.
  • A commenter without write access cannot trigger it.
  • Documented in docs/conventions/ with the command list.

Activity

  1. added
    priority: medium
    type: feature request
    status: not started
    on Oct 10, 2026
  2. added a commit that references this issue on Oct 12, 2026
    5315400
  3. added
    status: implemented
    and removed
    status: not started
    on Oct 12, 2026
  4. cldmv-bot commented on Oct 12, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #375, merged into next. This issue closes automatically when that work ships to the default branch.

  5. cldmv-bot commented on Oct 12, 2026

    @cldmv-bot
    Contributor

    Closed in v4.33.0 — resolved by #375.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumstatus: implementedtype: feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions