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

Aperta Adatta ai principianti
#2,289 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@vaibhavdabas16 ci sta già lavorando.

Dal 22/11/2026.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
86/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
documentation

Direzione di ricerca

Leggi src/core/specs-apply.ts intorno alle righe 583-592 per vedere la regola no-op/conflitto da #1376, poi modifica il punto elenco ADDED Requirements sia in getSyncSpecsSkillTemplate (riga ~114) sia in getOpsxSyncCommandTemplate (riga ~395) di src/core/templates/workflows/sync-specs.ts in modo che corrisponda. Fatto significa che entrambi i template indicano add-if-missing, skip-if-identical e report-conflict-without-overwriting, con i test esistenti dei template che continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
76k
Fork
5.2k
Merge medio
1g 5h
PR unite (30g)
58

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Fission-AI/OpenSpec

Tutte le issue di Fission-AI/OpenSpec

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.