Skip to content

Commit 68f019d

Browse files
committed
fix(taskstoissues): ask about a bare legacy title instead of guessing
The upgrade rule treated a bare `T001: ...` title as this feature's whenever no scoped title existed for that ID. That is exactly the state of every feature on its first run after upgrading, so a bare T001 filed for 001-auth still suppressed 002-billing's T001: the github#4271 skip, back. A bare title names no feature, and neither does the absence of a scoped one, so no inference from the tracker can settle it. Skipping drops a task silently; creating duplicates one an existing user already tracks. The command now lists every ID that matched only a bare title, with the issue and this feature's description for the task, and asks before creating anything. Confirmed issues are skipped, and retitled to the scoped form only if the user agrees, so the question does not recur.
1 parent 54997ca commit 68f019d

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

‎templates/commands/taskstoissues.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ git config --get remote.origin.url
7575
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 **at least** three digits, e.g. `T001` — `__SPECKIT_COMMAND_CONVERGE__` assigns new IDs with `T{M+1:03d}`, which is a floor rather than a cap, so once a file has more than 999 tasks the IDs are four digits or longer). 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` (the `{3,}` accepts four-digit and longer IDs — with `\d{3}` a title containing `T1000` would not match at all, because the trailing `\b` cannot fall between two digits, so that task would be silently neither deduplicated nor created; word boundaries still stop a token like `ST001` from matching, and force the whole digit run to be consumed so `T100` can never match inside `T1000`; 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 **only if the title also carries this feature's identifier** (see below). Task IDs restart at `T001` in every feature's `tasks.md`, so an unscoped match means the first feature to reach the tracker permanently suppresses `T001` for every later feature -- a silent gap in exactly the multi-feature repos this command is for. 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.
7676
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 `[<feature>] T001: <description>`, where `<feature>` is the basename of FEATURE_DIR parsed in step 1 (the `NNN-name` spec directory, e.g. `002-billing`), followed by the ID written once and then the task description (for example, the line `- [ ] T001 Create project structure` in feature `002-billing` becomes the title `[002-billing] T001: Create project structure`). The ID keeps its own word boundaries, so the `\bT\d{3,}\b` matching above is unchanged by the prefix.
7777
- **Skip** a task only when an existing issue matches **both** this feature's identifier and the task ID, and report it (for example, `[002-billing] T001 already has an issue, skipping`). A `T001` belonging to another feature is a different task and must not suppress this one.
78-
- Issues created before this scoping exists carry a bare `T001: ...` title. Treat those as matching only when no `[<feature>]` prefix is present anywhere in the fetched set for that ID, so an upgrade does not re-create issues that are already tracked.
78+
- Issues created before this scoping exists carry a bare `T001: ...` title, and a bare title carries no feature identity: it cannot show which feature's `T001` it tracks, and the absence of a scoped title for that ID does not show it either. So never decide a bare match on your own, in either direction -- skipping silently drops this feature's task when the issue belongs to another feature, and creating duplicates it when the issue is this feature's. Before creating anything, list every task ID that matched only a bare title, each with the issue number, the issue title and this feature's description for that task, and ask the user which of those issues already track this feature's tasks. Skip the ones the user confirms and create the rest with the scoped title. Then offer to retitle each confirmed issue to the scoped form (`[<feature>] T001: ...`) so later runs match it without asking, and retitle only the issues the user agrees to.
7979
- Only create issues for tasks that do not yet have a matching issue.
8080

8181
> [!CAUTION]

‎tests/unit/test_taskstoissues_feature_scope.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,33 @@ def test_pre_existing_unscoped_issues_are_still_recognised(template_text: str) -
6060
"the template no longer says what to do with issues created before the feature "
6161
"prefix, so an upgrade would duplicate every already-tracked task"
6262
)
63+
64+
65+
def test_a_bare_title_is_never_decided_on_the_agents_own(template_text: str) -> None:
66+
"""A bare `T001: ...` title names no feature, so nothing in it can settle a match.
67+
68+
Treating it as this feature's whenever no scoped title exists for the ID brings
69+
#4271 straight back on the first run after upgrading: a bare `T001` filed for
70+
`001-auth` suppresses `002-billing`'s `T001` because billing has no scoped issue
71+
yet. Treating it as another feature's duplicates every task an existing user
72+
already tracks. Only the user can say which it is.
73+
"""
74+
legacy_rule = _line_containing(template_text, "before this scoping exists")
75+
assert "ask the user" in legacy_rule, (
76+
"the rule for pre-prefix issues must hand the ambiguous matches to the user "
77+
f"rather than resolve them:\n {legacy_rule.strip()}"
78+
)
79+
assert not re.search(r"treat (those|them) as matching", legacy_rule, re.IGNORECASE), (
80+
"a bare title is being treated as a match on the agent's own inference, which "
81+
f"lets another feature's T001 suppress this one:\n {legacy_rule.strip()}"
82+
)
83+
assert re.search(r"before creating anything", legacy_rule, re.IGNORECASE), (
84+
"the question has to come before any issue is created, or the answer can no "
85+
f"longer prevent a duplicate:\n {legacy_rule.strip()}"
86+
)
87+
88+
89+
def test_confirmed_legacy_issues_are_only_retitled_with_consent(template_text: str) -> None:
90+
"""Retitling is what stops the question recurring, and it edits the user's issues."""
91+
legacy_rule = _line_containing(template_text, "before this scoping exists")
92+
assert "retitle" in legacy_rule and "agrees" in legacy_rule, legacy_rule.strip()

0 commit comments

Comments
 (0)