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
Comment thread templates/commands/taskstoissues.md Outdated
@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 ...').

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.

Copilot's findings

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

Comment on lines +65 to +67
1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value — when it is omitted the tool returns both open and closed issues. The tool uses cursor-based pagination, so keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from the start of 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. Task lines already begin with their ID, so use the task text itself as the issue title (for example, a task `T001 Create project structure` becomes the issue title `T001 Create project structure`). Do not add a second copy of the ID.
- **Skip** any task whose leading ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`).

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback

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