Skip to content

Commit 3a7f7fc

Browse files
committed
fix: correct run_dir path in rollback endpoints (3→4 parents)
Path(__file__).parent.parent.parent resolved to scripts/ instead of plugin root. Fixed 3 occurrences in _rollback_to_review_node, api_rollback_image_gen_to_director, and api_rollback_node. Verified: rollback now correctly deletes artifact files.
1 parent 60d824b commit 3a7f7fc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/web/routes/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ def _rollback_to_review_node(raw: dict, run_id: str, node_id: str) -> tuple[dict
808808

809809
prev_node = interactive_nodes[idx - 1]
810810

811-
run_dir = Path(__file__).parent.parent.parent / "output" / "runs" / run_id
811+
run_dir = Path(__file__).parent.parent.parent.parent / "output" / "runs" / run_id
812812
chat_file = run_dir / f"chat_{node_id}.json"
813813
if chat_file.exists():
814814
chat_file.unlink()
@@ -890,7 +890,7 @@ async def api_rollback_image_gen_to_director(run_id: str):
890890
if not raw:
891891
raise HTTPException(status_code=404, detail="Run not found")
892892

893-
run_dir = Path(__file__).parent.parent.parent / "output" / "runs" / run_id
893+
run_dir = Path(__file__).parent.parent.parent.parent / "output" / "runs" / run_id
894894
raw["current_stage"] = "director"
895895
raw["status"] = "review"
896896
raw["_node_done"] = True
@@ -983,7 +983,7 @@ async def api_rollback_node(request: Request, run_id: str):
983983

984984
# 清理从 target+1 到 current 的所有节点
985985
nodes_to_clear = interactive_nodes[tgt_idx + 1: cur_idx + 1]
986-
run_dir = Path(__file__).parent.parent.parent / "output" / "runs" / run_id
986+
run_dir = Path(__file__).parent.parent.parent.parent / "output" / "runs" / run_id
987987

988988
state_cleanup = {
989989
"scout": ["topic", "writer_brief", "handoff_to_researcher", "reference_articles",

0 commit comments

Comments
 (0)