Skip to content

pr-management stats counts contributor draft changes as engagement #2015

Closed

Description

@MakerFlyFly

What's broken

A contributor's own draft-state changes count as maintainer engagement in pr-management stats.
An otherwise untouched non-draft PR can disappear from the untriaged backlog after its author marks it ready for review, removing the overdue-triage recommendation and potentially changing the health rating to “Healthy”.

Which layer

The timeline engagement loop in stats/reference.py at b6ccd434 accepts any non-bot actor, including the contributor author.
The dashboard definitions describe de-facto triage as maintainer engagement.

How to reproduce

On upstream main@b6ccd434a54bdd4761fb487d7b55aaa8bd89dbc0, save this as tools/pr-management/repro.py, then run:

uv run --directory tools/pr-management --project . python repro.py

It uses the repository's existing synthetic fixtures: one 40-day-old, non-draft contributor PR with no ready label or other engagement.

from pr_management.stats import dashboard, reference
from tests.stats.helpers import _iso, make_ctx, make_pr

ctx = make_ctx()
pr = make_pr(
    1,
    assoc="CONTRIBUTOR",
    created_days_ago=40,
    timeline=[{
        "__typename": "ReadyForReviewEvent",
        "actor": {"login": "contributor"},
        "createdAt": _iso(39),
    }],
)
reference.classify(pr, ctx)
hero = dashboard.compute_hero_counts([pr], ctx["now"])
rating = dashboard.compute_health_rating(hero)[0].partition(" ")[2]
print(pr["_is_engaged"], pr["_is_untriaged"], hero["untriaged_4w"], rating)

Actual output:

True False 0 Healthy

Expected output:

False True 1 Needs attention

The values are engagement, untriaged status, untriaged-over-four-weeks count, and health rating.

Expected vs actual

The author's own ReadyForReviewEvent or ConvertToDraftEvent should not establish maintainer engagement.
A currently non-draft contributor PR with no ready label or other engagement should remain untriaged.
A PR still in draft remains outside the untriaged non-draft counts.

Currently, the author's timeline event alone marks it engaged.

Surface area (optional)

The proposed repair is limited to contributors' own LabeledEvent, ReadyForReviewEvent, and ConvertToDraftEvent.
Collaborator PRs, all closure actors, existing ready-label behavior, and label timestamps retain their current behavior.
No query, configuration, dependency, or comment/review signal changes are needed.

The label case is defensive input coverage: applying labels requires triage or greater access, so it is not presented as an ordinary external-author workflow.
Strict maintainer authorization and closed-PR engagement policy are separate concerns.

Six contributor regression cases fail on the original code; the repair preserves the other 30 targeted cases.
Related prior work addressed different problems: full engagement data (#257) and untriaged scope (#219).
No duplicate report or pending repair was found in the 2026-11-06 checks.

Environment (optional)

  • Upstream main@b6ccd434a54bdd4761fb487d7b55aaa8bd89dbc0.
  • Linux container, Python 3.12.12, uv.

AI assistance

This report was drafted with OpenAI Codex (GPT-6).
The contributor reviewed the final implementation before upstream submission.

Suggested labels: bug, family:pr-management, capability:stats, substrate:analytics.

Activity

  1. added
    substrate:analytics
    on Nov 9, 2026
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

    family:toolssubstrate:analytics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions