Skip to content

fix(roadmap): Score a renamed bot PR by its first kind #5984

Done

Description

@dan-petty

Problem

The verdict score of #5968 (PR #5975, release 0.165.0) has gaps that a review after the merge found:

  1. A renamed pull request gets the wrong kind. pull_kind() (src/devops_cli/roadmap/pr_verdict.py, about line 160) reads the title at the time of the report. The implement job renames a Staged plan draft to the delivery title (implement/implement_run.py, about line 1649), and people rename plan pull requests too. In the last 7 days, 4 of 113 bot pull requests were renamed this way (fix(ci): Accept copilot branches in the branch-name hook #5407, fix(github): Fix check-readiness base and monitor merged state #4980, fix(telemetry): read repository traffic as the GitHub App #4932, refactor: delete the src symbols that only tests call #4849); fix(telemetry): read repository traffic as the GitHub App #4932 went from docs(openspec): plan #4757 ... to fix(telemetry): ..., and three of them carry verdict/fix-plan events. So stage loses these verdicts, implement shows them as unscored, and a verdict/mergeable put on a plan before the rename counts as an implement success.
  2. Label events after the first 100 are dropped with no warning: the query asks for first: 100 timeline items (about line 115) and does not read pageInfo.hasNextPage.
  3. A GitHub read error stops all of devops roadmap eval grades (job_grade_report.py, about line 589), also the Loki rows, while the design says that the Loki part does not change.
  4. The string verdict/fix-plan is typed in pr_verdict.py (about line 77) and phase.py (about line 274) instead of the constant FIX_PLAN_LABEL (stage_verify.py, about line 108), and no test ties the constant to the plan entry of VERDICT_LABELS.
  5. ADR 0021 (about lines 60 and 215) still names plan/needs-fix for the current Service, and the knowledge-base page on GitHub project management lists only verdict/fix-plan of the six verdict labels.

Expected behavior

  • The kind of a pull request comes from its first title: the query also reads RENAMED_TITLE_EVENT in the same timelineItems call, and the kind uses the previousTitle of the first rename. A label event before the rename scores stage; an event after it scores implement. A test covers a renamed pull request.
  • A pull request with more than one page of label events raises an error, as the 1000-result guard does.
  • A GitHub read error prints "verdicts not read: " and the report keeps its Loki rows.
  • Each reader and writer uses FIX_PLAN_LABEL; a test checks it against VERDICT_LABELS.
  • ADR 0021 and the knowledge-base page name the six verdict labels.

Related

Alternatives check of 2026-11-24: none.
Tool: none found.
Reason: Searches found no library that covers this internal fix: rename-aware scoring, a timeline overflow guard, grade-report error isolation and one label constant all live in the project's own GraphQL read; PyGithub, the only candidate, was already considered and rejected.

Lacks:

  • Kind from the first title, not the report-time title
  • Error on a timeline with more than one page
  • Grade report keeps Loki rows on a GitHub read error
  • One FIX_PLAN_LABEL constant tied to VERDICT_LABELS

Proposed design

Problem statement

The verdict score of bot pull requests uses the title at report time, drops timeline events after 100 with no warning, stops the whole grade report on a GitHub read error, and leaves the fix-plan label and its documents inconsistent. The change scores a pull request by the kind at its first verdict label, raises on timeline overflow, isolates the GitHub read error, and uses one label constant and one list of six labels.

Acceptance criteria

Requirement: Rename query

The verdict search SHALL request RENAMED_TITLE_EVENT with previousTitle in the same timelineItems call as LABELED_EVENT.

Scenario: GraphQL query holds both event types

  • WHEN A test reads the GraphQL query string of the verdict search.
  • THEN The timelineItems selection holds LABELED_EVENT, RENAMED_TITLE_EVENT and previousTitle.

Requirement: Plan verdict before rename

The verdict read SHALL score the first verdict label with the pull request kind at the time of that label event.

Scenario: Plan verdict before rename

  • WHEN A bot pull request opens with a plan title, gets verdict/mergeable, and later renames to a delivery title.
  • THEN read_bot_pulls returns PullKind.PLAN with Verdict.MERGEABLE, and the grade counts it for stage.

Requirement: Delivery verdict after rename

The verdict read SHALL score a verdict label after the first rename with the delivery kind.

Scenario: Plan verdict after rename

  • WHEN A bot pull request opens with a plan title, renames to a delivery title, and gets verdict/fix-plan.
  • THEN read_bot_pulls returns PullKind.DELIVERY with Verdict.NEEDS_FIX, and the grade counts it for implement.

Requirement: Timeline page overflow

The verdict read MUST raise GitHubUnreadError when a pull request timeline has more than one page of events.

Scenario: More than 100 timeline events

  • WHEN The GraphQL answer reports timelineItems.pageInfo.hasNextPage as true.
  • THEN read_bot_pulls raises GitHubUnreadError with the pull request number and the timeline page reason.

Requirement: Grade report keeps Loki rows

The grade report SHALL print verdicts not read: <reason> and keep its Loki rows when the GitHub verdict read fails.

Scenario: GitHub verdict read fails

  • WHEN devops roadmap eval grades gets a GitHubUnreadError from the verdict read and has Loki rows.
  • THEN The command prints verdicts not read: <reason> and still prints the Loki grade rows.

Requirement: One fix-plan label constant

Each reader and writer of verdict/fix-plan SHALL use FIX_PLAN_LABEL, and a test MUST tie it to the plan entry of VERDICT_LABELS.

Scenario: Label constant matches the plan entry

  • WHEN A test reads FIX_PLAN_LABEL and VERDICT_LABELS[PullKind.PLAN].
  • THEN FIX_PLAN_LABEL is the key whose verdict is Verdict.NEEDS_FIX, and a source scan of src/devops_cli/roadmap finds no literal verdict/fix-plan outside stage_verify.py.

Requirement: Six verdict labels in docs

ADR 0021 and the knowledge-base page on GitHub project management SHALL name all six verdict labels.

Scenario: Documents list the six labels

  • WHEN A test reads the six labels from VERDICT_LABELS.
  • THEN Each label appears in ADR 0021 and in the knowledge-base page, and the current Service section of ADR 0021 has no plan/needs-fix.

Existing Tool Considered

PyGithub/PyGithub, rejected by ADR 0006. The alternatives check in the issue body gives what it covers and lacks. The proposal keeps the project GraphQL read and adds the title-at-label scoring, the timeline page guard, the grade-report error split and the FIX_PLAN_LABEL check.

Key questions

  • Which title gives the kind of a renamed bot pull request?: Order the timeline events. The first RENAMED_TITLE_EVENT gives previousTitle and the current title. A label event before the first rename uses previousTitle; a label event after it uses the current title. The first verdict label scores that kind. (best practice) [sources: src/devops_cli/roadmap/pr_verdict.py:115, src/devops_cli/roadmap/stores/github_store.py:505]
    • Rejected: Current title at report time. It misclassifies a plan that a person or implement renamed, and it loses stage verdicts.
    • Rejected: Original title for every event. It scores a label after the rename as stage, but that label belongs to implement.
    • Chosen: Title at the label event from the first rename. It keeps a pre-rename stage verdict and gives a post-rename label to implement.
  • How should the verdict read handle more than one page of timeline events?: Add pageInfo.hasNextPage to the timelineItems selection and raise GitHubUnreadError when it is true. This matches the existing 1000-result guard in _search_page. (best practice) [sources: src/devops_cli/roadmap/pr_verdict.py]
    • Rejected: Ignore hasNextPage. It drops events after the first 100 with no warning.
    • Rejected: Paginate the nested timelineItems. The issue asks for an error, and a nested page loop adds cost for a rare case.
    • Chosen: Raise GitHubUnreadError. It gives the same typed failure as the 1000-result guard.
  • How should the grade report handle a GitHub verdict read error?: Catch GitHubUnreadError around the verdict read, print verdicts not read: <reason>, and keep the Loki rows. (best practice) [sources: src/devops_cli/roadmap/job_grade_report.py]
    • Rejected: Let the error stop the command. It also drops the Loki rows, which do not depend on GitHub.
    • Rejected: Omit verdicts with no message. The operator cannot tell a read failure from no verdicts.
    • Chosen: Print the reason and keep Loki rows. It isolates the GitHub failure and keeps the report useful.
  • Which constant is the source of the verdict/fix-plan label?: FIX_PLAN_LABEL in src/devops_cli/roadmap/stage/stage_verify.py:109. Each reader and writer imports it. A test asserts it is the Verdict.NEEDS_FIX key of VERDICT_LABELS[PullKind.PLAN]. [sources: src/devops_cli/roadmap/stage/stage_verify.py:109, src/devops_cli/roadmap/pr_verdict.py:74]
  • Which six verdict labels must ADR 0021 and the knowledge-base page name?: verdict/mergeable, verdict/fix-plan, verdict/discard-plan, verdict/issue-changed, verdict/fix-implementation and verdict/discard-implementation. [sources: src/devops_cli/roadmap/pr_verdict.py:74, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    on Nov 16, 2026
  2. dan-petty commented on Nov 16, 2026

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

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • PyGithub pull request timeline RenamedTitleEvent pagination, results: 5
    • GitHub GraphQL timelineItems RENAMED_TITLE_EVENT previousTitle pagination library, results: 5
    • gidgethub GitHub API library, results: 5
    • PyGithub, results: 5
    • PyGithub documentation PullRequest get_timeline RenamedTitleEvent previous_title, results: 5
    • githubkit graphql paginate timeline items renamed title event python, results: 5

    Sources:

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

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: rejected, tool https://github.com/PyGithub/PyGithub. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • GitHub GraphQL timelineItems RENAMED_TITLE_EVENT previousTitle pagination client library, results: 5
    • PyGithub pull request timeline events renamed title previousTitle, results: 5
    • PyGithub Repository timeline issue events pagination get_timeline, results: 5
    • GitHub GraphQL RENAMED_TITLE_EVENT previousTitle pull request timeline, results: 5
    • PyGithub library pull request timeline RenamedEvent, results: 5
    • githubkit GraphQL timeline items pagination python, results: 5
    • GitHub REST API pull request timeline renamed event "renamed", results: 5
    • pygithub.readthedocs.io IssueEvent renamed timeline, results: 5
    • PyGithub GitHub API v3 python library, results: 5

    Sources:

  8. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 25, 2026
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 25, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  11. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 17:09 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/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions