Skip to content

fix(setup): allow repeated Windows setup - #2909

Open
lorenzozanee wants to merge 1 commit into
bmad-code-org:devfrom
lorenzozanee:fix/repeated-windows-setup
Open

lorenzozanee wants to merge 1 commit into
bmad-code-org:devfrom
lorenzozanee:fix/repeated-windows-setup

Conversation

@lorenzozanee

@lorenzozanee lorenzozanee commented Sep 18, 2026

Copy link
Copy Markdown

What

Allow bmad setup to replace an existing _bmad directory on Windows.

Why

Windows rejects the replacement when the temporary backup directory already exists, causing repeated setup to fail with WinError 183.

Fixes #2879

How

  • Remove the empty temporary backup directory before renaming the existing runtime.
  • Add regression coverage for the Windows directory-rename behavior.

Testing

The focused regression, setup test suite, repository quality checks, and git diff --check pass. Native Windows execution was not available locally.

@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the Windows replacement behavior directly covered by a focused regression test.

Summary

The PR fixes repeated Windows setup by removing the empty temporary backup directory before renaming the existing _bmad runtime into its place.

  • Preserves the existing replacement and rollback flow.
  • Adds focused regression coverage that emulates Windows refusing to rename onto an existing directory.

Reviews (1) · Last reviewed commit: "fix: allow repeated setup on Windows"

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9c683efd-7a96-45fa-aeac-8c9b8e863323

📥 Commits

Reviewing files that changed from the base of the PR and between f033e70 and d9a555f.

📒 Files selected for processing (2)
  • skills/bmad/scripts/setup.py
  • tools/tests/test_bmad_setup.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

replace_dir removes the empty temporary backup directory before renaming an existing destination. A regression test simulates Windows OSError(183) behavior and verifies that the new directory replaces the old one without leftover backups.

Changes

Windows directory replacement

Layer / File(s) Summary
Backup directory replacement and regression coverage
skills/bmad/scripts/setup.py, tools/tests/test_bmad_setup.py
replace_dir removes the empty mkdtemp directory before renaming the existing destination. The test simulates Windows rename behavior and verifies the new file, removal of the old file, and cleanup of _bmad.old-* directories.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: alexeyv

Merge Risk: ⚪ Minimal · up to d9a55

The Windows replacement fix preserves setup and doctor behavior with no unresolved merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change addresses #2879 in skills/bmad/scripts/setup.py. It removes the empty tempfile.mkdtemp() directory before dest.rename(backup), which removes the Windows WinError 183 target-exists f…
Out of Scope Changes check ✅ Passed The changes are limited to the replace_dir fix and its regression test. Both changes directly support #2879. No unrelated behavior or files are identified.
Title check ✅ Passed The title clearly and concisely describes the Windows setup fix.
Description check ✅ Passed The description directly explains the Windows replacement failure, the fix, regression coverage, and testing status.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

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.

1 participant