Skip to content

Resolve BMAD artifacts path from config#18

Open
seven-steven wants to merge 5 commits into
bmad-code-org:mainfrom
seven-steven:fix/bmad-artifacts-config-path
Open

Resolve BMAD artifacts path from config#18
seven-steven wants to merge 5 commits into
bmad-code-org:mainfrom
seven-steven:fix/bmad-artifacts-config-path

Conversation

@seven-steven
Copy link
Copy Markdown

@seven-steven seven-steven commented May 20, 2026

Summary

  • Resolve story automator artifacts paths from BMAD config instead of hardcoding _bmad-output/implementation-artifacts.
  • Support implementation_artifacts, output_folder, docs/bmad/implementation-artifacts, and legacy _bmad-output layouts.
  • Update story lookup, validation, success verifier, and prompt rendering paths with regression coverage.

Test plan

  • PYTHONPATH="/home/seven/data/coding/projects/others/bmad-automator/skills/bmad-story-automator/src" python -m pytest "/home/seven/data/coding/projects/others/bmad-automator/tests/test_success_verifiers.py" -q
  • env -u AI_AGENT PYTHONPATH="/home/seven/data/coding/projects/others/bmad-automator/skills/bmad-story-automator/src" python -m pytest "/home/seven/data/coding/projects/others/bmad-automator/tests" -q

Summary by CodeRabbit

  • Refactor

    • Centralized project-aware artifact path resolution; prompts and commands now use configurable artifact locations instead of fixed paths.
  • New Features

    • Added utility to strip inline YAML comments for more robust config parsing.
    • Step templates: clearer resume/continue workflow and execution rules.
  • Bug Fixes

    • Improved error handling and validation when locating story artifacts and normalizing keys.
    • Success check behavior simplified (expectedMatches-only).
  • Documentation

    • Updated monitoring fallback and workflow docs for clearer lookup paths and recovery guidance.
  • Tests

    • Expanded coverage for docs-based artifact locations and glob-resolution behavior.

Review Change Stack

@seven-steven seven-steven requested a review from bma-d as a code owner May 20, 2026 07:46
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a2b188c0-d9f2-406c-a754-c502225e77c2

📥 Commits

Reviewing files that changed from the base of the PR and between 455e389 and 517e15d.

📒 Files selected for processing (4)
  • skills/bmad-story-automator/data/monitoring-fallback.md
  • skills/bmad-story-automator/src/story_automator/commands/orchestrator_epic_agents.py
  • skills/bmad-story-automator/steps-c/step-01b-continue.md
  • tests/test_success_verifiers.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_success_verifiers.py

Walkthrough

This PR centralizes BMAD implementation-artifact path resolution in a new module, updates prompt templates to use a parameterized implementation-artifacts placeholder, refactors commands and core modules to call the new helpers, and extends tests to cover docs-based and legacy artifact locations.

Changes

Artifact Path Resolution Refactoring

