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}")