Skip to content

Self-improving AI Employees for everyone

fix(cron): show only the panel fields that change the schedule

trohitg15dc464226a7
diff --git a/docs-internal/node-logic-flows/workflow_triggers/cronScheduler.md b/docs-internal/node-logic-flows/workflow_triggers/cronScheduler.md
index b3ca7c5b..464dd9a1 100644
--- a/docs-internal/node-logic-flows/workflow_triggers/cronScheduler.md
+++ b/docs-internal/node-logic-flows/workflow_triggers/cronScheduler.md
@@ -36,9 +36,9 @@ call `event_waiter.register()`.
| `weekday` | options | `'1'` (Mon) | no | frequency == `weeks` | Display-only. |
| `weekly_time` | options | `09:00` | no | frequency == `weeks` | Display-only. |
| `month_day` | options | `'1'` | no | frequency == `months` | `1`..`28` or `L`. Display-only in this op. |
+| `monthly_time` | string | `09:00` | no | frequency == `months` | `HH:MM`, the time a monthly schedule runs. Free text, unlike the daily and weekly times. Display-only in this op. |
| `timezone` | options | `UTC` | no | - | Used in the description string only. |
-| `cron_expression` | string | `0 * * * *` | no | - | Vestigial; kept for backward compatibility, unused by the op. |
-| `monthly_time` | string | `09:00` | no | - | Vestigial; kept for backward compatibility, no displayOptions. |
+| `cron_expression` | string | `0 * * * *` | no | hidden | Never read, by this op or the deployed Schedule. Kept for older workflows and hidden from the panel. |
Note: for `days` / `weeks` / `months` the op hard-codes the wait to 24h
/ 7d / ~30d respectively; the `daily_time` / `weekday` / `weekly_time` /
@@ -147,6 +147,11 @@ flowchart TD
Checked against a real Temporal dev server on 2026-10-01 for every
frequency.
+- **The panel shows only fields that change the Schedule.** For each
+ frequency it shows exactly the fields `build_cron_expression` reads,
+ plus `frequency` and `timezone`; a new field or frequency has to keep
+ that true (`test_the_panel_shows_the_fields_the_schedule_reads` in
+ `server/tests/test_cron_canary.py`).
- **A deployed run's `schedule` output** comes from the deploy path's own
copy of the description, `DeploymentManager._get_schedule_description`
(services never import a plugin folder). `TestScheduleDescription` in
diff --git a/server/nodes/scheduler/cron_scheduler/__init__.py b/server/nodes/scheduler/cron_scheduler/__init__.py
index a53acb3b..ac55cb71 100644
--- a/server/nodes/scheduler/cron_scheduler/__init__.py
+++ b/server/nodes/scheduler/cron_scheduler/__init__.py
@@ -208,6 +208,11 @@ class CronSchedulerParams(BaseModel):
description="Day of month (1-28, or 'L' for last day)",
json_schema_extra={"displayOptions": {"show": {"frequency": ["months"]}}},
)
+ monthly_time: str = Field(
+ default="09:00",
+ description="Time of day (HH:MM) for monthly schedule",
+ json_schema_extra={"displayOptions": {"show": {"frequency": ["months"]}}},
+ )
timezone: Literal[
"UTC",
"America/New_York",
@@ -220,9 +225,9 @@ class CronSchedulerParams(BaseModel):
default="UTC",
description="IANA timezone identifier",
)
- # Vestigial fields kept for backward compatibility with older workflows.
- cron_expression: str = Field(default="0 * * * *")
- monthly_time: str = Field(default="09:00")
+ # Never read: the deployed Schedule is built from the fields above. Kept
+ # for older workflows, and hidden so nobody types a schedule into it.
+ cron_expression: str = Field(default="0 * * * *", json_schema_extra={"hidden": True})
model_config = ConfigDict(extra="allow")
diff --git a/server/tests/test_cron_canary.py b/server/tests/test_cron_canary.py
index be020855..548a3843 100644
--- a/server/tests/test_cron_canary.py
+++ b/server/tests/test_cron_canary.py
@@ -534,6 +534,37 @@ class TestCronExpression:
assert _as_temporal_reads(expression) == _fires(minute="*/5")
+ def test_the_panel_shows_the_fields_the_schedule_reads(self):
+ """For each frequency, the panel shows exactly the fields its Schedule
+ is built from. The timezone, shown for all of them, is read beside
+ the cron string rather than by the builder."""
+ from typing import get_args
+
+ from nodes.scheduler.cron_scheduler import CronSchedulerParams
+ from services.deployment.triggers import TriggerManager
+
+ class Recording(dict):
+ def __init__(self, **params):
+ super().__init__(**params)
+ self.read = set()
+
+ def get(self, key, default=None):
+ self.read.add(key)
+ return super().get(key, default)
+
+ fields = CronSchedulerParams.model_json_schema()["properties"]
+ for frequency in get_args(CronSchedulerParams.model_fields["frequency"].annotation):
+ params = Recording(frequency=frequency)
+ TriggerManager.build_cron_expression(params)
+ shown = {
+ name
+ for name, field in fields.items()
+ if not field.get("hidden")
+ and frequency in field.get("displayOptions", {}).get("show", {}).get("frequency", [frequency])
+ }
+
+ assert shown - {"frequency", "timezone"} == params.read - {"frequency"}, frequency
+
@pytest.mark.parametrize(
("trigger", "fires"),
[