github / github/spec-kit

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

Đang mở
#4,270 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
137k
Fork
12.3k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
159

Mô tả

## 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
72/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.