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 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 23:09:33 +00:00
parent e59a50c000
commit f7dbb952ab
4 changed files with 10 additions and 4 deletions

View File

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

View File

@@ -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,

View File

@@ -26,7 +26,7 @@
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4 text-sm">
<span class="text-gray-400">
Recipe: <span class="text-white">{{ run.recipe or 'Unknown' }}</span>
Recipe: <span class="text-white">{{ run.recipe_name or (run.recipe[:12] ~ '...' if run.recipe and run.recipe|length > 12 else run.recipe) or 'Unknown' }}</span>
</span>
{% if run.total_steps %}
<span class="text-gray-400">

View File

@@ -37,7 +37,7 @@
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Recipe</div>
<div class="text-white font-medium">{{ run.recipe or 'Unknown' }}</div>
<div class="text-white font-medium">{{ run.recipe_name or run.recipe[:16] ~ '...' if run.recipe and run.recipe|length > 16 else run.recipe or 'Unknown' }}</div>
</div>
<div class="bg-gray-800 rounded-lg p-4">
<div class="text-gray-500 text-sm">Steps</div>