Skip to content

The agent that grows with you

fix(cron): accept bare duration units like 'hour' in schedule parsing

salch-cred1d13fe70b95b
diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]
new file mode 100644
index 00000000000..c6c66711a06
--- /dev/null
+++ b/contributors/emails/[email protected]
@@ -0,0 +1 @@
+salch-cred
diff --git a/cron/jobs.py b/cron/jobs.py
index eb7a3a42e4e..9c012001b96 100644
--- a/cron/jobs.py
+++ b/cron/jobs.py
@@ -782,13 +782,14 @@ def parse_duration(s: str) -> int:
"30m" → 30
"2h" → 120
"1d" → 1440
+ "hour" → 60 (bare unit, no leading number)
"""
s = s.strip().lower()
- match = re.match(r'^(\d+)\s*(m|min|mins|minute|minutes|h|hr|hrs|hour|hours|d|day|days)$', s)
+ match = re.match(r'^(\d*)\s*(m|min|mins|minute|minutes|h|hr|hrs|hour|hours|d|day|days)$', s)
if not match:
raise ValueError(f"Invalid duration: '{s}'. Use format like '30m', '2h', or '1d'")
- value = int(match.group(1))
+ value = int(match.group(1)) if match.group(1) else 1
unit = match.group(2)[0] # First char: m, h, or d
multipliers = {'m': 1, 'h': 60, 'd': 1440}