Layer / File(s) Summary
Core artifact path resolution infrastructure
skills/bmad-story-automator/src/story_automator/core/artifact_paths.py, skills/bmad-story-automator/src/story_automator/core/utils.py
New artifact_paths module adds implementation_artifacts_dir, sprint_status_path, implementation_artifacts_relpath, and implementation_artifacts_glob helpers with BMAD config parsing, placeholder substitution, and project-relative validation. Adds strip_inline_yaml_comment utility.
Prompt template parameterization
skills/bmad-story-automator/data/prompts/auto.md, skills/bmad-story-automator/data/prompts/create.md, skills/bmad-story-automator/data/prompts/dev.md, skills/bmad-story-automator/data/prompts/review.md
Prompts updated to use {{implementation_artifacts}}/{{story_prefix}}-*.md instead of hardcoded _bmad-output/implementation-artifacts/{{story_prefix}}-*.md.
Core module refactoring for path resolution
skills/bmad-story-automator/src/story_automator/core/story_keys.py, skills/bmad-story-automator/src/story_automator/core/success_verifiers.py, skills/bmad-story-automator/data/orchestration-policy.json
story_keys now delegates to artifact path helpers; success_verifiers uses the new glob helpers and reworks _resolve_artifact_glob to prefer the resolved artifacts root while still allowing legacy roots with stricter containment checks. Orchestration policy create step removes the glob field.
Command integration and CLI validation
skills/bmad-story-automator/src/story_automator/commands/orchestrator.py, skills/bmad-story-automator/src/story_automator/commands/orchestrator_epic_agents.py, skills/bmad-story-automator/src/story_automator/commands/tmux.py, skills/bmad-story-automator/src/story_automator/commands/validate_story_creation.py
Orchestrator uses implementation_artifacts_dir in _story_file_status and wraps normalization errors; epic-agent parsing uses shared strip_inline_yaml_comment; tmux renders {{implementation_artifacts}} in step prompts and normalizes contract fields; validate-story-creation resolves default artifacts via helpers and tightens payload match-count handling with try/except around default resolution.
Docs, monitoring fallback, and step templates
skills/bmad-story-automator/data/monitoring-fallback.md, skills/bmad-story-automator/steps-c/step-01b-continue.md
Monitoring fallback doc and step-01b template updated to reference {{implementation_artifacts}}, reformat tables and front-matter placeholders, and clarify execution/menu rules and state-summary steps.
Comprehensive test coverage for artifact path resolution
tests/test_success_verifiers.py
Expanded tests add docs-artifact fixtures and BMAD config fixtures, verify docs-based resolution, update CLI and prompt-rendering tests, and adjust a test helper signature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • bma-d

🐰 A rabbit hops through artifact paths bright,
From hardcoded depths to config's light,
Prompts now swap fixed routes for template springs,
Tests tend the gardens where the new logic sings,
Legacy and docs together take flight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Resolve BMAD artifacts path from config' accurately describes the main objective of this PR: replacing hardcoded artifact paths with config-driven resolution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 `@skills/bmad-story-automator/src/story_automator/commands/orchestrator.py`:
- Line 408: The call to implementation_artifacts_dir(get_project_root()) can
raise ValueError and currently bubbles up from the story-file-status flow; wrap
the matches assignment in a try/except that catches ValueError coming from
implementation_artifacts_dir (and get_project_root if applicable) and translate
it into the command's JSON error response instead of letting the exception crash
the process. Specifically, around the line that sets matches =
sorted(implementation_artifacts_dir(get_project_root()).glob(...)), catch
ValueError and emit the same JSON error structure used elsewhere in this command
(or call the existing error helper used by story-file-status), then exit/return
gracefully so the JSON contract is preserved.

In `@skills/bmad-story-automator/src/story_automator/commands/tmux.py`:
- Around line 208-220: The call to
implementation_artifacts_relpath(get_project_root()) inside _render_step_prompt
can raise errors for invalid BMAD path configs and currently may propagate
uncaught; wrap that call in a try/except and convert any path-related exceptions
into a PolicyError so prompt rendering fails with a controlled CLI error (same
error type _build_cmd already handles); update _render_step_prompt to catch
exceptions from implementation_artifacts_relpath (and any OSError/ValueError it
may raise) and re-raise a PolicyError with a clear message mentioning the
artifact path lookup failure.

In
`@skills/bmad-story-automator/src/story_automator/commands/validate_story_creation.py`:
- Around line 15-17: The code eagerly computes project_root =
os.environ.get("PROJECT_ROOT", os.getcwd()) and calls
implementation_artifacts_dir(project_root) into default_artifacts_dir at
import/run time which can raise on invalid BMAD config before action dispatch;
change this to lazy resolution or guarded resolution: remove the immediate call
and defer calling implementation_artifacts_dir until inside the action handlers
that need artifacts (e.g., in the functions handling "check", "prefix", or the
main dispatch), or wrap the call in a try/except that normalizes failures to a
safe default (e.g., None) and only surface errors when an artifact-producing
action runs; update references to default_artifacts_dir/artifacts_dir to obtain
the value at the point of use (call implementation_artifacts_dir(project_root)
there) and ensure the dispatch logic handles a None/invalid artifacts_dir
appropriately.
🪄 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

