From 1ad8fe989037374aee8bbbaa28bd0091e2c6ac19 Mon Sep 17 00:00:00 2001 From: gilesb Date: Mon, 12 Jan 2026 23:50:46 +0000 Subject: [PATCH] Fix plan storage path to match get_by_cid lookup Store plan directly in CACHE_DIR/{cid} instead of CACHE_DIR/legacy/{cid}, which matches what cache_manager.get_by_cid() checks at line 396-398. Co-Authored-By: Claude Opus 4.5 --- legacy_tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/legacy_tasks.py b/legacy_tasks.py index 0dbfa6c..15006e7 100644 --- a/legacy_tasks.py +++ b/legacy_tasks.py @@ -392,7 +392,7 @@ def execute_dag(self, dag_json: str, run_id: str = None) -> dict: import asyncio import database - # Store plan (DAG) to IPFS + # Store plan (DAG) to IPFS and local cache plan_cid = None try: import ipfs_client @@ -400,6 +400,12 @@ def execute_dag(self, dag_json: str, run_id: str = None) -> dict: plan_cid = ipfs_client.add_json(dag_dict) if plan_cid: logger.info(f"Stored plan to IPFS: {plan_cid}") + # Also store locally so it can be retrieved without IPFS + # Store directly in cache_dir (get_by_cid checks cache_dir/cid) + plan_path = CACHE_DIR / plan_cid + CACHE_DIR.mkdir(parents=True, exist_ok=True) + with open(plan_path, "w") as f: + json.dump(dag_dict, f, indent=2) except Exception as e: logger.warning(f"Failed to store plan to IPFS: {e}")