dotnet / dotnet/maui

[Policy Service] Duplicate comments from multiple stored policy revisions

Open
#37,531 0 comments 1 reaction 0 assignees View on GitHub
area-infrastructure t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

## Description

`dotnet-policy-service` is executing at least two stored revisions of MAUI's resource-management policy for a single GitHub event, producing duplicate comments and other duplicate policy actions.

The repository source contains each responder rule only once. The duplicate comments render differently, which shows that two distinct stored templates are running rather than one webhook/event being retried.

## Reproduction and concrete evidence

On #37013, one `s/try-latest-version` label event at `2026-08-16T18:57:11Z` produced two comments one second apart:

- Stale revision: [`Hi @@janne-hmp...`](https://github.com/dotnet/maui/issues/37013#issuecomment-5309127348)
- Current revision: [`Hi @janne-hmp...`](https://github.com/dotnet/maui/issues/37013#issuecomment-5309127410)

The active policy uses `${issueAuthor}`. The stale rendering corresponds to the previous `@${issueAuthor}` template. Both revisions therefore executed for the same label event.

### Steps to reproduce

1. Choose an issue without `s/try-latest-version`.
2. Record its current comments.
3. Apply `s/try-latest-version` once.
4. Observe two new `dotnet-policy-service[bot]` comments, one with `@@` and one with `@`.
5. Remove the label after testing.

## Expected behavior

Exactly one active revision of `.github/policies/resourceManagement.yml` should process an event, producing one comment.

## Actual behavior

Two stored revisions process the event and produce two comments. The duplication also affects other responders, including community PR greetings and needs-info/needs-repro flows.

## Investigation performed

- The relevant rules occur only once in `.github/policies/resourceManagement.yml`.
- Duplicate responses existed before #34834: #35628 received duplicate `@@` comments on May 27. PR #34834 changed templates from `@${issueAuthor}` to `${issueAuthor}` on May 29, making the two active revisions visibly different; it did not create the duplication.
- Recent policy PRs #36875, #36992, #37068, and #37158 only changed inter-branch merge rules and do not duplicate these responders or change top-level policy identity.
- Current development/release branches use the corrected template. Treating every historical branch as active would produce many responses, not exactly two.
- Other dotnet repositories that made the same placeholder migration do not show this behavior, suggesting stale MAUI-specific Policy Service registration state.

## Requested investigation

Please inspect the Policy Service registrations/revisions for `dotnet/maui` and `GitOps.PullRequestIssueManagement` and:

1. Identify why two stored revisions remain active for the same repository policy.
2. Remove the orphaned/stale registration server-side without pausing all MAUI Policy Service automation, if possible.
3. Verify a controlled label event produces exactly one response.
4. Determine whether policy identity/version handling needs a service-side fix to prevent recurrence.

A repository-driven delete-and-restore reset was considered in #37530, but it would temporarily disable every MAUI Policy Service rule. That PR was intentionally closed unmerged in favor of investigating and correcting the stale service state directly.

Contributor guide

Open the contributing guide

Research direction

Start with .github/policies/resourceManagement.yml and compare its current policy identity with the Policy Service registrations and revisions for dotnet/maui and GitOps.PullRequestIssueManagement. Trace why two revisions are active without assuming the repository contains duplicate rules. Done means identifying the stale registration, removing or correcting it without pausing other automation, and verifying a controlled label event produces exactly one response.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, yaml
Domain
devops, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.