github / github/spec-kit

[Bug]: create-new-feature.sh reserves feature numbers non-atomically — concurrent invocations can share/overwrite a spec directory

未关闭
#4,270 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
137k
派生
12.3k
平均合并
2 天 12 小时
30 天内合并 PR
159

描述

## Version

spec-kit v1.0.1 (`.specify/scripts/bash/create-new-feature.sh`; the flow is also described in `.claude/skills/speckit-specify/SKILL.md`, "Create the directory and spec file")

## Description

Sequential numbering scans existing `specs/` directories, picks max+1, checks for existence, then uses `mkdir -p` and writes `spec.md`. Nothing in that sequence is atomic: two concurrent invocations (parallel agents on worktrees sharing a specs dir, or two terminals) can both scan, both select the same number, both pass the existence check (`mkdir -p` succeeds either way), and both write `spec.md` into the same directory — the second silently overwrites the first's starting specification.

This matters more now that multi-agent setups routinely run more than one spec-kit session against the same repository.

## Expected behavior

Reserve the directory with plain `mkdir` (no `-p`) so creation is exclusive; on `EEXIST`, discard the selected number, rescan, and retry before writing `spec.md`. A lock file would also work.

## Related

Prior sequential-numbering issues (#935, #975, #1332) covered scan-logic bugs in single-invocation scenarios; this one is specifically about the missing atomicity under concurrency.

贡献指南

打开贡献指南

调研方向

Start with .specify/scripts/bash/create-new-feature.sh and trace how it scans specs/, selects a number, creates the directory, and writes spec.md. Compare the flow with the “Create the directory and spec file” section in .claude/skills/speckit-specify/SKILL.md. Done means concurrent invocations reserve different directories and neither overwrites another invocation’s spec.md.

由索引模型根据 Issue 内容生成。

评估

技术栈
bash
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
72/100

把新 issue 发到你的邮箱

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