awesome-copilot icon indicating copy to clipboard operation
awesome-copilot copied to clipboard

Fix PR duplication detection workflow

Open aaronpowell opened this issue 5 months ago • 2 comments

Summary

The PR duplication detection workflow is failing and not reliably flagging duplicate submissions.

Workflow links

  • Workflow definition: https://github.com/github/awesome-copilot/blob/staged/.github/workflows/pr-duplicate-check.md
  • GitHub run list: https://github.com/github/awesome-copilot/actions/workflows/pr-duplicate-check.lock.yml

Scope

  • Reproduce and diagnose the current failure mode
  • Implement a targeted fix to restore detection behavior
  • Confirm expected behavior for duplicate and non-duplicate test scenarios
  • Document any required config or secret expectations

Acceptance criteria

  • Workflow completes successfully on staged
  • Duplicate PRs are flagged with clear output
  • Non-duplicate PRs are not falsely flagged
  • Any required config changes are documented

Parent

Part of #2076

aaronpowell avatar Jun 22 '26 00:06 aaronpowell

Status update — post gh-aw v0.80.9 upgrade (#2092).

I re-checked this workflow on the upgraded version. The "failing" premise no longer holds, but one acceptance criterion isn't yet demonstrated, so I'm keeping this open as the remaining task in the epic.

What's verified ✅

  • Completes successfully: zero failures in the last 40 runs. Full agent runs on v0.80.9 are green end-to-end (pre_activation → activation → agent → detection → safe_outputs → conclusion), e.g. 28071409758 and 28064855170. It even ran green on PR #2092's own branch (2026-06-23 01:00).
  • Non-duplicate PRs are not falsely flagged: the real runs above correctly produced an empty safe-output (noop) — e.g. run 28071409758 on a docs-only PR correctly decided "No agent, instruction, skill, or workflow files were changed in this PR — no duplicate check needed."
  • Lock recompiled to v0.80.9 on main; the .md source is unchanged by #2092, so the detection logic is identical to before.

What's NOT yet demonstrated ⚠️ (why this stays open)

  • "Duplicate PRs are flagged with clear output": no same-repo PR in recent history actually introduced a genuine duplicate, so the positive path — posting the ## 🔍 Potential Duplicate Resources Detected comment — hasn't been exercised on v0.80.9. The Step 4/5 logic is present and unchanged and the pipeline is proven, but the flag itself hasn't been observed firing.

Design note for maintainers

  • The workflow skips fork PRs by design (gh-aw security default: activation requires pull_request.head.repo.id == github.repository_id). External-contributor PRs are therefore never duplicate-checked. The many "skipped" runs are forks, not a bug — but if checking external contributions is desired, that guard needs a deliberate, security-reviewed change. Worth a decision here.

How to close this safely (no pollution beyond one throwaway PR)

  1. Open a same-repo (non-fork) draft PR that adds an obvious near-duplicate of an existing resource (e.g. copy an existing instructions/*.md with a tweaked name/description).
  2. Confirm the bot posts the 🔍 Potential Duplicate Resources Detected comment, correctly identifying the existing resource.
  3. Close the throwaway PR.

Leaving this open for that positive-path verification plus the fork-guard decision.

ayangupt avatar Jun 24 '26 16:06 ayangupt

Resolved. Verified end-to-end on gh-aw v0.80.9 (#2092). All acceptance criteria are now demonstrated.

Premise correction first: this workflow was not failing — 0 failures across the last 40 runs. The historical symptom ("never produces output") is the gh-aw fork-skip guard (see limitation below). On the upgraded version it runs and produces correct output for same-repo PRs.

Acceptance criteria — all met:

  1. ✅ Completes successfully on staged — verified via a same-repo test PR to staged (#2115): run 28115316497, all jobs green (pre_activation → activation → agent → detection → safe_outputs → conclusion). Plus 0 failures in the last 40 runs.

  2. ✅ Duplicate PRs flagged with clear output — the test PR added an intentional near-duplicate (instructions/rust-coding-guidelines.instructions.md vs existing instructions/rust.instructions.md). The workflow posted a single advisory comment: 🔍 Potential Duplicate Resources Detected. It accurately identified the overlap (same applyTo: '**/*.rs', near-identical description, shared topics: naming, error handling, tooling) and gave an actionable suggestion. (Test PR closed + branch deleted.)

  3. ✅ Non-duplicate PRs not falsely flagged — real same-repo runs on v0.80.9 correctly produced an empty safe-output (noop), e.g. 28071409758 on a docs-only PR: "No agent, instruction, skill, or workflow files were changed in this PR — no duplicate check needed."

  4. ✅ Config documented — pr-duplicate-check.lock.yml recompiled to v0.80.9 in #2092; the .md source documents the detection signals (Step 4) and comment format (Step 5).

Known limitation / suggested follow-up (not blocking this issue): The workflow skips fork PRs by design (pull_request.head.repo.id == github.repository_id). Since most external contributions arrive via forks, those PRs are not duplicate-checked today. Closing that gap needs a deliberate, security-reviewed change (e.g. a pull_request_target variant with strict input sanitisation, or a two-stage trusted pattern). Recommend tracking as a separate enhancement rather than reopening this fix issue.

Closing as completed.

ayangupt avatar Jun 24 '26 17:06 ayangupt