Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

packaging: monitor rollback works on Windows (os.rename cannot replace the mkdtemp directory)

Niko1221515e045fafe0
diff --git a/packaging/monitor_bundle.py b/packaging/monitor_bundle.py
index ea67cddcc..0abadadd1 100644
--- a/packaging/monitor_bundle.py
+++ b/packaging/monitor_bundle.py
@@ -259,6 +259,10 @@ def rollback(target: Path, *, plan: bool = False,
if if_active_sha256 != active["sha256"] or if_rollback_sha256 != prior["sha256"]:
raise ValueError("monitor rollback digests changed or are missing; preview again")
swap = Path(tempfile.mkdtemp(prefix=".strata-monitor-swap-", dir=target.parent))
+ if os.name == "nt":
+ # os.rename onto an existing directory fails on Windows (POSIX replaces an empty one):
+ # keep only the unique name mkdtemp reserved.
+ swap.rmdir()
try:
os.rename(target, swap)
try:
@@ -279,7 +283,7 @@ def rollback(target: Path, *, plan: bool = False,
raise OSError(f"monitor rollback interrupted; inspect {target}, {previous} and {swap}") from exc
raise
finally:
- if swap.exists() and not any(swap.iterdir()):
+ if swap.is_dir() and not any(swap.iterdir()):
swap.rmdir()
return {**result, "rolled_back": True, "would_rollback": False}