Skip to content

feat(roadmap): a review unit posts a COMMENT review on each ready PR #5521

Open

Description

@dan-petty

Problem or Motivation

A bot PR gets the ready mark when its checks pass. No reviewer looks at the diff against the issue, the plan and the project rules. #3049 planned a devops review call inside the implement job, with a repair round for high findings. #2867 planned a model evaluator that marks a draft ready. D7 of the approved pipeline split design (tracker #5482) replaces both with one review unit. The review unit posts a COMMENT review and never approves. Watch reads its verdict as a draft reason only after E4.

Proposed Solution & Architectural Design

  • A unit runs devops review on each ready delivery PR head that has no review.head equal to that head. Event: ready_for_review. Semaphore agent. At most 3 rounds for each PR.
  • It also checks plan conformance: each task is ticked, and each acceptance criterion of the issue has a change or a test.
  • It posts a COMMENT review and writes review.{head, round, verdict} in the record. It never approves. Only a person merges.
  • Watch reads a failed verdict as a draft reason only after E4 (feat(roadmap): measure the precision of the review unit on 30 PRs #5522) shows 80 % precision or more on 30 PRs. Until then, the unit runs in shadow.
  • The review spend is one model correlation for each ready PR head (ADR 0005: tools find the issues, the model correlates).
  • The unit writes the job result line of feat(review): each review session writes a job result line #5170.

Target Subsystem

Roadmap Service and roadmap jobs (src/devops_cli/roadmap/, src/devops_cli/review/).

Acceptance Criteria

  • Test first: a diff with a seeded high-severity finding gives a failed verdict and a COMMENT review, and no approval. The test fails on the base.
  • A test: a head that has a review.head record gets no second review.
  • A test: the fourth round of one PR is refused.
  • Live proof: after the merge and the release, the unit runs as the App in shadow on the ready delivery PRs of 14 days. A comment on this issue gives the result lines and the verdicts.

Existing Tool Considered

devops review (ADR 0005) and the GitHub pull request reviews API (event COMMENT) cover the need. A review check run is deferred until E4. Build: 300,000 to 500,000 agent tokens and 1 day.

Related

Tracker #5482, Phase 7. Depends on #5024 and #5170. It replaces #3049 and #2867. #5522, #5505.

Source: #5482

Alternatives check of 2026-11-23: in-use.
The repository already uses this tool.
Tool: dan-petty/devops-cli (https://github.com/dan-petty/devops-cli), MIT, last activity 2026-11-23, maintained.
Reason: Searches found no other maintained reviewer; the repository's own devops roadmap step review already gives the facts-first verdict, one model call per head, the round cap and the result line, but no COMMENT review writer, trigger, conformance check or shadow mode.

Covers:

  • Facts-first verdict with needs fix on a high finding
  • One model correlation for each head and issue text
  • Round cap of 3 verdicts for each pull request
  • Job result line for each attempt

Lacks:

  • No pull request review writer with event COMMENT
  • No ready_for_review trigger unit under the agent semaphore
  • No acceptance-criterion and tasks.md conformance check
  • No shadow value of roadmap.review.mode

Proposed design

Problem statement

A ready bot pull request gets only its checks. No review compares its diff with the issue, the plan and the project rules. The existing devops roadmap step review gives a verdict, but no unit runs it on a ready delivery head and it posts no pull request review. This issue adds the unit: it triggers on ready_for_review, runs the step, checks plan conformance, posts a COMMENT review that never approves, records the verdict, and runs in shadow until E4 measures it. Only a person merges. The 14-day live proof is a separate issue.

Acceptance criteria

Requirement: Ready event starts one review

The review unit SHALL run devops roadmap step review once for a ready delivery pull request head and issue text that review.key does not name.

Scenario: New ready head

  • WHEN A pull_request ready_for_review event names a delivery pull request whose head and issue text review.key does not name.
  • THEN The unit runs one review under the agent semaphore, writes review.pull, review.head, review.key, review.rounds and review.verdict in the item job record, and posts one COMMENT review.

Requirement: COMMENT review writer

The review unit SHALL post one pull request review with event COMMENT and SHALL NOT send an APPROVE review.

Scenario: Post the review

  • WHEN The unit posts the review for a judged head.
  • THEN The GitHub client sends one POST /repos/{owner}/{repo}/pulls/{n}/reviews with event=COMMENT and sends no request with event=APPROVE.

Requirement: No second review for the same head

The review unit SHALL NOT review again a head and issue text that review.key names, when no new fact changed.

Scenario: Repeated ready event

  • WHEN A second ready_for_review event names a head and issue text that review.key already names, with no new fact.
  • THEN The unit makes no model call, posts no second COMMENT review, and leaves review.rounds unchanged.

Requirement: Round cap

The review unit SHALL refuse a review when review.rounds for the pull request reaches roadmap.review.rounds, 3 by default.

Scenario: Fourth round

  • WHEN A delivery pull request holds review.rounds equal to 3 and a new head has no matching review.key.
  • THEN The unit returns capped, posts one comment for a person, makes no model call, and writes no new round.

Requirement: High finding fails the review

The review unit MUST give needs fix, post a COMMENT review and send no APPROVE review for a high-severity finding.

Scenario: Seeded high finding

  • WHEN A test diff holds a seeded high-severity finding and the unit runs the review.
  • THEN The test fails on the base commit; with the unit the verdict is needs fix, the review is a COMMENT review, and the client sends no APPROVE review.

Requirement: Plan conformance tasks

The review unit SHALL fail plan conformance when a task in the change tasks.md is not ticked.

Scenario: Unticked task

  • WHEN The change tasks.md has an unticked task and the unit runs plan conformance.
  • THEN Plan conformance returns failed, the verdict is needs fix, and the COMMENT review names the unticked task.

Requirement: Plan conformance criteria

The review unit SHALL fail plan conformance when an issue criterion lacks a quoting spec-delta requirement or a test-selection module.

Scenario: Unmapped criterion

  • WHEN An acceptance criterion of the issue has no requirement in the change spec delta that contains its text, or the test selection names no test module for the change.
  • THEN Plan conformance returns failed, the verdict is needs fix, and the COMMENT review names the unmapped criterion.

Requirement: Shadow mode

The review unit SHALL post its COMMENT review and write its verdict in the shadow mode of roadmap.review.mode without changing draft readiness.

Scenario: Shadow failed verdict

  • WHEN The unit runs in the mode shadow and writes a needs fix verdict.
  • THEN The unit posts the COMMENT review, writes the verdict and no verdict label, and the draft or ready state of the pull request stays unchanged.

Requirement: Job result line

The review unit SHALL write one job result line through log_job_result with the job review for each judged or failed attempt.

Scenario: Result line for one head

  • WHEN The unit completes a review attempt for one pull request head.
  • THEN One JSON result line names the job review, the item, the round, the verdict and the model call count.

Requirement: One model correlation for each head

The review unit SHALL make at most one model correlation call for each head and issue text.

Scenario: Model call count

  • WHEN The unit reviews one new head and issue text with the model.
  • THEN The unit makes one model call for that head and issue text and no second call for the same pair.

Existing Tool Considered

The alternatives check of 2026-11-17 records in-use for dan-petty/devops-cli (MIT, maintained); the issue body's alternatives block is the source for what the tool covers and lacks. The repository already holds the step devops roadmap step review in src/devops_cli/roadmap/steps/review.py, which gives the facts-first verdict, one model call for each head and issue text, the round cap and the job result line. The unit adds the ready_for_review trigger, the COMMENT review writer, the acceptance-criterion conformance and the shadow mode. The issue estimates 300,000 to 500,000 agent tokens and 1 day for the missing unit. The 14-day live proof is deferred to a new issue.

Key questions

  • How does the unit start on a ready delivery pull request?: The Service subscribes to the pull_request ready_for_review event and runs the review unit scoped to that event under the semaphore agent. The unit calls devops roadmap step review for the head. (best practice) [sources: src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/steps/review.py, CONTEXT.md]
    • Chosen: Webhook event under the agent semaphore. The Service already routes subscribed events, and the semaphore keeps the model work bounded.
    • Rejected: Polling row of the Service. A poll reads every open pull request and reviews a ready head later than the event.
  • How does the unit post the review?: The unit posts a pull request review with event COMMENT through a new client method for POST /repos/{owner}/{repo}/pulls/{n}/reviews. The existing comment_on_pull writes an issue comment, so the review writer is new. The unit sends no APPROVE event. (best practice) [sources: src/devops_cli/github/client.py:610, src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/steps/comment.py]
    • Chosen: Pull request reviews API with event COMMENT. The issue asks for a COMMENT review, and the reviews API is the only way to post a review.
    • Rejected: An issue comment on the pull request. comment_on_pull writes an issue comment, not a review.
    • Rejected: An APPROVE review. An approval would make the bot a merge gate; only a person merges.
  • Where does the unit keep the reviewed head, round and verdict?: It keeps review.pull, review.head, review.key, review.rounds and review.verdict in the item job record, the hidden block at the end of the issue body. The record holds the state across reruns; the COMMENT review is the visible result. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, src/devops_cli/roadmap/stores/store.py, CONTEXT.md]
    • Chosen: Item job record in the issue body. The existing review step records review.pull, review.key, review.rounds and review.verdict there.
    • Rejected: Pull request review body. A review body is not durable state and cannot stop a second review.
    • Rejected: A label. A label cannot hold a head SHA, a round and a verdict.
  • Which record key stops a second review for the same head?: The unit keeps review.key, the existing value <pull>:<head>:<text hash>. A changed issue text on the same head is a new fact and gets a new review. The unit also writes review.head for the issue's record. (best practice) [sources: src/devops_cli/roadmap/steps/review.py]
    • Chosen: Keep review.key and add review.head. The step already keys the model call by pull request, head and issue-text hash, so a changed text is judged again.
    • Rejected: Use a bare review.head only. A head alone would suppress the review of a head whose issue text changed.
  • How does the unit count the 3-round cap?: It reuses review.rounds with review.pull. The unit increments the count only when it writes a verdict. The cap is roadmap.review.rounds, 3 by default. A repeated event for the same head and issue text writes no verdict and spends no round. At the cap the unit returns capped, posts one comment for a person and makes no model call. (best practice) [sources: src/devops_cli/roadmap/steps/review.py]
    • Chosen: Reuse review.rounds and roadmap.review.rounds. The step already counts the verdicts of one pull request and caps them at the setting.
    • Rejected: Count one round for each event. A repeated event would spend a round and could refuse a valid new head.
    • Rejected: Add a second counter. A second counter would drift from the count that the step's cap reads.
  • How does plan conformance decide that each task is ticked and each acceptance criterion has a change or a test?: The check is deterministic. The unit fails when the change tasks.md has an unticked task. The unit also fails when an acceptance criterion of the issue has no requirement in the change spec delta that contains its text, or when the test selection names no test module for the change. The COMMENT review names the missing task or criterion. (best practice) [sources: src/devops_cli/roadmap/implement/implement_pull.py:247, src/devops_cli/roadmap/steps/ready.py:32, src/devops_cli/core/test_selection.py, src/devops_cli/roadmap/steps/review.py]
    • Chosen: Deterministic check of tasks.md, the spec delta and the test selection. The check is repeatable and names the missing item.
    • Rejected: Ask the model to judge each criterion. A model verdict is not repeatable and cannot show a missing task tick or test module.
  • How does a high-severity finding decide the verdict?: A high-severity finding in the review facts gives needs fix by a rule before the model. The evidence names the finding, and the model is not asked. ADR 0005 keeps defect detection in tools and checked facts. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, src/devops_cli/roadmap/steps/review.py]
    • Chosen: A rule on the finding before the model. ADR 0005 gives the finding to a tool, and the step already decides facts by rules before the model.
    • Rejected: Let the model weigh the finding. The same finding would get different verdicts across runs.
  • What is shadow mode?: It is a new value shadow of roadmap.review.mode. The unit reads the facts, asks the model, posts the COMMENT review and writes the record, but writes no verdict label and changes no draft or ready state. The mode on writes the label and takes the next action; the mode off sends no request. (best practice) [sources: src/devops_cli/roadmap/steps/review.py, CONTEXT.md]
    • Chosen: A shadow value of roadmap.review.mode. One setting decides the step's behavior, and shadow is on without the label write and the next action.
    • Rejected: A separate boolean setting. A second setting allows contradictory states.
    • Rejected: Reuse the mode off. off sends no request, so it posts no COMMENT review and records no verdict.
  • Does the unit approve or merge a pull request?: No. The unit posts a COMMENT review only and sends no APPROVE event. A mergeable verdict marks a draft ready for review in the mode on, and only a person merges. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/steps/review.py]
    • Chosen: COMMENT review only. CONTEXT.md says a person merges, and the issue says the unit never approves.
    • Rejected: APPROVE review. An approval would make the bot a merge gate.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5024, #5170

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
    • Possible duplicate: feat(roadmap): Run devops review on the diff before marking PR ready #3049, which may ask for the same change. The model names Running 'devops review' on each ready delivery PR, checking plan conformance, and posting findings in the PR as the change that both ask for. The candidate explicitly replaces #3049 and delivers the same result: 'devops review' on ready PRs with plan-conformance check and findings posted. A person closes one of the two if that is so.
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Web searches returned nothing usable on this niche need, but the project's own devops review (ADR 0005) already produces tool-backed findings and a verdict on a diff; the roadmap unit around it, plan conformance, round cap and record writes do not exist.

    The repository already uses this tool.

    Tool: dan-petty/devops-cli (https://github.com/dan-petty/devops-cli), MIT, last activity 2026-11-17, maintained.

    Covers:

    • Tool-extracted findings on a pull request diff
    • Model correlation of those findings into a verdict
    • High-severity findings drive a failed verdict

    Lacks:

    • No unit runs on the ready_for_review event
    • No plan conformance check of ticked tasks and criteria
    • No review.head record, round cap or shadow mode
    Searches (5)

    Tools considered:

    Searches run:

    • devops-cli "devops review" command posts pull request review findings, results: 5
    • dan-petty devops-cli review command documentation findings, results: 5
    • open source bot posts pull request review comment checks acceptance criteria against diff, results: 5
    • reviewdog danger-js post review comments on GitHub pull request, results: 5
    • Qodo PR-Agent open source automated pull request review bot, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Owner question: When does the unit leave shadow mode? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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

    effort/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions