Skip to content

fix(pr): pr ready waits for checks that no workflow starts #5408

Description

@dan-petty

Problem

devops pr ready refuses a pull request in a repository whose workflows never run on a pull request. On 2026-11-13, uv run devops pr ready 2 --repo retric-ai/retric.ai said "Cannot mark PR #2 as ready for review: A check runs: no checks reported." The repository has one workflow, pages.yml, which runs only on a push to main and on workflow_dispatch, so no check will ever come for the pull request.

Cause

_no_ci in src/devops_cli/commands/pr.py (#3767) treats a pull request as one with no CI only when its head reports nothing and the repository has no GitHub Actions workflow at all (count_workflows(repo) == 0). A repository with workflows that do not trigger on pull_request (or pull_request_target) gets the wait answer for ever.

Proposed fix

Count only the workflows whose on: holds pull_request or pull_request_target for the base branch (read the workflow files at the base, or use the workflow runs of the head after a short wait). With none, mark the pull request ready and print the no-CI line.

Acceptance criteria

  • A test with a repository whose only workflow runs on push gives the no-CI answer for a head with no checks. It fails on main (devops ci fail-to-pass).
  • A repository with a pull_request workflow and a head with no checks yet still waits.

Existing tool considered

The GitHub workflows API and the workflow files. No new tool. Cost: about 80,000 tokens, 1 hour elapsed.

Alternatives check of 2026-11-22: partly.
Tool: wcmatch (https://pypi.org/project/wcmatch), MIT, last activity 2026-11-20, maintained.
Reason: Searches found no tool that decides whether a pull request's workflows can start a check; the glob library wcmatch covers only matching changed files against the paths, paths-ignore and branches filters.

Covers:

  • Glob matching with **, ?, brace and ! patterns Gitignore-style mode for paths and paths-ignore lists Match each changed file against a filter list, no home-grown matcher

Lacks:

  • Reads no workflow YAML, so no on: trigger decision Fetches no changed-file list from the pull request API Says nothing about pending versus failing checks; GitHub filter semantics need checking

Proposed design

Problem statement

The issue reported that devops pr ready waits for ever when a repository has GitHub Actions workflows but none of them runs on a pull request: _no_ci asked whether the repository had any workflow, not whether a workflow could start a check on the pull request. At this commit the behavior is already fixed by #5144: the merge-readiness verdict reads the workflows at the head commit, counts pull_request and pull_request_target, and sets no_ci, so a push-only repository gets the no-CI line while a pull_request workflow still waits. What remains is to pin the pull_request_target trigger with a test, which no test covers, and to correct the devops pr ready help text and generated docs, which still state the old repository-wide rule.

Acceptance criteria

Requirement: Push-only repository is no CI

devops pr ready SHALL print the no-CI line and mark the pull request ready when the head commit reports no check and no workflow at that commit lists pull_request or pull_request_target.

Scenario: Only a push workflow

  • WHEN uv run devops ci test tests/commands/test_pr.py -k test_pr_ready_marks_a_pull_request_ready_when_only_push_workflows_exist runs the push-only fixture, whose head commit reports no check.
  • THEN The test passes: pr ready exits 0, prints the no-CI line, and marks the pull request ready.

Requirement: Pull request workflow waits

devops pr ready SHALL exit 8 and mark nothing when the head commit reports no check and a workflow at that commit lists pull_request.

Scenario: Checks not started

  • WHEN uv run devops ci test tests/commands/test_pr.py -k test_pr_ready_exits_on_the_checks_of_the_verdict runs the checks-not-started scenario, whose head holds a pull_request workflow and reports no check.
  • THEN The test asserts exit 8 and that the pull request stays a draft.

Requirement: Pull request target workflow waits

The merge-readiness verdict SHALL count a workflow that lists pull_request_target as one that can start a check, so devops pr ready SHALL wait when the head commit reports no check.

Scenario: Target trigger with no checks

  • WHEN uv run devops ci test tests/github/test_merge_readiness.py -k pull_request_target runs a fixture whose only workflow lists pull_request_target and whose head commit reports no check.
  • THEN The test asserts that the verdict holds a pending-check blocker and that no_ci is false.

Requirement: pr ready help text states the pull-request rule

The devops pr ready help text and the generated command docs MUST say that the wait ends when no workflow at the head commit runs on a pull request, not when the repository has no GitHub Actions workflow.

Scenario: The generated docs match the help text

  • WHEN The docstring is updated and uv run devops docs generate runs.
  • THEN uv run devops ci --check --only docs passes.

Requirement: The MCP tool listing holds the new description

The MCP tool listing snapshot MUST hold the revised pr_ready description.

Scenario: The tool listing matches the snapshot

  • WHEN uv run pytest tests/ai/mcp/test_mcp_tool_listing.py --snapshot-update runs after the docstring change.
  • THEN uv run devops ci test tests/ai/mcp/test_mcp_tool_listing.py passes.

Existing Tool Considered

No open, maintained tool or library covers this need: the alternatives check of 2026-11-17 (issue body) recorded verdict none and tool none found after five searches, and no searched tool decides whether a repository has a workflow triggered by pull_request/pull_request_target. The project keeps its own parser, _runs_on_pull_request at src/devops_cli/github/client.py:408, which reads the on: key with PyYAML, already a project dependency; the #5144 proposal (openspec/changes/archive/2026-11-17-5144-pr-monitor-fits-a-repository-with/proposal.md:42) records about 8,000 tokens and one engineer-day to build and test it, and keeping it costs nothing beyond that dependency. The residual work in this proposal — one pull_request_target test, the pr ready docstring, the regenerated docs and the MCP snapshot — costs about 2,000 tokens and half an hour.

Key questions

  • Which workflow events count as a pull request trigger?: pull_request and pull_request_target count, because both start a workflow run on pull request activity; push, workflow_dispatch and every other event do not. The project records the pair in the pr-merge-readiness spec and in _PULL_REQUEST_TRIGGERS, and GitHub's events reference lists both events. (best practice) [sources: openspec/specs/pr-merge-readiness/spec.md:131, src/devops_cli/github/client.py:47, https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows]
    • Chosen: Both pull request events. Both start a check for pull request activity; the spec and _PULL_REQUEST_TRIGGERS record the pair, and GitHub's events reference lists both.
    • Rejected: Only pull_request. It misses pull_request_target, which also starts a check on a pull request.
    • Rejected: Any workflow event. It repeats the defect for push-only and manual workflows.
  • At which ref should the workflow triggers be read?: At the head commit of the pull request, which is what the merge-readiness verdict already does and what the pr-merge-readiness spec records; GitHubClient.pull_request_workflow_at lists .github/workflows at that ref. Reading the base branch instead would miss a pull_request workflow that the head adds and GitHub runs, so the issue's suggestion to read at the base is not taken. (best practice) [sources: openspec/specs/pr-merge-readiness/spec.md:129, src/devops_cli/github/merge_readiness.py:263, src/devops_cli/github/client.py:718]
    • Chosen: Read the head commit. The recorded decision and the existing code read the workflows at the head commit, which is the tree a pull_request workflow runs from.
    • Rejected: Read the base branch. It contradicts the spec and misses a workflow the head adds, which GitHub runs on pull_request.
    • Rejected: Wait for workflow runs. It adds latency and cannot tell a slow workflow from no workflow.
  • Is the reported defect already fixed at this commit?: Yes. _no_ci at src/devops_cli/commands/pr.py:1441 reads verdict.no_ci; _judge_checks sets it when the head reports no check and _can_run_on_pull_request finds no qualifying workflow; and the command-level tests already cover the push-only case (tests/commands/test_pr.py:589) and the waiting pull_request case (tests/commands/test_pr.py:532). No behavior change is left, and the issue's 'fails on main' criterion cannot hold: the test passes on main. [sources: src/devops_cli/commands/pr.py:1441, src/devops_cli/github/merge_readiness.py:316, src/devops_cli/github/client.py:718, tests/commands/test_pr.py:589, tests/commands/test_pr.py:532]
  • Does any test cover the pull_request_target trigger?: No. _PULL_REQUEST_TRIGGERS holds both events, but the trigger tests exercise only pull_request and push, so a test that names pull_request_target is the one piece of the trigger decision that no test pins. [sources: src/devops_cli/github/client.py:47, tests/github/test_merge_readiness.py:551, tests/github/test_merge_readiness.py:578]
  • Does the pr ready help text still describe the old rule?: Yes. The docstring at src/devops_cli/commands/pr.py:1533 and the generated docs/commands/pr.md:264 say the wait ends when the repository has no GitHub Actions workflow, which is the rule fix(pr): pr monitor fits a repository with no CI #5144 replaced; the MCP tool listing snapshot repeats the same text. The docstring, the generated docs and the snapshot need the new rule. [sources: src/devops_cli/commands/pr.py:1533, docs/commands/pr.md:264, tests/ai/mcp/snapshots/test_mcp_tool_listing/test_the_tool_listing_matches_the_snapshot.json:3998]
  • What title must the residual pull request take?: A non-fix title such as test(pr): pin the pull_request_target trigger (or docs(pr): ... if the work is split), because the fail-to-pass job runs only for a fix(/fix:/fix! title and replays changed tests against the base; a new pull_request_target test passes on base since the behavior landed in fix(pr): pr monitor fits a repository with no CI #5144, so a fix title would fail that gate. (best practice) [sources: .github/workflows/fail-to-pass.yml:8, .github/workflows/fail-to-pass.yml:46, .agents/skills/devops-pr-ci/SKILL.md:13]
    • Chosen: test(pr): .... The fail-to-pass job runs only for a fix title, so a test-only pull request is not replayed against base.
    • Rejected: fix(pr): ... with Fail-to-pass: not applicable. No defect remains to replay; the not-applicable line is for a fix whose replay cannot run, not for a fix that is already on main.
    • Rejected: Split into test(pr): and docs(pr): issues. One pull request can carry the test, the docstring, the generated docs and the snapshot.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/pr
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches for a tool that decides whether a repository has a workflow triggered by pull_request/pull_request_target returned only unrelated pages, and no open tool or library answers that question. The need is an internal change to the project's own _no_ci check in src/devops_cli/commands/pr.py, which the issue itself plans to make through the GitHub workflows API and workflow files with no new tool.

    Tool: none found

    Lacks:

    • No searched tool counts only the workflows whose on: holds pull_request or pull_request_target for the base branch
    • No searched tool replaces the project's own _no_ci wait logic in devops pr ready
    • Reading workflow files or head workflow runs still goes through the project's existing GitHub session, which the issue already plans

    Tools considered:

    Searches run:

    • detect whether GitHub Actions workflow triggers on pull_request API, results: 5
    • python library read GitHub Actions workflow files trigger events, results: 5
    • gh CLI pull request ready no checks reported workflows not triggered pull_request, results: 5
    • GitHub Actions workflow "on: pull_request" check for repository tool, results: 5
    • GitHub REST API list repository workflows endpoint docs, results: 5

    Sources:

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  5. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2620fae (see proposed design in issue body).

  7. dan-petty commented on Nov 18, 2026

    @dan-petty
    OwnerAuthor

    Evidence 2026-11-18: a case that #5144 does not cover. The proposed design above says that #5144 already fixed this item. It fixed only a repository with no pull_request workflow.

    • dan-petty/homelab PR feat(ai): model dependency chaos engineering suite (devops ai chaos-model) #55 changes only README.md. Both workflows run on pull_request, but with paths filters that leave README.md out (k8s.yml: k8s/** and two script paths; lint.yml: **/*.yaml, **/*.yml, ansible/** and more). No check starts for this pull request.
    • devops pr ready said "A check runs: no checks reported." and needed --force.
    • Cause: pull_request_workflow_at in src/devops_cli/github/client.py:718 reads only the trigger names. A workflow with pull_request counts as one that can start a check, also when its paths, paths-ignore or branches filter leaves the pull request out. _judge_checks in src/devops_cli/github/merge_readiness.py:323 then keeps the pending stand-in.

    Two ways to close the gap:

    1. Match the changed files of the pull request (GET /repos/{owner}/{repo}/pulls/{n}/files) against the paths and paths-ignore filters of each pull_request workflow, and the base branch against branches and branches-ignore. The filters use the GitHub glob syntax (*, **, ?, !). Use an open glob library for it; do not write a new matcher. pathspec is a dependency already, but its gitignore rules differ from the GitHub rules (a pattern with no slash matches at each depth), so check it against the GitHub filter examples or use wcmatch globmatch with GLOBSTAR.
    2. Read the required status checks of the base branch from the rulesets (GET /repos/{owner}/{repo}/rules/branches/{branch}). A pull request with no required check and no reported check has no check that applies.

    The message should tell "no check applies to this pull request" apart from "checks pending" and "checks failing".

    Added criterion: a test with a pull_request workflow that has paths: [k8s/**] and a pull request that changes only README.md gives the no-CI answer. A pull request that changes k8s/app.yaml still waits.

  8. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor

    Another case for this item, found on 2026-11-22: dan-petty/homelab PR #97 changes only .github/renovate.json. Both workflows of homelab list pull_request, but their paths filters skip that file, so the head commit gets no check run, and devops pr ready waits and then refuses. The rule of the refined design ("no workflow at that commit lists pull_request") does not cover it: a workflow lists the event, but its path filter skips the change. The rule needs to read the paths and paths-ignore filters too (or the workflow runs that GitHub records for the head commit).

  9. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor

    New case on 2026-11-22: dan-petty/homelab#97 changes only .github/renovate.json and README.md. Both workflows of homelab run on pull_request, but with paths filters (k8s.yml: k8s/** and others; lint.yml: **/*.yaml, **/*.yml, ansible/** and others) that match neither file. So no check starts on the head commit (0 check runs), and devops pr ready 97 --repo dan-petty/homelab waits for ever ("Pass --force to override failing check verification."). The trigger check of #6173 (_runs_on_pull_request in src/devops_cli/github/client.py) reads the trigger type, not paths, paths-ignore or branches. The fix must also match the filters of each workflow against the changed files of the pull request, as GitHub matches them (glob with **, the first-match rules of paths with !), with a library such as wcmatch, not a home-grown matcher.

  10. 3 remaining items

  11. added
    status/in-progress
    on Nov 22, 2026
  12. added
    status/in-review
    and removed
    status/in-progress
    on Nov 22, 2026
  13. removed
    status/in-review
    owner/agent
    on Nov 22, 2026
  14. added a commit that references this issue on Nov 22, 2026
  15. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor
  16. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-22 23:15 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/prsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions