diff --git a/app/routers/runs.py b/app/routers/runs.py index 078f0df..471ff9f 100644 --- a/app/routers/runs.py +++ b/app/routers/runs.py @@ -102,9 +102,48 @@ async def get_run( # Only render HTML if browser explicitly requests it if wants_html(request): + # Try to load the recipe to show the plan + plan = None + recipe_id = run.get("recipe") + if recipe_id and len(recipe_id) == 64: # Looks like a hash + try: + from ..services.recipe_service import RecipeService + recipe_service = RecipeService(get_redis_client(), get_cache_manager()) + recipe = await recipe_service.get_recipe(recipe_id) + if recipe: + # Build plan from recipe nodes + nodes = recipe.get("nodes", []) + if not nodes: + dag = recipe.get("dag", {}) + nodes = dag.get("nodes", []) + + steps = [] + if isinstance(nodes, list): + for node in nodes: + steps.append({ + "name": node.get("id", ""), + "type": node.get("type", "EFFECT"), + "status": "completed", # Run completed + "inputs": node.get("inputs", []), + }) + elif isinstance(nodes, dict): + for node_id, node in nodes.items(): + steps.append({ + "name": node_id, + "type": node.get("type", "EFFECT"), + "status": "completed", + "inputs": node.get("inputs", []), + }) + + if steps: + plan = {"steps": steps} + except Exception as e: + logger.warning(f"Failed to load recipe for plan: {e}") + templates = get_templates(request) return render(templates, "runs/detail.html", request, run=run, + plan=plan, active_tab="runs", )