Skip to content

Pattern quality: Default schedule-triggered issue/PR workflows to include dedupe guard in generated file - #249

Merged
pelikhan merged 1 commit into
mainfrom
fix/dedupe-guard-generated-workflow-file-0a02c5d3971d1f10
Sep 2, 2026
Merged

Pattern quality: Default schedule-triggered issue/PR workflows to include dedupe guard in generated file#249
pelikhan merged 1 commit into
mainfrom
fix/dedupe-guard-generated-workflow-file-0a02c5d3971d1f10

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Samples evaluated

Reviewed all 6 generated pattern/prompt samples in /tmp/gh-aw/data/generated-patterns-and-prompts.json (status-report, issue-triage, code-improvement, documentation-updater, dependency-monitor, pr-review), each against its patterns/archetypes/*.json recommendation and src/js/workflow.js generation logic, plus a downstream-agent simulation.

Recurring quality issue found

generateWorkflowFile (the function that produces the actual .github/workflows/*.md file, used both by the CLI's file-generation mode and as the "Suggested workflow file" draft embedded in every generateAgentPrompt output) never applied deduplication guards to scheduled workflows that create issues or pull requests.

The wizard already has correct prose-level guidance for this exact risk — generateAgentPrompt surfaces "Prevent duplicate scheduled findings" tips and a skip-if-match / max / expires schema example, and existing tests (workflow.test.js) assert this text appears in the prompt. But that guidance only reached the instructions telling an agent how to write the workflow — it was never applied to the workflow file the generator itself emits.

Concretely: status-report (schedule + create-issue) and dependency-monitor (schedule + create-issue/create-pull-request) generated files with no skip-if-match under on: and no max/expires under safe-outputs:. Any downstream agent that used the generated file as-is (rather than fully rewriting it per the separate prose tips) would produce a workflow that creates a brand-new duplicate issue/PR on every scheduled run forever — the exact failure mode the pattern library's own tips warn against.

What changed

In src/js/workflow.js, generateWorkflowFile now defaults to adding the dedupe guard whenever a workflow's triggers include schedule and its safe-outputs include create-issue or create-pull-request:

  • Adds skip-if-match: 'is:issue is:open "gh-aw-workflow-id: <name>" in:body' as a sibling of schedule: under on:.
  • Adds max: 1 / expires: 7 under every dedupe-relevant safe-output key (not just the first one).

Added three new tests: the guard is applied for status-report (single dedupe output), applied for every dedupe-relevant output on dependency-monitor (both create-issue and create-pull-request), and absent for non-scheduled/non-dedupe workflows (issue-triage). Updated one existing test (adds inferred capabilities and optional agent capabilities) whose fixture now also gets the guard since it uses status-report + schedule + create-issue.

Validation

  • npm test: 18 test files, 318 tests passed.
  • npm run build: succeeded, no errors.

Follow-ups deliberately left out

  • Not extending the guard to other "dedupe-relevant" safe-outputs (e.g. create-discussion) — left scoped to the two outputs the existing prompt-mode tips already cover, to keep the change minimal and consistent with tested guidance.
  • Not adding protected-files or PR-spam-rate-limit defaults to the generated file (analogous gaps exist for code-improvement/documentation-updater), since those are separate, lower-confidence findings from this same review and deserve their own focused change.

Generated by Pattern Quality Eval · copilot · auto · 158.6 AIC · ⌖ 8.97 AIC · ⊞ 7.8K ·

generateWorkflowFile previously produced the same guidance in prose
(via generateAgentPrompt) but never applied skip-if-match / max /
expires to the directly generated workflow .md file itself. A
schedule-triggered workflow using create-issue or create-pull-request
(e.g. status-report, dependency-monitor) would ship with no
deduplication guard at all, so every scheduled run creates another
duplicate issue/PR forever.

This adds a default: when a workflow's triggers include schedule and
its safe-outputs include create-issue or create-pull-request, the
generated file now includes:
- 'skip-if-match' as a sibling of schedule under on:
- 'max: 1' and 'expires: 7' under every dedupe-relevant safe-output key

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review September 2, 2026 01:52
@pelikhan
pelikhan merged commit 790d867 into main Sep 2, 2026
3 of 6 checks passed
@pelikhan
pelikhan deleted the fix/dedupe-guard-generated-workflow-file-0a02c5d3971d1f10 branch September 2, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant