Skip to content

Commit 4af4361

Browse files
fix(taskstoissues): bound issue pagination to the tasks being processed
Address Copilot review: extract the task IDs from tasks.md first, then paginate list_issues only until every task ID has been matched (or pages run out), instead of fetching the repo's entire issue history. Keeps the call count bounded on repos with large issue backlogs.
1 parent a920e78 commit 4af4361

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

templates/commands/taskstoissues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ git config --get remote.origin.url
6262
> [!CAUTION]
6363
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
6464
65-
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, since omitting it makes the tool return both open and closed issues. Request `perPage: 100` to keep the number of calls down, and since the tool uses cursor-based pagination, 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 matching each issue title against the task ID pattern `\bT\d{3}\b` (a `T` followed by three digits, on word boundaries so tokens like `ST001` or `T0010` are not matched by mistake). Using a boundary-aware match means titles written as `T001 ...`, `T001: ...` or `[T001] ...` are all recognised. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked.
65+
1. **Fetch existing issues for deduplication**: Before creating anything, build the set of task IDs you are about to process from `tasks.md` (each is a `T` followed by three digits, e.g. `T001`). Then use the GitHub MCP server's `list_issues` tool to look for issues that already cover those IDs. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. Request `perPage: 100` to keep the number of calls down, and since the tool uses cursor-based pagination, request pages with the `after` parameter (using the `endCursor` from the previous response). For each issue title, match it against the task ID pattern `\bT\d{3}\b` (word boundaries so tokens like `ST001` or `T0010` are not matched by mistake; this also recognises titles written as `T001 ...`, `T001: ...` or `[T001] ...`) and, when it matches one of your task IDs, mark that ID as already having an issue. Stop paginating as soon as every task ID has been matched, or when there are no more pages, so you do not keep fetching the whole repository's issue history once all task IDs are accounted for. This bounds the number of calls on repos with large issue histories and still prevents duplicates when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked.
6666
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 in `tasks.md` start with a markdown checkbox, so first strip the leading `- [ ]` (and any `[P]` / `[US#]` markers) to recover the task ID and its description. Create the issue with a single canonical title of the form `T001: <description>`, with the ID written once followed by the task description (for example, the line `- [ ] T001 Create project structure` becomes the title `T001: Create project structure`).
6767
- **Skip** any task whose 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`).
6868
- Only create issues for tasks that do not yet have a matching issue.

0 commit comments

Comments
 (0)