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

未关闭 适合新手
#2,289 2 条评论 1 个 reaction 已指派 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/冲突规则,然后编辑 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 小时
30 天内合并 PR
58

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Fission-AI/OpenSpec 的其他 Issue

查看 Fission-AI/OpenSpec 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。