Run ID: 2d1ad5ef-abbb-4ccb-9629-760ff846bc40

📥 Commits

Reviewing files that changed from the base of the PR and between 33601b9 and c025238.

📒 Files selected for processing (13)
  • skills/bmad-story-automator/data/prompts/auto.md
  • skills/bmad-story-automator/data/prompts/create.md
  • skills/bmad-story-automator/data/prompts/dev.md
  • skills/bmad-story-automator/data/prompts/review.md
  • skills/bmad-story-automator/src/story_automator/commands/orchestrator.py
  • skills/bmad-story-automator/src/story_automator/commands/orchestrator_epic_agents.py
  • skills/bmad-story-automator/src/story_automator/commands/tmux.py
  • skills/bmad-story-automator/src/story_automator/commands/validate_story_creation.py
  • skills/bmad-story-automator/src/story_automator/core/artifact_paths.py
  • skills/bmad-story-automator/src/story_automator/core/story_keys.py
  • skills/bmad-story-automator/src/story_automator/core/success_verifiers.py
  • skills/bmad-story-automator/src/story_automator/core/utils.py
  • tests/test_success_verifiers.py

Comment thread skills/bmad-story-automator/src/story_automator/commands/orchestrator.py Outdated
Comment thread skills/bmad-story-automator/src/story_automator/commands/tmux.py Outdated
Copy link
Copy Markdown
Collaborator

@bma-d bma-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. I verified the four path-resolution regressions on PR head 1bb46f1; each has a small repro in the inline comments. The main blocker is current BMAD configs that use {project-root} resolving to a literal folder, which breaks story lookup, success verification, and prompt rendering.

artifacts = f"{{output_folder}}/{IMPLEMENTATION_ARTIFACTS}"
if not artifacts:
return None
artifacts = artifacts.replace("{output_folder}", output_folder)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only expands {output_folder}, but current BMAD configs commonly use {project-root} in both implementation_artifacts and output_folder. Simple repro: write _bmad/bmm/config.yaml with implementation_artifacts: "{project-root}/_bmad-output/implementation-artifacts", create _bmad-output/implementation-artifacts/1-2-real.md, then call implementation_artifacts_dir(root) or story-file-status 1.2. The resolver returns <repo>/{project-root}/_bmad-output/implementation-artifacts, normalize_story_key falls back to 1-2, and story-file-status reports story file not found.

return configured
legacy = root / DEFAULT_OUTPUT_FOLDER / IMPLEMENTATION_ARTIFACTS
docs_bmad = root / DOCS_BMAD_ARTIFACTS
if not legacy.exists() and not (root / DEFAULT_OUTPUT_FOLDER / "sprint-status.yaml").is_file():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directory existence alone blocks the docs fallback. Simple repro: create an empty _bmad-output/implementation-artifacts/ directory, then create docs/bmad/implementation-artifacts/1-2-docs.md and docs/bmad/implementation-artifacts/sprint-status.yaml. implementation_artifacts_dir(root) still returns _bmad-output/implementation-artifacts, so story lookup and success verification miss the active docs artifacts.

print(count_files(story_id, artifacts_dir))
return 0
try:
artifacts_dir = resolve_default_artifacts_dir()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count --artifacts-dir still resolves the default config before reading the override. Simple repro: put an invalid config like implementation_artifacts: ../outside/implementation-artifacts, create a valid custom folder with 1-2-custom.md, then run validate-story-creation count 1.2 --artifacts-dir <custom>. Expected count is 1, but the command exits 1 with BMAD config implementation_artifacts must stay within project root. Parse the override before calling resolve_default_artifacts_dir().

