Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/.idd/attachments/issue-499/_manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"issue": 499,
"fetched_at": "2026-11-11T05:42:00Z",
"fetched_by": "idd-diagnose",
"files": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
schema: spec-driven
created: 2026-11-11
created_by: che cheng <kiki830621@gmail.com>
created_with: claude
archived_by: che cheng <kiki830621@gmail.com>
archived_at: 2026-11-11
45 changes: 45 additions & 0 deletions openspec/changes/archive/2026-11-11-idd-499-fix1/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
**GitHub-side tracker**: #499

## Problem

#499 的 verify 第 1 輪判定 PASS,表裡有五項要在這張修的問題:

1. idd-plan Step 2 新加的查詢區塊不檢查 NUMBER。那一次 Bash 呼叫裡沒設、或不是數字時,名稱過濾比對不到任何東西,區塊印 new,開著的 change 被讀成沒有;值是點加星號這類字串時會比對到別張 issue 的 change。
2. idd-implement Step 2 決定 tasks 寫到哪裡時看最新那則 plan 的標題,並寫明不看留言是誰貼的;「已經有 Spec tasks 留言就不再貼」也沒有限定作者。讀取 plan 行的指令只讀有寫入權的帳號貼的 plan,兩邊選到的可能不是同一則。契約第 3 步的說明有同樣的缺口。
3. spec-wrapper-contract 檢查「核准之後才 propose」的句子有沒有帶限定時,豁免字樣「有核准」也比對到「沒有核准」。
4. 同一個 suite 檢查「idd-plan 沒有任何一行說 Step 2 被跳過」時,否定句的排除以整行為單位,同一行另有一句真的說跳過時會漏掉。
5. 第 3 項那個檢查只看帶有 tier 名稱的句子;契約講 plan 行的那一段改寫後沒有那個詞,拿掉它的限定,檢查仍然通過。

## Root Cause

第 1 項:區塊照契約第 3 步的查詢逐行抄寫,契約的查詢本來就不檢查 NUMBER;新區塊的目的是讀不到時停下,卻沒有檢查它自己需要的輸入。第 2 項:寫 Step 2 的規則時只想到兩個 skill 用同一個帳號貼文、不能用「是不是自己貼的」來分,把它寫成「不看留言是誰貼的」,連有沒有寫入權也一起不看了。第 3 到 5 項:檢查是照當時的句子寫的,沒有用應該被抓到的資料測過檢查本身。

## Proposed Solution

- 第 1 項:區塊在查詢之前檢查 NUMBER,沒設、空字串、以 0 開頭或不是十進位數字時印 stop 加原因,不執行任何列出 change 的指令。查詢的三行不動,仍與契約第 3 步逐行相同。規格那一句加上這個情況,Example 加六列。
- 第 2 項:Step 2 與契約寫明,最新那則 plan 就是讀取 plan 行的指令選的那一則(有寫入權的帳號貼的),Spec tasks 留言也只有有寫入權的帳號貼過才算已經貼過。規格加一句;讀取端的行為沒有改,既有的 Example 已經有「沒有寫入權的帳號貼的 plan 不算」那一列。
- 第 3 到 5 項:三個檢查改嚴,並各加自測:把應該被抓到的句子餵給檢查,確認它抓得到。

## Non-Goals

- 契約第 3 步的查詢(idd-implement 執行的那一份)加同樣的 NUMBER 檢查:那一份在 #480 就是這樣,與清單形狀不對時讀成沒有 change 是同一類,記在 #496。這次只讓新區塊擋住自己的輸入。
- 兩份查詢合成單一實作(#500 第 10 項)。
- 用程式檢查 Step 2 實際選到哪一則留言:選留言與貼留言由照 SKILL.md 執行的模型做,規格把它列在 No executable check,這次不改。
- ASSUMPTION: 不升版號,CHANGELOG 補在既有的 Unreleased 條目。

## Success Criteria

- spec-wrapper-contract 新增的檢查在改動前失敗、改動後通過:NUMBER 沒設、空字串、abc、帶井號的 7、點加星號、07 六種情況各印一行以 stop 開頭的結果,而且不執行任何列出 change 的指令;三個自測各抓到它該抓的句子;每一行說「就不再貼」的都寫明有寫入權的帳號。
- 查詢原有的十列、逐行比對與 stop 原因相同這些檢查照舊通過。
- run-all-tests 的 73 個 suite 與 spectra-archive-post-ic 全部通過。
- 連結檢查對改過的 requirement 回 ok。

## Impact

- Affected specs: spec-on-every-issue(MODIFIED requirement「Spec changes go through Spectra behind IDD wrappers」)
- Affected code:
- Modified: plugins/issue-driven-dev/skills/idd-plan/SKILL.md
- Modified: plugins/issue-driven-dev/skills/idd-implement/SKILL.md
- Modified: plugins/issue-driven-dev/references/spec-wrapper.md
- Modified: plugins/issue-driven-dev/scripts/tests/spec-wrapper-contract/test.sh
- Modified: plugins/issue-driven-dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
## MODIFIED Requirements

### Requirement: Spec changes go through Spectra behind IDD wrappers

`idd-implement` SHALL be the wrapper for the Simple tier and `idd-plan` the wrapper for the Plan tier, and both SHALL follow one shared contract kept in `references/spec-wrapper.md`. Which phase of `idd-all` invokes which skill stays stated once, in the dispatch table of `skills/idd-all/SKILL.md`; this requirement constrains what the invoked skills do. A wrapper SHALL create one Spectra change per issue, named `idd-<N>-<slug>`, SHALL produce the proposal, the spec delta and the tasks through Spectra's propose workflow, and SHALL implement the tasks through Spectra's apply workflow, with the test of each Example written before the code it checks. The Implementation Plan comment (the Plan tier, or `idd-implement` Step 2) SHALL carry exactly one line that starts with `**Spec plan**:`, in one of four forms: `proposed (change <name>)`, which `idd-plan` writes before plan mode and replaces with `change <name>` once the maintainer approves; `change <name>`; `no behaviour change (<a|b|c|d>)`; or `third-party clone`. Later steps read the decision from that line. `idd-implement` posts its own plan line before it proposes, and a fix round posts a plan line naming `change idd-<N>-fix<k>` before it proposes the fix change, so a run that is cut off finds a plan that names its change; in an attended Plan-tier run through `idd-plan`, the change is proposed only after `idd-plan` has written `change <name>` on approval. `scripts/spec-change.py plan --comments <file>` SHALL read it: from the comments as the REST API returns them, it takes the newest comment by an `OWNER`, `MEMBER` or `COLLABORATOR` whose body starts, after leading whitespace, with the heading `## Implementation Plan` (followed by the end of the line, a space or `(`), reads its `**Spec plan**:` line outside code fences, and prints one JSON line with `form` (`proposed`, `change`, `no-behaviour-change`, `third-party-clone`, `none` when there is no such comment or line, or `invalid`) and `change`, exiting 0, 1 for `invalid`, or 2 when the file cannot be read. Before it proposes or posts anything, `idd-implement`, finding an open change of the issue, SHALL run that command and SHALL go on with the change only when the form is `change` with the same name; under any other form it SHALL stop and say how to go on: run `/idd-plan`, which presents the Implementation Plan for approval again and, on approval, writes `change <name>` for the open change. `idd-plan` does not run this check: a fixed bash block in its Step 2 SHALL look up the issue's open `idd-<N>-` change with `spectra list --json` and `spectra list --parked --json`, in the same lines as the lookup of the contract's step 3, and SHALL print one line that starts with `→ idd-plan change lookup: ` and ends with the name of the first such change (active before parked), with `new` when there is none, or with `stop: ` and a reason when either list cannot be read or is not JSON. When the issue number in the shell of that block (`NUMBER`) is unset, empty, starts with `0` or is not a decimal number, the block SHALL print the `stop: ` line without running either list command: the name filter would otherwise match nothing, or another issue's change, and the issue would be reported as having no open change. `idd-plan` names an open change in its plan instead of choosing a new name, and stops when the line says `stop:`. When the list of changes cannot be read, or is not JSON, the wrapper SHALL stop rather than treat the issue as having none. Invoked directly on a Plan-tier issue, `idd-implement` SHALL still offer `/idd-plan` before it proposes; having a change skips only the TaskList it would otherwise build. When Spectra's propose workflow leaves the change parked, the wrapper SHALL take it out of the parked state itself before apply, and only that change. In a run that `references/unattended-contract.md` marks as unattended, the wrapper SHALL tell Spectra's propose and apply skills not to ask questions and to record each choice they would have asked about as a line starting with `ASSUMPTION:` in the artifact. For the Simple tier the wrapper SHALL use the light form: no discuss step and no design artifact. For the Plan tier in an attended run, `idd-plan` SHALL present the Implementation Plan for approval in plan mode and SHALL NOT propose; on approval it SHALL hand the issue and the change name to `idd-implement`, which proposes in the light form and applies, as in the Simple tier. After it proposes, `idd-implement` SHALL NOT edit a plan comment whose heading is `## Implementation Plan (Plan tier)`, which is the plan the maintainer approved: it SHALL post the tasks of the change in a separate comment that starts with `## Spec tasks (change <name>)`, one task per line and without checkboxes, unless an `OWNER`, `MEMBER` or `COLLABORATOR` has already posted such a comment for that change. The newest plan, whose heading decides this, is the comment that `scripts/spec-change.py plan` reads: a plan or a `## Spec tasks` comment posted by an account without write access counts as neither. Where the newest plan is the one `idd-implement` posted itself, it replaces the list of that comment with the tasks and leaves its single `**Spec plan**:` line as it is. Approving the proposal itself in plan mode is not part of this requirement (#497). A Plan-tier issue in an unattended run goes to `idd-implement` as it does today and takes the light form. For the Spectra tier the existing chain of discuss, propose and apply stays as it is, preceded by the same preflight as the other tiers; that preflight SHALL run before any check that Spectra is installed, so that a third-party clone proceeds without Spectra, and Spectra's propose skill SHALL receive the same instructions on Examples, unique titles and test markers as in the other tiers. When a Spectra-tier issue is run by hand from the hand-off that `idd-diagnose` prints, the same preflight SHALL run before `/spectra-discuss`, and the issue SHALL be closed out as the contract's steps 5 and 6 say. When the issue has a change, the checklist of its Implementation Complete comment, headed `### Checklist (synced from tasks.md)`, SHALL copy the checkbox lines of the archived `tasks.md` of each change in order; the Spectra tier posts no `### Checklist` and its checklist lives in the issue body under `## Current Status` > `### Tasks`. The preflight call SHALL turn the account's permission into `--can-write` the same way in the shared contract and in `idd-all` Phase 3b, and SHALL stop on any outcome other than `ready` or `third-party`. Outside the wrappers and the shared contract, no IDD skill SHALL depend on the arguments or the output of Spectra's propose or apply skills for the Simple and Plan tiers.

The preflight call, the unattended check, the unpark and `idd-plan`'s lookup of an open change are fixed bash and are checked by the Examples below. No executable check: choosing what to propose, the routing questions, posting the Spec tasks comment and the apply itself are carried out by a model that follows SKILL.md; what they leave behind is checked by the Examples of the other requirements of this capability (the Spec line, the archive, the links), and that neither a Spec tasks comment nor a plan posted by an account without write access is read as the newest plan is checked by the Example on reading the Spec plan line.

#### Scenario: A Simple issue uses the light form

- **GIVEN** an issue whose Diagnosis records `Simple`
- **WHEN** `idd-implement` runs
- **THEN** it creates the change `idd-<N>-<slug>` with a proposal, a spec delta and tasks, creates no design artifact, runs no discuss step, and applies the tasks

#### Scenario: A Plan issue keeps its approval in an attended run

- **GIVEN** an attended run and an issue whose Diagnosis records `Plan`
- **WHEN** `idd-plan` runs
- **THEN** it asks for approval of the Implementation Plan in plan mode without proposing, and only after approval hands the issue and the change name to `idd-implement`, which proposes in the light form, posts the tasks of the change in a separate `## Spec tasks` comment, leaves the approved plan comment as it is, and applies

#### Scenario: An unattended run does not stop on Spectra's questions

- **GIVEN** an unattended `/idd-all` run on a Simple issue, and a change that Spectra's propose workflow left parked
- **WHEN** the wrapper reaches apply
- **THEN** it unparks the change, and Spectra's apply skill receives the instruction not to ask whether to continue

#### Scenario: A Spectra-tier issue in a third-party clone without Spectra

- **GIVEN** a clone the session account cannot write to, no `spectra` command on PATH, and a Diagnosis that records `Spectra`
- **WHEN** `idd-all` reaches Phase 3b
- **THEN** the preflight prints `third-party` before any check for Spectra, Phase 3b does not run, and the issue is implemented on the Simple path with `**Spec**: third-party clone`

##### Example: the preflight call routes by permission and Spectra

| Permission `gh` reports | `spectra` on PATH | Spec directory | Printed status | The run |
| --- | --- | --- | --- | --- |
| `WRITE` | yes | present | `ready` | proceeds |
| `ADMIN` | no | present | `install-spectra` | stops |
| `READ` | no | absent | `third-party` | proceeds without a spec change |
| `TRIAGE` | yes | present | `third-party` | proceeds without a spec change |
| nothing (the call failed) | yes | present | `error` | stops |
| `SOMETHING_ELSE` | yes | present | `error` | stops |

##### Example: contract steps 3 and 4 run as written

| `IDD_ALL_UNATTENDED` | Parked changes | Step 3 prints | Step 4 unparks |
| --- | --- | --- | --- |
| `1` | `idd-7-x` | `unattended` | `idd-7-x` |
| unset | `idd-7-x` | `attended` | `idd-7-x` |
| unset | `idd-8-y` only | `attended` | nothing |
| unset | none | `attended` | nothing |

##### Example: reading the Spec plan line

| Comments, oldest first | `form` | `change` | Exit |
| --- | --- | --- | --- |
| an `## Implementation Plan` by an `OWNER` with `**Spec plan**: change idd-7-x` | `change` | `idd-7-x` | 0 |
| a plan with `**Spec plan**: no behaviour change (a)` | `no-behaviour-change` | empty | 0 |
| a plan with `**Spec plan**: third-party clone` | `third-party-clone` | empty | 0 |
| a plan with `**Spec plan**: proposed (change idd-7-x)` | `proposed` | `idd-7-x` | 0 |
| the owner's plan naming `idd-7-x`, then a newer `## Implementation Planning notes` comment | `change` | `idd-7-x` | 0 |
| the owner's plan naming `idd-7-x`, then a newer `## Spec tasks (change idd-7-x)` comment | `change` | `idd-7-x` | 0 |
| a plan with `**Spec plan**: rejected (change idd-7-x left parked)` | `invalid` | empty | 1 |
| the owner's plan naming `idd-7-x`, then a newer plan by a `CONTRIBUTOR` naming `idd-7-y` | `change` | `idd-7-x` | 0 |
| no Implementation Plan comment | `none` | empty | 0 |
| a plan whose only `**Spec plan**:` line is inside a code fence | `none` | empty | 0 |
| a plan with two `**Spec plan**:` lines | `invalid` | empty | 1 |
| the file is not JSON | no JSON line | not applicable | 2 |

##### Example: an open change is checked against the newest plan

| Open change of the issue | Newest plan's `**Spec plan**:` line | Step 3 prints |
| --- | --- | --- |
| none | not read | `propose` |
| `idd-7-x` | `change idd-7-x` | `go on with idd-7-x` |
| `idd-7-x` | `proposed (change idd-7-x)` | a stop that names `/idd-plan` |
| `idd-7-x` | `change idd-7-y` | a stop that names `/idd-plan` |
| `idd-7-x` | no plan comment | a stop |
| the change list cannot be read | not read | a stop, not `propose` |
| the change list is not JSON | not read | a stop, not `propose` |

##### Example: idd-plan looks up the open change of the issue

| Issue | Active changes | Parked changes | The block prints |
| --- | --- | --- | --- |
| 7 | `idd-7-x` | none | `→ idd-plan change lookup: idd-7-x` |
| 7 | none | `idd-7-x` | `→ idd-plan change lookup: idd-7-x` |
| 7 | none | none | `→ idd-plan change lookup: new` |
| 7 | `idd-7-a` | `idd-7-b` | `→ idd-plan change lookup: idd-7-a` |
| 7 | `idd-70-x` | none | `→ idd-plan change lookup: new` |
| 70 | `idd-7-x` | none | `→ idd-plan change lookup: new` |
| 7 | the list command fails | none | a line that starts with `→ idd-plan change lookup: stop:` |
| 7 | none | the list command fails | a line that starts with `→ idd-plan change lookup: stop:` |
| 7 | text that is not JSON | none | a line that starts with `→ idd-plan change lookup: stop:` |
| 7 | none | text that is not JSON | a line that starts with `→ idd-plan change lookup: stop:` |
| not set | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |
| empty | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |
| `abc` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |
| `#7` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |
| `.*` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |
| `07` | `idd-7-x` | none | a line that starts with `→ idd-plan change lookup: stop:` |

In every row the block prints exactly one line and does not read the issue's comments. In the first ten rows it runs only the two list commands; in the last six, where the shell holds no usable issue number, it runs neither.
Loading
Loading