From f7dbb952ab4b0b5f65b597307db48476fdf6520b Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 23:09:33 +0000 Subject: [PATCH] Preserve recipe name in run service and templates - Pass recipe_name through create_run to display friendly names - Update templates to show name instead of hash - Fall back to truncated hash if no name available Co-Authored-By: Claude Opus 4.5 --- app/routers/runs.py | 4 ++-- app/services/run_service.py | 6 ++++++ app/templates/runs/_run_card.html | 2 +- app/templates/runs/detail.html | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/routers/runs.py b/app/routers/runs.py index 33c1b6a..8a4030d 100644 --- a/app/routers/runs.py +++ b/app/routers/runs.py @@ -146,8 +146,8 @@ async def get_run( run["total_steps"] = len(steps) run["executed"] = len(steps) if run.get("status") == "completed" else 0 - # Use recipe name instead of hash for display - if recipe.get("name"): + # Use recipe name instead of hash for display (if not already set) + if recipe.get("name") and not run.get("recipe_name"): run["recipe_name"] = recipe["name"] except Exception as e: logger.warning(f"Failed to load recipe for plan: {e}") diff --git a/app/services/run_service.py b/app/services/run_service.py index adf7854..749755f 100644 --- a/app/services/run_service.py +++ b/app/services/run_service.py @@ -189,6 +189,7 @@ class RunService: task_id = parsed.get("task_id") task_actor_id = parsed.get("actor_id") task_recipe = parsed.get("recipe") + task_recipe_name = parsed.get("recipe_name") task_inputs = parsed.get("inputs") # Ensure inputs is a list (might be JSON string) if isinstance(task_inputs, str): @@ -203,6 +204,7 @@ class RunService: task_id = task_data task_actor_id = None task_recipe = None + task_recipe_name = None task_inputs = None task_output_name = None task_created_at = None @@ -231,6 +233,7 @@ class RunService: "celery_task_id": task_id, "actor_id": task_actor_id, "recipe": task_recipe, + "recipe_name": task_recipe_name, "inputs": self._ensure_inputs_list(task_inputs), "output_name": task_output_name, "created_at": task_created_at, @@ -287,6 +290,7 @@ class RunService: dag_json: str = None, actor_id: str = None, l2_server: str = None, + recipe_name: str = None, ) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Create a new rendering run. Checks cache before executing. @@ -409,6 +413,7 @@ class RunService: "task_id": task.id, "actor_id": actor_id, "recipe": recipe, + "recipe_name": recipe_name, "inputs": input_list, "output_name": output_name, "created_at": datetime.now(timezone.utc).isoformat(), @@ -423,6 +428,7 @@ class RunService: "run_id": run_id, "status": "running", "recipe": recipe, + "recipe_name": recipe_name, "inputs": input_list, "output_name": output_name, "celery_task_id": task.id, diff --git a/app/templates/runs/_run_card.html b/app/templates/runs/_run_card.html index 58f8c06..a987fce 100644 --- a/app/templates/runs/_run_card.html +++ b/app/templates/runs/_run_card.html @@ -26,7 +26,7 @@
- Recipe: {{ run.recipe or 'Unknown' }} + Recipe: {{ run.recipe_name or (run.recipe[:12] ~ '...' if run.recipe and run.recipe|length > 12 else run.recipe) or 'Unknown' }} {% if run.total_steps %} diff --git a/app/templates/runs/detail.html b/app/templates/runs/detail.html index 99998e2..7cac740 100644 --- a/app/templates/runs/detail.html +++ b/app/templates/runs/detail.html @@ -37,7 +37,7 @@
Recipe
-
{{ run.recipe or 'Unknown' }}
+
{{ run.recipe_name or run.recipe[:16] ~ '...' if run.recipe and run.recipe|length > 16 else run.recipe or 'Unknown' }}
Steps