Skip to content

fix(taskstoissues): skip tasks that already have a GitHub issue#2992

Open
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/taskstoissues-dedup-existing
Open

fix(taskstoissues): skip tasks that already have a GitHub issue#2992
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/taskstoissues-dedup-existing

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Fixes #2968

Re-running /speckit-taskstoissues created a duplicate issue for every task because the command never checked whether an
issue already existed.

This adds a dedup step before issue creation: it lists the repo's issues (state all, so closed ones count too) via the
GitHub MCP server, pulls the task IDs already present in issue titles, and skips any task that already has a matching
issue. New issue titles are prefixed with the task ID (e.g. T001:) so they can be matched on later runs. list_issues is
added to the command's MCP tools for the read.

Single template change, no behavior change on a first run — only re-runs are affected.

This PR was authored with AI assistance (Claude Code), reviewed by me.

Re-running /speckit-taskstoissues created a duplicate issue for every
task because the command never checked for existing ones. Add a
deduplication step before issue creation: list the repo's issues
(state all) via the GitHub MCP server, collect the task IDs already
present in issue titles, and skip any task that already has a matching
issue. Issue titles are now prefixed with the task ID (e.g. T001:) so
they can be matched on later runs, and list_issues is added to the
command's MCP tools.

Fixes github#2968

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the taskstoissues command template to avoid creating duplicate GitHub issues when the command is re-run, by introducing an explicit “fetch existing issues + skip already-created task IDs” step.

Changes:

  • Adds github/github-mcp-server/list_issues to the command’s allowed MCP tools.
  • Adds an outline step to fetch existing issues and deduplicate by task ID before creating new issues.
  • Updates issue-title guidance to include a task ID prefix for future matching.
Show a summary per file
File Description
templates/commands/taskstoissues.md Adds MCP tooling and outline instructions for listing issues and deduplicating task-to-issue creation.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread templates/commands/taskstoissues.md Outdated
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL

1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues with state `all`, so both open and closed issues are covered. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked.
Comment thread templates/commands/taskstoissues.md Outdated

1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues with state `all`, so both open and closed issues are covered. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked.
1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Prefix the issue title with the task ID so it can be matched on later runs (for example, `T001: Create project structure`).
@mnriem

mnriem commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

Address Copilot review:
- list_issues has no 'all' state; omitting state returns both open and
  closed issues. Use cursor-based pagination (after/endCursor) to fetch
  every page before building the dedup set.
- task lines already start with their ID, so reuse the task text as the
  issue title instead of prefixing the ID again (which produced
  'T001: T001 ...').
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.

[Bug]: /speckit-taskstoissues creates duplicate GitHub issues when issues already exist

3 participants