relative = resolved.relative_to(allowed_root)
except ValueError:
continue
return artifacts_root, str(relative)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validates against either the configured artifacts root or the legacy root, but always returns artifacts_root. Simple repro: configure implementation_artifacts: docs/bmad/implementation-artifacts, create _bmad-output/implementation-artifacts/1-2-legacy.md, then call create_story_artifact with glob: _bmad-output/implementation-artifacts/{story_prefix}-*.md. _resolve_artifact_glob accepts the legacy pattern but returns the docs root with 1-2-*.md, so it reports actualMatches: 0 even though the legacy file exists. Return the matched allowed_root or stop accepting legacy globs under a configured docs root.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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
`@skills/bmad-story-automator/src/story_automator/commands/validate_story_creation.py`:
- Around line 123-130: When parsing CLI in validate_story_creation.py for
"count" mode, the loop that sets artifacts_dir from rest is allowing
malformed/missing values and falling back silently; update the parsing so that
when "--artifacts-dir" is present you must (1) verify there is a following token
in rest, (2) ensure that token is not another flag (doesn't start with "-"), and
(3) optionally validate that Path(token) exists/is a directory before assigning
artifacts_dir; if any check fails, print a clear CLI error/usage message and
exit with a non-zero code instead of calling resolve_default_artifacts_dir();
keep references to rest, artifacts_dir, resolve_default_artifacts_dir(), and
count_files() so you modify the same block.
🪄 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

Run ID: 04932007-778e-42df-8cec-ab7cffdb7eef

📥 Commits

Reviewing files that changed from the base of the PR and between c025238 and 0c0c385.

📒 Files selected for processing (6)
  • skills/bmad-story-automator/src/story_automator/commands/orchestrator.py
  • skills/bmad-story-automator/src/story_automator/commands/tmux.py
  • skills/bmad-story-automator/src/story_automator/commands/validate_story_creation.py
  • skills/bmad-story-automator/src/story_automator/core/artifact_paths.py
  • skills/bmad-story-automator/src/story_automator/core/success_verifiers.py
  • tests/test_success_verifiers.py

@seven-steven
Copy link
Copy Markdown
Author

Thanks for the concrete repros. I pushed 0c0c385 to address the four path-resolution regressions:

  1. {project-root} placeholders are now expanded before resolving implementation_artifacts / output_folder, while still validating that the resolved path stays inside the project root.
  2. An empty legacy _bmad-output/implementation-artifacts/ directory no longer blocks the docs/bmad/implementation-artifacts fallback; legacy only wins when it contains actual artifacts or sprint status.
  3. validate-story-creation count --artifacts-dir ... now parses and uses the explicit override before resolving the default BMAD config, so a bad default config does not block explicit custom counts.
  4. _resolve_artifact_glob() now returns the root that actually matched the glob, so legacy globs continue to match legacy files even when the configured artifacts root points elsewhere.

I added regression coverage for each repro in tests/test_success_verifiers.py.

Validation:

  • env -u AI_AGENT PYTHONPATH="/home/seven/data/coding/projects/others/bmad-automator/skills/bmad-story-automator/src" python -m pytest "/home/seven/data/coding/projects/others/bmad-automator/tests/test_success_verifiers.py" -q → 77 passed
  • env -u AI_AGENT PYTHONPATH="/home/seven/data/coding/projects/others/bmad-automator/skills/bmad-story-automator/src" python -m pytest "/home/seven/data/coding/projects/others/bmad-automator/tests" -q → 227 passed, 14 subtests passed

Copy link
Copy Markdown
Collaborator

@bma-d bma-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: configured BMAD artifacts paths still break several existing paths.

Simple repro from latest head 0c0c3856:

# Project config
_bmad/bmm/config.yaml: implementation_artifacts: docs/bmad/implementation-artifacts
# Existing docs-layout files
docs/bmad/implementation-artifacts/1-2-docs.md
docs/bmad/implementation-artifacts/sprint-status.yaml

Results:

control_direct_config_aware_create_story_artifact -> verified=true
validate-story-creation check 1.2 -> valid=false, created_count=0
orchestrator-helper verify-step create 1.2 -> verified=false, actualMatches=0
sprint-compare --sprint _bmad-output/implementation-artifacts/sprint-status.yaml -> {"ok":false,"error":"sprint_not_found"}
sprint-compare --sprint docs/bmad/implementation-artifacts/sprint-status.yaml -> {"ok":true,"incomplete":[],"checked":["1.1"]}
monitoring fallback legacy glob -> empty; docs glob finds docs/bmad/implementation-artifacts/1-2-docs.md
check-blocking 1.1 with epic file only in configured artifacts dir -> {"blocking":true,"reason":"epic_file_not_found"}

Specific remaining issues:

  • data/orchestration-policy.json:53 still hardcodes _bmad-output/implementation-artifacts/{story_prefix}-*.md, so policy-backed create verification ignores the configured docs path even though the direct config-aware verifier succeeds. This is a P1 because a configured docs-layout create run escalates as failed after successfully creating the story.
  • steps-c/step-01b-continue.md:79 still passes _bmad-output/implementation-artifacts/sprint-status.yaml to sprint-compare, so resume mode fails with sprint_not_found when sprint status lives in the configured docs path.
  • data/monitoring-fallback.md:38 still checks story files only under _bmad-output/implementation-artifacts, so fallback recovery misses successfully created docs-layout stories.
  • orchestrator_epic_agents.py:196 only searches _bmad-output/implementation-artifacts/epic-*.md and docs/epics/epic-*.md; configured-artifacts-only epic files are reported as epic_file_not_found.

Targeted tests still pass (77 passed), but they do not cover these bundled policy/instruction fallback paths.

return {"verified": False, "reason": "could_not_normalize_key", "input": story_key}
config = _success_config(contract)
raw_glob = str(config.get("glob") or "_bmad-output/implementation-artifacts/{story_prefix}-*.md")
raw_glob = str(config.get("glob") or implementation_artifacts_glob(project_root, "{story_prefix}-*.md"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback is config-aware, but it never runs for the bundled create contract because data/orchestration-policy.json still provides success.config.glob: _bmad-output/implementation-artifacts/{story_prefix}-*.md. In a project with implementation_artifacts: docs/bmad/implementation-artifacts, a direct create_story_artifact(project_root, "1.2") finds docs/bmad/implementation-artifacts/1-2-docs.md, while validate-story-creation check 1.2 and orchestrator-helper verify-step create 1.2 both return zero matches because the policy glob overrides this default.

@seven-steven
Copy link
Copy Markdown
Author

Thanks for the latest review. I pushed 455e389 to address the two remaining follow-ups:

  1. Removed the bundled create verifier's legacy success.config.glob override from orchestration-policy.json, so policy-driven create verification now uses the config-aware default artifacts path. This covers both validate-story-creation check 1.2 and orchestrator-helper verify-step create 1.2 when implementation_artifacts points to docs/bmad/implementation-artifacts, while keeping explicit custom glob behavior in the verifier.
  2. Tightened validate-story-creation count --artifacts-dir parsing so missing, empty, flag-like, or unknown arguments return clear CLI errors instead of silently falling back to default artifacts resolution.

Added regression coverage for both paths. Local verification:

env -u AI_AGENT PYTHONPATH=".../skills/bmad-story-automator/src" python -m pytest tests/test_success_verifiers.py -q
# 83 passed

env -u AI_AGENT PYTHONPATH=".../skills/bmad-story-automator/src" python -m pytest tests -q
# 233 passed, 14 subtests passed

Copy link
Copy Markdown
Collaborator

@bma-d bma-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes again. The previous P1 create-verification issue is fixed: data/orchestration-policy.json no longer pins success.config.glob, and the repro now passes for both validate-story-creation check 1.2 and orchestrator-helper verify-step create 1.2 with implementation_artifacts: docs/bmad/implementation-artifacts.

Remaining verified issues are path-consistency gaps in existing flows:

# fixture
_bmad/bmm/config.yaml: implementation_artifacts: docs/bmad/implementation-artifacts
docs/bmad/implementation-artifacts/1-1-docs.md
docs/bmad/implementation-artifacts/1-2-docs.md
docs/bmad/implementation-artifacts/sprint-status.yaml
docs/bmad/implementation-artifacts/epic-1-docs.md

resume_step_hardcoded_sprint_path -> code=1 {"ok":false,"error":"sprint_not_found"}
control_configured_sprint_path -> code=0 {"ok":true,"incomplete":[],"checked":["1.1"]}

monitoring fallback legacy glob -> empty
configured glob -> docs/bmad/implementation-artifacts/1-2-docs.md

check_blocking_configured_epic_only -> {"blocking":true,"reason":"epic_file_not_found"}
control_check_blocking_same_epic_in_legacy_dir -> {"blocking":false,"reason":"no_dependents_found"}

Targeted verification from my last pass: 233 passed, 14 subtests passed. No P0/P1 remains, but these P2s are still real user-visible regressions for configured artifact layouts.

return legacy


def sprint_status_path(project_root: str | Path) -> Path:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper resolves the configured sprint-status.yaml, but the resume workflow still bypasses it. steps-c/step-01b-continue.md:79 invokes sprint-compare --sprint "_bmad-output/implementation-artifacts/sprint-status.yaml", so a project configured with implementation_artifacts: docs/bmad/implementation-artifacts fails resume with {"ok":false,"error":"sprint_not_found"} even though the same command succeeds when pointed at docs/bmad/implementation-artifacts/sprint-status.yaml.

return artifacts.relative_to(root).as_posix()


def implementation_artifacts_glob(project_root: str | Path, pattern: str) -> str:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configured artifact glob helper is now available, but the monitoring fallback path still hardcodes the legacy directory. data/monitoring-fallback.md:38 runs ls _bmad-output/implementation-artifacts/{story_prefix}-*.md; in the same docs-layout fixture this returns empty while docs/bmad/implementation-artifacts/1-2-docs.md exists, so fallback recovery can miss a successfully created story.

from story_automator.core.sprint import sprint_status_epic
from story_automator.core.story_keys import normalize_story_key
from story_automator.core.utils import file_exists, get_project_root, iso_now, print_json, read_text, trim_lines, unquote_scalar
from story_automator.core.utils import file_exists, get_project_root, iso_now, print_json, read_text, strip_inline_yaml_comment, trim_lines, unquote_scalar
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module still needs the configured artifact resolver for epic-file lookup. find_epic_file() below only searches _bmad-output/implementation-artifacts/epic-{epic}-*.md and docs/epics/epic-{epic}-*.md; with epic-1-docs.md only under the configured docs/bmad/implementation-artifacts dir, check-blocking 1.1 returns epic_file_not_found and treats the story as blocking. Copying the same file to the legacy artifact dir flips the result to non-blocking.

@seven-steven
Copy link
Copy Markdown
Author

Thanks — I pushed 517e15d to address the three remaining configured-path consistency gaps from the latest review:

  1. Resume step sprint path

    • steps-c/step-01b-continue.md now uses defaultSprintStatusFile: "{output_folder}/implementation-artifacts/sprint-status.yaml" and passes that value into sprint-compare, instead of hardcoding _bmad-output/implementation-artifacts/sprint-status.yaml.
  2. Monitoring fallback story-file path

    • data/monitoring-fallback.md now checks {{implementation_artifacts}}/{story_prefix}-*.md instead of the legacy _bmad-output/implementation-artifacts/... glob.
  3. Configured epic-file lookup

    • find_epic_file() in orchestrator_epic_agents.py now checks implementation_artifacts_dir(get_project_root()) first, then preserves the existing docs/epics fallback.

I also added regression coverage for:

  • configured sprint-status path used by the resume flow
  • monitoring fallback using the implementation-artifacts placeholder
  • check-blocking with epic files only in the configured artifacts dir
  • get-epic-stories with epic files only in the configured artifacts dir

Verification I ran locally:

env -u AI_AGENT PYTHONPATH=".../skills/bmad-story-automator/src" python -m pytest tests/test_success_verifiers.py -q
# 87 passed

env -u AI_AGENT PYTHONPATH=".../skills/bmad-story-automator/src" python -m pytest tests -q
# 237 passed, 14 subtests passed

env -u AI_AGENT npm run verify
# pass

One note from verification: npm run verify still fails in my local shell if ambient AI_AGENT is set, due to the pre-existing unrelated test_build_cmd_uses_legacy_ai_command_consistently_for_claude environment-sensitive assertion. The same verify run passes with AI_AGENT unset, and this PR does not touch that behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants