Skip to content

Self-review checkbox: /improve publishes it, but nothing handles the tick #3808

Description

@Yoel-qin

Feature request

/improve publishes an author self-review checkbox when demand_code_suggestions_self_review = true (pr_code_suggestions.py:495-505 appends - [ ] {text} plus one of three hidden markers: <!-- approve pr self-review -->, <!-- fold suggestions self-review -->, <!-- approve and fold suggestions self-review -->). But nothing reacts when the author ticks it: the webhook branch that should handle the edit is a stub,

# pr_agent/servers/github_app.py:409-410
elif event == "issue_comment" and 'edited' in action:
    pass # handle_checkbox_clicked

and both halves of the designed reaction have no caller from this path:

  • the fold rendering exists unreached: publish_persistent_comment_with_history(..., only_fold=True) (pr_code_suggestions.py:613, the if only_fold: branch at :732) — its only invocation passes only_fold=False (:621);
  • the approve primitive exists unreached from here: auto_approve() (github_provider.py:2033, pr.create_review(event="APPROVE")) is only called from the /review flow (pr_reviewer.py:1577).

So demand_code_suggestions_self_review renders a dead checkbox, and approve_pr_on_self_review / fold_suggestions_on_self_review (configuration.toml:265-268) are advertised knobs with no reachable implementation.

Proposal

Handle the tick in the GitHub app:

  1. In the issue_comment + edited branch, compare changes.body.from with comment.body: the self-review line flipped - [ ] → - [x] and the body carries one of the three self-review markers.
  2. Verify the comment is PR-Agent's own suggestions comment (is_comment_authored_by_pr_agent, git_provider.py:895) and the editor (webhook sender) is the PR author (provider pr.user.login), so a bystander ticking the box cannot approve someone's PR.
  3. Act per the marker: re-render folded via publish_persistent_comment_with_history(..., only_fold=True), and call auto_approve() when the marker says approve. Approving uses the same review API the app already uses for feedback, so pull_request_reviews: write should already hold — worth confirming on the app settings.
  4. Unit tests with issue_comment edited payload fixtures: an author tick folds/approves per the marker; an edit that does not touch the checkbox is ignored; a non-author tick is ignored; a comment without a marker is ignored.

Scope: the GitHub app only, where the stub sits. The Action runner could share the same detection later via servers/github_common.py (the #3785 pattern), and other providers' servers can follow if they want the feature.

Motivation

The checkbox is the one human-in-the-loop affordance the bot already publishes; wiring it gives authors an explicit "I read the suggestions" gesture that folds the noise and (opt-in) approves the PR, and turns three documented config keys into working behavior.

Activity

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

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions