sync-specs skill overwrites an existing ADDED requirement, contradicting the CLI's no-op/conflict rule from #1376

オープン 初心者向け
#2,289 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@vaibhavdabas16 がすでに取り組んでいます。

2026年11月22日 から。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
86/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
documentation

調査の方向性

src/core/specs-apply.ts の 583-592 行目付近を読み、#1376 の no-op/conflict ルールを確認してから、getSyncSpecsSkillTemplate(~114 行目)と getOpsxSyncCommandTemplate(~395 行目)の両方にある ADDED Requirements の箇条書きを、src/core/templates/workflows/sync-specs.ts の中でそのルールに合うように編集してください。完了条件は、両方のテンプレートが add-if-missing、skip-if-identical、report-conflict-without-overwriting を明記し、既存のテンプレートテストが引き続き通ることです。

索引モデルが issue の本文から書いたものです。

説明

approved

The sync-specs skill tells the agent to overwrite an ADDED requirement that already exists in the main spec. The CLI stopped doing that in #1376. If an earlier change is synced again after a later change has edited the same requirement, an agent following the skill silently reverts the later edit, where openspec archive would stop with a conflict.

Where (main at 0c737dc, v2.1.1):

src/core/templates/workflows/sync-specs.ts, line 114 in getSyncSpecsSkillTemplate and line 395 in getOpsxSyncCommandTemplate:

**ADDED Requirements:**
- If requirement doesn't exist in main spec → add it
- If requirement already exists → update it to match (treat as implicit MODIFIED)

Compare src/core/specs-apply.ts, lines 583 to 592, which implements the fix for #1332. When an ADDED requirement already exists, identical content is skipped as a no-op and differing content throws ADDED failed ... already exists.

Sequence

  1. Change A adds requirement R, and is synced to openspec/specs/ while A stays active. This is the early-sync pattern from #1332, and the skill allows syncing an active change.
  2. Change B modifies R, for example by adding a scenario, and is synced or archived.
  3. A is synced again, either by running sync on it a second time or by choosing "Sync anyway" when archiving it.

In step 3 R already exists and no longer matches A's ADDED block. The CLI treats that as a genuine conflict and aborts. The skill tells the agent to "update it to match", which replaces R with A's original version and drops B's scenario without any warning.

I haven't reproduced the agent overwrite in a live session. This came out of an automated review of the skill files openspec init generated in my repo (1.6.0, where the same lines exist). I confirmed the text is unchanged on current main and read the CLI path in source.

Suggested fix

Make the skill match the CLI:

**ADDED Requirements:**
- If requirement doesn't exist in main spec → add it
- If it already exists with identical content → leave it unchanged (already synced; re-syncing is a no-op)
- If it already exists with different content → do not overwrite; report the conflict and ask the user
  to reconcile it (a later change may have edited it, or the delta should use MODIFIED)

Happy to turn this into a PR against both templates.

主要言語
TypeScript
スター
76k
フォーク
5.2k
平均マージ
1日 5時間
マージ済み PR(30日)
58

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Fission-AI/OpenSpec のほかの issue

Fission-AI/OpenSpec の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。