fix(engine): tell dispatched sessions the sprint board is orchestrator-owned - #446
fix(engine): tell dispatched sessions the sprint board is orchestrator-owned#446didostap wants to merge 1 commit into
Conversation
WalkthroughThe change adds orchestrator-owned sprint-board guidance to development and review prompts. Review prompts can redirect unfinished work to ChangesSprint-board prompt ownership
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 266-280: Replace the verbose Unreleased changelog paragraph with
one concise, imperative summary of the orchestrator-owned sprint board behavior
and shared prompt prohibition. Remove the detailed mode-specific exceptions and
follow-up nuances from CHANGELOG.md; retain those details in the existing
documentation at docs/FEATURES.md.
In `@docs/FEATURES.md`:
- Line 38: Update the sprint-status.yaml ownership description in the feature
documentation to limit orchestrator ownership to writes made during its runtime,
while explicitly preserving write access for external bmad-sprint-planning and
bmad-correct-course skill runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 170e0204-c340-4ef3-81bb-e2adb600203c
📒 Files selected for processing (7)
CHANGELOG.mddocs/FEATURES.mdsrc/bmad_loop/engine.pysrc/bmad_loop/stories_engine.pytests/test_engine.pytests/test_stories_engine.pytests/test_sweep.py
Greptile SummaryThis PR fixes a race condition where the orchestrator writes The fix injects a shared board-ownership prohibition into story dev prompts and all review prompts, with an additional
Confidence Score: 5/5Safe to merge. The change adds two pure string-returning methods and refactors how existing methods are composed; it touches no state machines, no I/O paths, and no verification logic. The implementation is a narrow, well-contained prompt-text change. The separator refactoring is applied consistently at all three call sites in Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/bmad_loop/engine.py | Core change: adds _sprint_board_instruction() and _board_handback_redirect() methods; refactors _generic_dev_prompt and _review_prompt to compose board + park clauses with correct separator logic. |
| src/bmad_loop/stories_engine.py | Adds _sprint_board_instruction() override returning empty string to suppress both board clauses from the review prompt in a mode that has no sprint board. |
| tests/test_engine.py | Adds 7 new tests covering: clause contract, both halves in the review prompt, correct ordering, punctuation-noise prevention, all dev-prompt branches, no blocked invite on dev prompts, and standalone behavior when parking is disabled. |
| tests/test_stories_engine.py | Adds one test verifying the stories mode review prompt carries neither the board clause nor the status: blocked hand-back, with an ablation guard. |
| tests/test_sweep.py | Adds one test confirming sweep bundle dev prompts carry neither board clause half while the inherited sweep review prompt carries both. |
| CHANGELOG.md | Amends the stale #334 note in place and adds a new Fixed entry describing the board-ownership injection. |
| docs/FEATURES.md | Corrects two stale claims that described the sprint board as BMAD-skills-owned; both now accurately state the orchestrator owns every in-flight write. |
Reviews (5): Last reviewed commit: "fix(engine): tell dispatched sessions th..." | Re-trigger Greptile
…r-owned The orchestrator advances sprint-status.yaml as soon as dev verifies, but the story's single commit lands only after the review loop, so every session dispatched in between opens on an uncommitted, unattributed board change with nothing in the repo naming its author. A review session read that write as a spec violation, reverted it, and the bmad-code-org#334 contradiction gate escalated a story both sessions agreed was finished. Story dev prompts and the review prompts of sprint and sweep runs now carry one shared prohibition: never write the board, never revert it, and a row at done or awaiting-operator is the orchestrator's own bookkeeping rather than a defect. Review prompts alone add the way out, pointing a reviewer that judges the story genuinely unfinished at status: blocked. Dev prompts deliberately get no such invitation, since blocked halts the whole run and a repair session would gain a sanctioned early exit out of one that otherwise keeps going. Stories mode overrides the clause away, having no board at all. Supersedes the bmad-code-org#334 note that review prompts were unchanged by design: verify_review reads the spec's frontmatter status before it ever reads the board, so withholding sign-off through the spec already blocks the commit and the board revert was never the load-bearing channel. Both entries are unreleased, so bmad-code-org#334 is amended in place rather than rebutted. Also corrects two stale claims in docs/FEATURES.md that described the board as owned by BMAD skills with the orchestrator only reading it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
79a0066 to
be0b145
Compare
|
Skipping this one. The 80% threshold is not met anywhere in this codebase: engine.py is at 53%, stories_engine.py at 52%, sweep.py at 38%. The functions this PR adds are at 11 of 12, about 92%, so the diff raises coverage rather than lowering it.
|
|
Thank you for this, @didostap — both for the report and for coming back with a fix. The diagnosis is right and the design is right: naming the board's owner in the prompt is the only channel that reaches the reviewer's actual decision surface, and you found the two halves that matter (a prohibition on every dev leg, a hand-back that rides the review prompt alone because Closing this one rather than asking you to rebase, because the branch has drifted in a way a rebase would resolve silently and wrongly: 1. The base predates 2. The CHANGELOG hunk amends a sentence that no longer exists. 3. This repo's CI never ran on it. The functions themselves are otherwise unchanged between your base and
Your nine tests carried over as the starting point; four were rewritten, mostly to replace assertions built from the builder's own return value with test-local literals ( The plugin-workflow gap you flagged is tracked and is phase 3 of #437. Thanks again — this was a good catch and a good fix. |
The orchestrator advances sprint-status.yaml as soon as dev verifies, but
the story's single commit lands only after the review loop — so every
session dispatched in between opens on an uncommitted, unattributed board
change with nothing in the repo naming its author. A review session read
that write as a spec violation, reverted it, and the #334 contradiction
gate escalated a story both sessions agreed was finished.
Story dev prompts and the review prompts of sprint and sweep runs now
carry one shared prohibition: never write the board, never revert it, and
a row at done or awaiting-operator is the orchestrator's own bookkeeping
rather than a defect. Review prompts alone add the way out — hand back
through status: blocked. Dev prompts deliberately get no such invitation,
since blocked halts the whole run and a repair session would gain a
sanctioned early exit out of one that otherwise keeps going.
Supersedes the #334 note that review prompts were unchanged by design:
verify_review reads the spec's frontmatter status before it ever reads
the board, so withholding sign-off through the spec already blocks the
commit and the board revert was never the load-bearing channel. Both
entries are unreleased, so #334 is amended in place rather than rebutted.
Also corrects two stale claims in docs/FEATURES.md that described the
board as owned by BMAD skills with the orchestrator only reading it.
Closes #437
Summary by CodeRabbit
Documentation
Improvements
Tests