Skip to content

feat(pr): post the check results of a pull request as a comment #3199

Closed

Description

@dan-petty

Problem or Motivation

CONTRIBUTING.md says to put test results, check status and the fail-to-pass evidence in a comment on the pull request, and never to type counts by hand. No command writes that comment. In one session of agent work, every agent that opened a pull request reported "no tool for a check-results comment", and typed the results into its report or into a comment by hand. A hand-typed count can be wrong, and a comment differs from one pull request to the next.

Proposed Solution & Architectural Design

  • Add devops pr evidence <number>. It reads the check runs of the head commit from GitHub, and the fail-to-pass check run when the pull request is a fix. It writes one comment: the head commit, a table of the checks with their conclusion and link, the fail-to-pass run link, and a line for each skipped check.
  • The command keeps one comment: a marker line lets it update its own comment on a new head, and it never posts a second one.
  • It takes no free text. The numbers come from GitHub, so a person cannot type a wrong count.
  • --dry-run prints the comment and the requests, as the other pr commands do. Pacing and rate limits follow devops gh.
  • The comment ends with the attribution footer when run by an agent.

Open questions for the refine step: whether .github/workflows/fail-to-pass.yml already posts a comment for a fix (if it does, the command only adds the table); and whether the Service's implement job can call the same function for its own pull requests (see #3032, a trace in the pull request comment).

Target Subsystem

src/devops_cli/commands/pr.py and a new module for the comment text.

Existing Tool Considered

GitHub shows check results on the pull request page, and a workflow could post a summary. No existing action posts one comment per head with the project's rules and the fail-to-pass link. Cost to build: about 60k tokens and 3 hours. To keep: one template and its tests.

Related: #3032, #2585.

Proposed design

Problem statement

No command writes the check-results comment that CONTRIBUTING.md requires. Agents type counts by hand, so a count can be wrong and comments differ between pull requests. Add devops pr evidence to read GitHub check runs and post one stable comment.

Acceptance criteria

Requirement: Read head commit checks

The devops pr evidence command SHALL read the check runs of the pull request head commit from GitHub.

Scenario: Reads checks for the head commit

  • WHEN A test runs devops pr evidence 42 against a recorded pull request with one head commit and two check runs.
  • THEN The command requests the check runs for that head commit SHA and builds a table with both check runs.

Requirement: Comment content

The command SHALL write one comment that holds the head commit, a table of checks with conclusion and link, the fail-to-pass run link for a fix, and one line for each skipped check.

Scenario: Builds the comment text

  • WHEN The recorded head commit has a passing check and a skipped check, and the pull request is a fix with a fail-to-pass check run.
  • THEN The comment names the head commit, lists each check with its conclusion and link, links the fail-to-pass run, and names the skipped check on its own line.

Requirement: Fail-to-pass link only for a fix

The command MUST add the fail-to-pass run link only when the pull request is a fix and that check run exists.

Scenario: Omits fail-to-pass for a non-fix

  • WHEN A test runs the command for a pull request with a feat title and no fail-to-pass check run.
  • THEN The comment text has no fail-to-pass section and no fail-to-pass link.

Requirement: One comment per pull request

The command SHALL keep one comment by a marker line, update that comment on a new head, and never post a second comment.

Scenario: Updates the marked comment

  • WHEN A test runs the command twice and the recorded issue comments hold one comment with the marker line.
  • THEN The second run sends one PATCH request for the marked comment and no POST request for a new comment.

Requirement: No free text

The command MUST take no free text and MUST take every number from GitHub.

Scenario: Rejects free text

  • WHEN A test runs devops pr evidence 42 --body '3 passed'.
  • THEN The command exits with a usage error and sends no request.

Requirement: Dry run

The command SHALL print the comment and the planned requests with --dry-run, and send no request.

Scenario: Dry run prints the plan

  • WHEN A test runs devops pr evidence 42 --dry-run against a recorded pull request.
  • THEN The command prints the comment text and the request plan and sends no write request.

Requirement: Agent attribution

The command SHALL end the comment with the attribution footer when an agent runs it.

Scenario: Agent attribution footer

  • WHEN A test runs the command with the agent attribution setting and a recorded pull request.
  • THEN The comment text ends with the attribution footer.

Existing Tool Considered

No alternatives check has run. GitHub shows check results on the pull request page, and a workflow could post a summary, but no open, maintained tool posts one project-formatted comment per head commit with the fail-to-pass link. The written cost to build, keep and fix that code is about 60k tokens and 3 hours.

