tickets: `run --dry-run` predicts "no pause" for a ticket the run pauses on at once (ledger `gate:`, gitignored plan under worktree isolation)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 43/100
Hướng nghiên cứu
Read _dry_run_tickets and _predicted_pause in src/bmad_loop/cli.py, then compare their prediction path with the gates in src/bmad_loop/engine.py and src/bmad_loop/tickets_engine.py. Run the reproduction described in the issue for the gated-ledger and ignored-plan cases. Done means dry-run predicts the corresponding first pause for both cases while the control case still predicts no pause.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The tickets dry-run promises "the first pause a run would reach" (predicted:), but computes it with decide_pick alone and never asks the two pick-time gates the run applies before the first dispatch. When an open deferred-work entry declares gate: 1.1, or when the plan tickets.py find names is gitignored under [scm] isolation = "worktree", the preview says predicted: no pause predicted before 1.1 finishes and run then pauses immediately (story-gate, ticket-tree / ignored-plan) with no session started. The operator gets no warning from the preview of the pause that ends the unattended run they are about to launch.
Environment
bmad-loop a5a8f097, Windows 11 10.0.26200, PowerShell 7.6.6 (SHELL unset), Python 3.13.2 (the checkout's .venv); run driven through cli.main with every adapter replaced by an empty MockAdapter, so no coding CLI can start; Linux: the Ubuntu reproduction uses the same mock-adapter harness; no live tmux session is exercised.
Steps to reproduce
From a bmad-loop checkout at a5a8f097 after uv sync --all-extras, in PowerShell 7 with the checkout as the current directory; the script removes SHELL first and runs as-is from that shell. The script builds three committed one-ticket v7 tickets projects with the test suite's own helpers (tests/conftest.py): control, ledger (an open deferred-work entry with gate: 1.1, committed), and ignored (*-plan.md in .gitignore and isolation = "worktree"). On each it runs run --dry-run, then run through cli.main with cli._make_adapters returning empty MockAdapters: the control row stops at its first session (ScriptExhausted, the harness's own stop), and no coding CLI is ever started.
Remove-Item Env:SHELL -ErrorAction SilentlyContinue
$env:PYTHONUTF8 = '1'
$Root = Join-Path $env:TEMP 'bl-tickets-dryrun'
$env:BMAD_LOOP_STATE_DIR = Join-Path $Root 'state'
Remove-Item -Recurse -Force $Root -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force $Root | Out-Null
$utf8 = [Text.UTF8Encoding]::new($false)
[IO.File]::WriteAllText("$Root\build.py", @'
import sys
from pathlib import Path
sys.path.insert(0, "tests")
import conftest as c
from bmad_loop import bmadconfig
dest, cond = Path(sys.argv[1]), sys.argv[2]
dest.mkdir(parents=True)
(dest / "src.txt").write_text("original\n", encoding="utf-8")
(dest / ".gitignore").write_text(c.V7_GITIGNORE + ("*-plan.md\n" if cond == "ignored" else ""), encoding="utf-8")
layout = c.install_bmad_v7(dest)
c.write_ticket_tree(layout, (c.EpicSpec(1, "epic-cart", "Cart", (c.EntrySpec(1, "Cart model"),)),))
c.install_build_auto_v7_skill(dest)
(dest / ".bmad-loop").mkdir(exist_ok=True)
policy = '[adapter]\nname = "claude"\nmodel = "opus"\n\n[stories]\nsource = "tickets"\n'
if cond == "ignored":
policy += '\n[scm]\nisolation = "worktree"\n'
(dest / ".bmad-loop" / "policy.toml").write_text(policy, encoding="utf-8")
if cond == "ledger":
paths = bmadconfig.load_paths(dest, want_tickets=True)
c.write_gated_ledger(paths, {"DW-1": ("open", ["gate: 1.1"])}, commit=False)
c._commit_template(dest)
'@, $utf8)
[IO.File]::WriteAllText("$Root\run.py", @'
import sys
from bmad_loop import cli
from bmad_loop.adapters.mock import MockAdapter
handed = []
def make(*a, **k):
out = {r: MockAdapter([]) for r in cli.ROLES}
handed.extend(out.values())
return out
cli._make_adapters = make
rc = cli.main(["run", "--project", sys.argv[1]])
print(f"rc={rc} sessions dispatched={[s.task_id for a in handed for s in a.sessions]}")
'@, $utf8)
foreach ($cond in @('control', 'ledger', 'ignored')) {
$p = Join-Path $Root $cond
uv run python "$Root\build.py" $p $cond | Out-Null
"`n=== ${cond}: run --dry-run"
& .\.venv\Scripts\python.exe -m bmad_loop.cli run --dry-run --project $p 2>&1 | Select-String 'predicted|NOT runnable|FAIL'
"rc=$LASTEXITCODE"
"=== ${cond}: run"
& .\.venv\Scripts\python.exe "$Root\run.py" $p 2>&1 | Select-String 'rc=|PAUSED|FAIL|CRASHED'
}
Output (this script as written, 2 of 2 runs identical up to run ids, shown as <run id>; the generated plan path is replaced by <plan-path>; the terminal's line wrapping removed):
=== control: run --dry-run
predicted: no pause predicted before 1.1 finishes
rc=0
=== control: run
CRASHED: ScriptExhausted: no scripted result for session 1.1-dev-1
rc=0 sessions dispatched=['1.1-dev-1']
=== ledger: run --dry-run
predicted: no pause predicted before 1.1 finishes
rc=0
=== ledger: run
PAUSED: 1.1 is gated by unlanded deferred work: DW-1 (gate: 1.1) — close the entry in deferred-work.md (`status: done <date>`) or run `bmad-loop sweep`, then `bmad-loop resume <run id>`
rc=0 sessions dispatched=[]
=== ignored: run --dry-run
predicted: no pause predicted before 1.1 finishes
rc=0
=== ignored: run
PAUSED: the plan <plan-path> of 1.1 is gitignored by the code repository, so under worktree isolation its mark could not ride the unit's commit and the ticket would stay unmarked; commit the plans with the initiative folder, or gitignore the whole store — then `bmad-loop resume <run id>`
rc=0 sessions dispatched=[]
The journals of the two paused runs hold story-gated (dw_ids: ["DW-1"]) then run-paused stage story-gate, and ticket-pick-halt (cause: ignored-plan, stage: ticket-tree) then run-paused; state.json paused_stage is story-gate and ticket-tree. The control row shows the prediction is right when neither gate applies.
Expected vs actual
| actual | expected (docs/tickets-guide.md:71, docs/reference/cli.md:167: dry-run prints "the first pause a run would reach") |
|
|---|---|---|
open ledger entry with gate: 1.1 |
predicted: no pause predicted before 1.1 finishes |
a predicted story-gate pause before 1.1, naming the entry |
plan gitignored, isolation = "worktree" |
predicted: no pause predicted before 1.1 finishes |
a predicted ticket-tree (ignored-plan) pause before 1.1 |
run on each |
pauses before any session | same |
bmad-loop validate already fails the gated-ledger project (deferred.hard-gate), so the ledger row is caught by a second command; the dry-run is the command whose own output says what the run will do first.
This concerns the tickets-specific predicted: first-pause line. Dry-run's zero exit status means the preview rendered; it does not certify readiness, and the generic preflight banner deliberately omits mutable queue and dirty-tree checks.
Linux
The Ubuntu run of the same script (under WSL, Python 3.13.2, git 2.43.0, 2 of 2 passes) shows the ledger dry-run predicting no pause before ticket 1.1 finishes, followed by a story-gate pause with no dispatch. For the ignored-plan case, it shows the same predicted: no pause predicted before 1.1 finishes line, no dispatch and an ignored-plan ticket-tree halt. The control reaches the mock session. These are mock-adapter observations, not live tmux-session tests. The shared Python source explains why the same omission can occur on both Windows and Linux.
Source
At a5a8f097. Observed: the prediction and the pauses above. Source-derived: why.
The dry-run predicts from the pick decision alone, with empty task and binding maps (src/bmad_loop/cli.py:4167-4170); nothing on this path or in _predicted_pause (cli.py:4126-4148) reads the deferred-work ledger or asks git about the plan:
scope = _resolve_ticket_scope(tree, args, (next_view, status_view))
if isinstance(scope, int):
return scope
decision = tickets_source.decide_pick(next_view, status_view, {}, {}, (), scope)
The run asks the ledger for the picked key before registering it (src/bmad_loop/engine.py:1657-1660, in Engine._loop, which TicketsEngine keeps), and _refuse_gated_story raises RunPaused(reason, PAUSE_STORY_GATE, story_key) for an open entry whose gate: names it (engine.py:1682-1812; TicketsEngine matches ticket refs through its own _gate_hits at tickets_engine.py:1340):
# Before ANY state mutation for this story, and deliberately so — see
# _refuse_gated_story. The story is not in state.tasks yet, so a resume
# re-picks it and re-asks the ledger.
self._refuse_gated_story(story.key)
and it runs the two pick gates on the decided ticket before opening it (src/bmad_loop/tickets_engine.py:387-394, TicketsEngine._dispatch_ref; _gate_ignored_plan at :398-427 pauses at ticket-tree when the run is isolated, the store is in the checkout and verify.path_ignored reports the plan ignored):
self._gate_dirty_initiative(decision.ref, decision.row)
try:
found = self.ticket_tree.find(decision.ref)
except TicketsError as e:
self._pause_ticket_pick(
Halt("tree-fault", decision.ref, decision.row, f"tickets.py {e.kind}: {e}")
)
self._gate_ignored_plan(decision.ref, decision.row, Path(found.plan))
Suggested fix
Not validated. Have _dry_run_tickets ask the same predicates for the decided ref before _predicted_pause: the ledger gate through the ticket-ref _gate_hits / _legacy_gate_tokens (tickets_engine.py:1340-1354) over deferredwork.parse_ledger of the ledger, and verify.path_ignored(paths.repo_root, find(ref).plan) when pol.scm.isolation is worktree and the store is in the checkout, then predict the matching pause.
- Ngôn ngữ chính
- Python
- Star
- 196
- Fork
- 78
- Merge trung bình
- 9 giờ 24 phút
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bmad-code-org/bmad-loop
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bmad-code-org/bmad-loop#1063 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
psmux: task window name starting with '-' creates no window; session reads as crashedCó thể đã có người làm @RECOHA đã nhận 8 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
bmad-code-org/bmad-loop#1061 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
bmad-code-org/bmad-loop#1057 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
bmad-code-org/bmad-loop#973 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bmad-code-org/bmad-loop#965 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bmad-code-org/bmad-loop
Issue tương tự
-
Ubuntu for Debian DevelopersĐang mởDMB documentation good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ubuntu/ubuntu-project-docs#921 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
⏳ Pending feedback 🐛 Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jumpserver/jumpserver#18282 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/loom#2014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
future-agi/future-agi#5274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 2 ngày