Fix SOURCE node resolution for user inputs in execute_recipe

- SOURCE nodes with :input true now resolve CID from input_hashes
- Tries multiple name formats: exact, lowercase-dashes, lowercase-underscores
- Only return "completed" status for runs with actual output
- Add integration tests for SOURCE CID resolution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-13 01:36:48 +00:00
parent bf188f4671
commit d08fbfc0bd
3 changed files with 286 additions and 14 deletions

View File

@@ -124,19 +124,23 @@ class RunService:
# Check database for completed run
cached = await self.db.get_run_cache(run_id)
if cached:
return {
"run_id": run_id,
"status": "completed",
"recipe": cached.get("recipe"),
"inputs": self._ensure_inputs_list(cached.get("inputs")),
"output_cid": cached.get("output_cid"),
"ipfs_cid": cached.get("ipfs_cid"),
"provenance_cid": cached.get("provenance_cid"),
"plan_cid": cached.get("plan_cid"),
"actor_id": cached.get("actor_id"),
"created_at": cached.get("created_at"),
"completed_at": cached.get("created_at"),
}
output_cid = cached.get("output_cid")
# Only return as completed if we have an output
# (runs with no output should be re-executed)
if output_cid:
return {
"run_id": run_id,
"status": "completed",
"recipe": cached.get("recipe"),
"inputs": self._ensure_inputs_list(cached.get("inputs")),
"output_cid": output_cid,
"ipfs_cid": cached.get("ipfs_cid"),
"provenance_cid": cached.get("provenance_cid"),
"plan_cid": cached.get("plan_cid"),
"actor_id": cached.get("actor_id"),
"created_at": cached.get("created_at"),
"completed_at": cached.get("created_at"),
}
# Check database for pending run
pending = await self.db.get_pending_run(run_id)