Key questions

  • Does .github/workflows/fail-to-pass.yml already post a comment for a fix?: No. The workflow runs uv run devops ci fail-to-pass --base origin/ and has no step that posts a comment. The new command must post the comment. [sources: .github/workflows/fail-to-pass.yml]
  • Can the Service implement job call the same comment function for its own pull requests?: Yes. Put the comment builder in the shared module src/devops_cli/github/pr_evidence.py. The command calls it now. The Service can call it when feat(roadmap): a trace of every run, kept and shown in the PR comment and in explain #3032 wires the trace, with no command-line code. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/github/pr_monitor.py]
    • Chosen: Shared module in src/devops_cli/github/. The command and the Service can import one builder, so the comment text has one owner.
    • Rejected: Builder inside commands/pr.py. The Service would import a command module, and the text would be harder to reuse.
    • Rejected: Separate copy in the Service. Two copies can differ, and the project rejects duplicated rules.
  • How does the command identify its own comment to update?: Use the hidden marker line &lt;!-- devops-cli:pr-evidence --> at the top of the comment. Read the issue comments, select the comment that starts with the marker, and PATCH it. If none exists, POST one comment. (best practice) [sources: src/devops_cli/commands/pr.py]
    • Chosen: Hidden marker line. The marker identifies the comment after a restart, a new head commit or a new token.
    • Rejected: Match the comment author. Another actor can use the same token or login, and the match is not stable.
    • Rejected: Search the comment text. A person can write the same text, and the match is not stable.
  • Which GitHub API does the command use to read check runs?: Use REST GET /repos/{owner}/{repo}/commits/{ref}/check-runs through run_gh, as check_verdict does. The response gives the check name, conclusion, details URL and head SHA. (best practice) [sources: src/devops_cli/github/check_verdict.py, src/devops_cli/github/rate_limiter.py]
    • Chosen: REST check-runs endpoint. It gives the conclusion, link and head SHA, and the project already reads check runs this way.
    • Rejected: GraphQL status check rollup. It gives less check-run detail and adds a second query shape.
    • Rejected: Parse gh pr checks text. The text format can change and gives no stable machine-readable fields.
  • How does the command find the fail-to-pass check run?: Select the check run named Fail-to-Pass Check from the head commit check runs. If none exists, omit the link. (best practice) [sources: .github/workflows/fail-to-pass.yml]
    • Chosen: Check-run name. The workflow declares the stable name Fail-to-Pass Check for the job.
    • Rejected: Workflow file name. The check-run response does not hold the workflow file path.
    • Rejected: App or actor match. The same app runs other checks, so the match is not specific.
  • How does the command add the attribution footer?: Reuse the attribution footer builder in pull_describe and the agent detection that the project already uses. Do not add a free-text option. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/roadmap/pull_describe.py]
    • Chosen: Reuse the existing attribution footer. The project has one footer format, and the command takes no free text.
    • Rejected: Add an attribution option. The option is free text, and the issue forbids free text.
    • Rejected: Add no footer. The issue requires the footer when an agent runs the command.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/pr
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/pr. The (pr) scope of the title gives the scope.
    • Priority: P2-Medium. It removes a manual step that causes errors, but it does not block a release or fix a defect.
    • Value: Medium. It prevents wrong hand-typed counts and gives every PR a consistent check-results comment.
    • Effort: Medium. The body estimates about 3 hours and one new module plus its tests.
    • Related: feat(pr): implement automated pr monitoring for ci checks and copilot review sessions #170, which asks for a different change. Both add a command in pr.py that reads PR check runs, but #170 waits for checks to finish while the candidate posts a formatted comment with the results.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 24ef67a (see proposed design in issue body).

  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Staged: branch feat/3199-post-the-check-results-of-a, draft pull request #3237. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Read the check runs of a head commit and build the comment text: 18489 tokens
    2. Add the devops pr evidence command with its dry run: 31086 tokens
    3. Document the command and regenerate the command reference: 20432 tokens

    The plan run made 2 model request(s), and used 150600 input tokens and 9827 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • other at group 1: The builder takes only the head SHA and the check runs, but its test needs a fix or feat decision. No task says where the command reads the pull request title or how it decides that the pull request is a fix. Evidence: "a function that builds the comment text from the head SHA and the check runs"
  6. added 2 commits that reference this issue on Nov 2, 2026
  7. added
    status/planned
    and removed
    status/ready
    on Nov 2, 2026
  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 6, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 6, 2026
  10. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 23:46 UTC

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/prtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions