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 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 23:50:46 +00:00
parent 3e3df6ff2a
commit 1ad8fe9890

View File

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