|
63 | 63 |
|
64 | 64 | # Temporal suffixes a scheduled workflow id with the nominal fire time |
65 | 65 | # (e.g. ``...-run-2026-06-23T15:19:00Z``). Matching the trailing ISO-8601 lets |
66 | | -# the display label use the *scheduled* time, which is stable across activity |
67 | | -# retries, rather than wall-clock now() (which drifts on a delayed retry). |
| 66 | +# product/UI code read the occurrence time without parsing Temporal ids directly. |
68 | 67 | _NOMINAL_FIRE_TIME_RE = re.compile( |
69 | 68 | r"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)$" |
70 | 69 | ) |
71 | 70 |
|
72 | 71 |
|
73 | | -def _format_fire_time(fire_id: str) -> str: |
74 | | - """Format the schedule's nominal fire time for the task display name. |
75 | | -
|
76 | | - Falls back to the current time when ``fire_id`` carries no recognizable |
77 | | - timestamp suffix (e.g. a manually triggered fire). |
78 | | - """ |
79 | | - fire_time = _extract_fire_time(fire_id) |
80 | | - if fire_time is not None: |
81 | | - parsed = datetime.fromisoformat(fire_time.replace("Z", "+00:00")) |
82 | | - return parsed.strftime("%Y-%m-%d %H:%M UTC") |
83 | | - return datetime.now(UTC).strftime("%Y-%m-%d %H:%M UTC") |
84 | | - |
85 | | - |
86 | 72 | def _extract_fire_time(fire_id: str) -> str | None: |
87 | 73 | """Extract the occurrence time encoded in a schedule/manual fire id.""" |
88 | 74 | match = _NOMINAL_FIRE_TIME_RE.search(fire_id) |
@@ -245,11 +231,10 @@ async def launch_scheduled_agent_run( |
245 | 231 | task_name = f"scheduled-run:{schedule_id}:{fire_id}" |
246 | 232 | # Human-friendly label the UI renders for the task (it reads |
247 | 233 | # task_metadata.display_name, never the deterministic `name` above). |
248 | | - # Templated per fire so runs are distinguishable; placed first so a |
249 | | - # caller-supplied display_name in schedule.task_metadata overrides it. |
250 | | - display_fire_time = _format_fire_time(fire_id) |
| 234 | + # Keep it stable and compact; exact occurrence time is stored separately |
| 235 | + # in fire_time for views that need it. |
251 | 236 | task_metadata = { |
252 | | - "display_name": f"{schedule.name} · {display_fire_time}", |
| 237 | + "display_name": schedule.name, |
253 | 238 | **(schedule.task_metadata or {}), |
254 | 239 | "schedule_id": schedule_id, |
255 | 240 | "scheduled_fire_id": fire_id, |
|
0 commit comments