tickets: on Windows, case-only twin ids can alias one plan file, and discard_unbuilt_plan can delete the twin's unbuilt plan
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 42/100
調査の方向性
Start with src/bmad_loop/tickettree.py around discard_unbuilt_plan and the case-twin guard in src/bmad_loop/stories.py; then trace how tickets.py find names plan files. Add regression coverage for the three-entry case-only ID layout on Windows, including the rollback path described in the issue. Done means the twins cannot alias a plan and discarding one ticket's unbuilt plan preserves the other's.
索引モデルが issue の本文から書いたものです。
説明
Status (needs confirmation)
- Observed: on NTFS, an epic with three entries titled
Cart modeland idsX1,A1anda1gets plan namesstory-cart-model-A1-plan.mdandstory-cart-model-a1-plan.mdfromtickets.py find, which are one file.TicketTree.discard_unbuilt_plan("1.A1", <that path>)then deletes the file even though it holdsticket: a1and was written for1.a1. A twin plan with a body is refused (the frontmatter-only check), so only an unbuilt twin plan is at risk. - Observed controls: twins with two entries (same title, case-different titles, or different titles) get distinct names (
story-cart-model-plan.md/story-cart-model-a1-plan.md, or…-rules-plan.md), and the discard leaves the twin's plan alone. A three-entry layout with a non-colliding third id (A2instead ofa1) also leaves the other plan alone. - Not driven: a tickets run in which this happens (a failed in-place attempt of one twin with
rollback_on_failure = truewhile the other twin's plan is frontmatter-only). Also not driven: the wider consequence that both twins read and mark one shared plan file at all. - A tester should try: the layout above with
[scm] isolation = "none",rollback_on_failure = true, andmax_dev_attempts = 1. Start1.a1first and stop it atin-progresswith a frontmatter-only plan, then run1.A1with a failing session, and check whether1.a1's plan is gone. Please report whether a real run reaches the deletion.
Related: #963 (the same case-only twin ids alias the unit worktree and branch on Windows).
Summary
tickets.py disambiguates colliding title slugs with the entry id. For case-only twin ids, that suffix differs only by case, so on a case-insensitive filesystem both tickets resolve to one plan file. bmad-loop accepts case-only twin ids in tickets mode (stories mode refuses them), and discard_unbuilt_plan deletes a frontmatter-only plan without checking that its ticket: names the ref being rolled back. The deletion was observed through a direct TicketTree.discard_unbuilt_plan call; the proposed failed-run rollback sequence remains untested.
Environment
bmad-loop a5a8f097, Windows 11 10.0.26200 (NTFS), PowerShell 7.6.6 (SHELL unset), Python 3.13.2; pure calls (the real tickets.py find from the test suite's v7 sandbox, TicketTree.discard_unbuilt_plan); Linux oracle: n/a (on a case-sensitive filesystem the two plan names are two files; expected, not run).
Steps to reproduce (symbol level)
From a bmad-loop checkout at a5a8f097 after uv sync --all-extras, in PowerShell 7 with SHELL removed. The steps are complete and runnable as shown: save the script below as repro_twin_plan.py in the checkout root, then run:
Remove-Item Env:SHELL -ErrorAction SilentlyContinue
$env:PYTHONUTF8 = '1'
uv run python repro_twin_plan.py
import os, sys, tempfile
from pathlib import Path
sys.path.insert(0, "tests")
import conftest as C
from bmad_loop import tickettree
from bmad_loop.journal import Journal
root = Path(tempfile.mkdtemp(prefix="twin-plan-"))
(root / ".gitignore").write_text(C.V7_GITIGNORE, encoding="utf-8")
lay = C.install_bmad_v7(root)
C.write_ticket_tree(lay, (C.EpicSpec(1, "epic-cart", "Cart", (C.EntrySpec(1, "x"),)),))
(lay.initiative_folder / "epic-cart" / "tickets.toml").write_text(
"".join(f'[[entry]]\nid = "{i}"\ntype = "story"\ntitle = "Cart model"\n\n' for i in ("X1", "A1", "a1")), encoding="utf-8")
C._commit_template(root)
plans = {r: Path(C.run_tickets(lay, "find", r)["plan"]) for r in ("1.A1", "1.a1")}
print({r: p.name for r, p in plans.items()}, "same file:", os.path.normcase(str(plans["1.A1"])) == os.path.normcase(str(plans["1.a1"])))
plans["1.a1"].write_bytes(b"---\nticket: a1\nstatus: in-progress\n---\n") # 1.a1's unbuilt plan
(root / "run").mkdir()
print(tickettree.TicketTree(root).discard_unbuilt_plan("1.A1", plans["1.A1"], Journal(root / "run")))
print("1.a1's plan exists after 1.A1's discard:", plans["1.a1"].exists())
Observed (Windows, 2 of 2 runs; paths elided):
{'1.A1': 'story-cart-model-A1-plan.md', '1.a1': 'story-cart-model-a1-plan.md'} same file: True
PlanMark(ref='1.A1', …, before='in-progress', after='', outcome='discarded', created=False)
1.a1's plan exists after 1.A1's discard: False
For a non-colliding three-entry control, change the third entry id from a1 to A2, replace both lookup/use keys 1.a1 with 1.A2 throughout the script, and change the written frontmatter from ticket: a1 to ticket: A2. Keep the discard target 1.A1. Expected and observed: the plan names end in -A1-plan.md and -A2-plan.md, the discard returns outcome='noop', and the other plan remains present.
Source
At a5a8f097, src/bmad_loop/tickettree.py:530-565 (discard_unbuilt_plan): _locate(ref, plan) (:534) ties the path to what tickets.py find names for ref (here the shared file), then it reads the plan's status, refuses a plan with a body (:551-554) and unlinks it (:562). The plan's own ticket: is never compared with ref. Stories mode's case-twin guard is src/bmad_loop/stories.py:162-176. Source-derived: the inspected tickets source and engine contain no case-folded ticket-ID collision check; the direct TicketTree reproduction accepts these two refs. The full preflight and engine rollback route was not exercised.
Suggested fix
Not validated: refuse case-only twin ids in the tickets preflight, validate and run --dry-run, as stories mode does. Independently, have discard_unbuilt_plan refuse a plan whose ticket: does not name the ref.
- 主要言語
- Python
- スター
- 196
- フォーク
- 78
- 平均マージ
- 9時間 24分
- マージ済み PR(30日)
- 44
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bmad-code-org/bmad-loop のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bmad-code-org/bmad-loop#1063 ·
メンテナーはふだん 1 日以内に返信
-
psmux: task window name starting with '-' creates no window; session reads as crashed対応中かも @RECOHA が 8 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
bmad-code-org/bmad-loop#1061 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
bmad-code-org/bmad-loop#1057 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
bmad-code-org/bmad-loop#973 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bmad-code-org/bmad-loop#965 ·
メンテナーはふだん 1 日以内に返信
bmad-code-org/bmad-loop の issue をすべて見る
似ている issue
-
DMB documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ubuntu/ubuntu-project-docs#921 ·
メンテナーはふだん 1 日以内に返信
-
⏳ Pending feedback 🐛 Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jumpserver/jumpserver#18282 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/loom#2014 ·
メンテナーはふだん 1 日以内に返信
-
accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
future-agi/future-agi#5274 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 2 日以内に返信