Skip to content

Commit 8445f04

Browse files
fix(schedules): simplify scheduled task titles
Use the schedule name as the task display label and keep occurrence timing in metadata for views that need it. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e1b7c89 commit 8445f04

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

agentex/src/temporal/activities/scheduled_agent_run_activities.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,12 @@
6363

6464
# Temporal suffixes a scheduled workflow id with the nominal fire time
6565
# (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.
6867
_NOMINAL_FIRE_TIME_RE = re.compile(
6968
r"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)$"
7069
)
7170

7271

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-
8672
def _extract_fire_time(fire_id: str) -> str | None:
8773
"""Extract the occurrence time encoded in a schedule/manual fire id."""
8874
match = _NOMINAL_FIRE_TIME_RE.search(fire_id)
@@ -245,11 +231,10 @@ async def launch_scheduled_agent_run(
245231
task_name = f"scheduled-run:{schedule_id}:{fire_id}"
246232
# Human-friendly label the UI renders for the task (it reads
247233
# 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.
251236
task_metadata = {
252-
"display_name": f"{schedule.name} · {display_fire_time}",
237+
"display_name": schedule.name,
253238
**(schedule.task_metadata or {}),
254239
"schedule_id": schedule_id,
255240
"scheduled_fire_id": fire_id,

0 commit comments

Comments
 (0)