diff --git a/apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts b/apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
index 295ce0aae0bd6..e1c7a245606eb 100644
--- a/apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
+++ b/apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
@@ -21,6 +21,7 @@ import {
scheduledTaskDefaultModel,
defaultScheduledTaskProjectId,
matchesScheduledTaskScope,
+ scheduleDraftErrors,
scheduleFromDraft,
scheduleLabel,
taskToDraft,
@@ -244,6 +245,33 @@ describe("one-time scheduled tasks", () => {
});
});
+describe("cron scheduled tasks", () => {
+ it("round-trips the expression and sends it trimmed", () => {
+ const draft = taskToDraft({
+ ...legacyTask,
+ schedule: { type: "cron", expression: "*/30 9-16 * * MON-FRI" },
+ });
+ expect(draft.scheduleMode).toBe("cron");
+ expect(scheduleFromDraft(draft)).toEqual({ type: "cron", expression: "*/30 9-16 * * MON-FRI" });
+ expect(scheduleFromDraft({ ...draft, cronExpression: " 0 9 * * 1 " })).toEqual({
+ type: "cron",
+ expression: "0 9 * * 1",
+ });
+ });
+
+ it("refuses to save an expression the server would reject, and says why", () => {
+ const draft = { ...taskToDraft(legacyTask), scheduleMode: "cron" as const };
+ for (const [cronExpression, reason] of [
+ ["* * * * * *", /five fields/],
+ ["0 25 * * *", /between 0 and 23/],
+ ["0 9 30 2 *", /never matches/],
+ ] as const) {
+ expect(scheduleFromDraft({ ...draft, cronExpression })).toBeNull();
+ expect(scheduleDraftErrors({ ...draft, cronExpression })[0]?.description).toMatch(reason);
+ }
+ });
+});
+
describe("webhook scheduled tasks", () => {
const signature = { header: "x-signature", encoding: "base64", prefix: "" } as const;
const webhookTask: ScheduledTask = {
@@ -419,10 +447,13 @@ it("rejects dedupe templates without a request placeholder", () => {
expect(scheduleFromDraft({ ...draft, coalesceKey: "{{body.bad" })).toBeNull();
});
-it("appends the server zone only to fixed-time schedule labels", () => {
+it("appends the server zone only to clock-time schedule labels", () => {
expect(scheduleLabel({ type: "fixed_time", timeOfDay: "16:31" }, "Etc/UTC")).toBe(
"Daily at 16:31 UTC",
);
+ expect(scheduleLabel({ type: "cron", expression: "0 9 * * 1-5" }, "Etc/UTC")).toBe(
+ "Cron 0 9 * * 1-5 UTC",
+ );
expect(scheduleLabel({ type: "fixed_time", timeOfDay: "09:00" })).toBe("Daily at 09:00");
expect(scheduleLabel({ type: "interval", everyMs: 60_000 }, "Etc/UTC")).toBe("Every 1 min");
expect(scheduleLabel({ type: "webhook", signature: null }, "Etc/UTC")).toBe("On webhook");
diff --git a/apps/web/src/components/settings/scheduledTasksSettings.logic.ts b/apps/web/src/components/settings/scheduledTasksSettings.logic.ts
index df227cfe32ea2..9094873e5db8e 100644
--- a/apps/web/src/components/settings/scheduledTasksSettings.logic.ts
+++ b/apps/web/src/components/settings/scheduledTasksSettings.logic.ts
@@ -1,4 +1,8 @@
-import { isListedThreadLineage, isWebhookDedupeTemplate } from "@t3tools/contracts";
+import {
+ isListedThreadLineage,
+ isWebhookDedupeTemplate,
+ scheduledTaskCronError,
+} from "@t3tools/contracts";
import {
EnvironmentId,
MAX_WEBHOOK_DELIVERY_AGE_MINUTES,
@@ -65,9 +69,15 @@ export function scheduleLabel(
? resolve(msg("Every {minutes} min", { minutes }))
: resolve(msg("Every {seconds} sec", { seconds: Math.round(schedule.everyMs / 1000) }));
}
+ const zone = scheduleTimeZoneLabel(timeZone, runAt);
+ if (schedule.type === "cron") {
+ const expression = schedule.expression;
+ return zone === undefined
+ ? resolve(msg("Cron {expression}", { expression }))
+ : resolve(msg("Cron {expression} {zone}", { expression, zone }));
+ }
const weekdays = schedule.weekdays ?? [];
const time = schedule.timeOfDay;
- const zone = scheduleTimeZoneLabel(timeZone, runAt);
if (weekdays.length === 0) {
return zone === undefined
? resolve(msg("Daily at {time}", { time }))
@@ -111,7 +121,7 @@ export function validateScheduledTasksSearch(raw: Record) {
};
}
-export type ScheduleMode = "fixed" | "once" | "interval" | "webhook";
+export type ScheduleMode = "fixed" | "once" | "interval" | "cron" | "webhook";
export type WorkspaceMode = "root" | "worktree" | "existing_worktree";
export interface DraftState {
@@ -126,6 +136,8 @@ export interface DraftState {
readonly runAt: string;
/** The stored ISO run time, sent back unchanged when the field was not edited. */
readonly savedRunAt: string;
+ /** Five-field cron, read in the environment's time zone. */
+ readonly cronExpression: string;
readonly weekdays: ReadonlySet;
readonly projectId: string;
readonly threadId: string;
@@ -166,10 +178,19 @@ export function toDateTimeLocalValue(date: Date): string {
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
}
+/** Weekdays every 30 minutes from 09:00 to 16:30, a starting point for the cron field. */
+export const DEFAULT_CRON_EXPRESSION = "*/30 9-16 * * 1-5";
+
export function scheduleDraftErrors(draft: DraftState, resolve: MessageResolver = m) {
const invalidRunTime = (description: string) => [
{ title: resolve(msg("Invalid run time")), description },
];
+ if (draft.scheduleMode === "cron") {
+ const error = scheduledTaskCronError(draft.cronExpression);
+ return error === null
+ ? []
+ : [{ title: resolve(msg("Invalid cron expression")), description: error }];
+ }
if (draft.scheduleMode === "once") {
const runAt = new Date(draft.runAt);
if (Number.isNaN(runAt.getTime())) return invalidRunTime(resolve(msg("Pick a date and time.")));
@@ -296,6 +317,8 @@ export function scheduleFromDraft(draft: DraftState): ScheduledTaskUpsertSchedul
: {}),
};
}
+ if (draft.scheduleMode === "cron")
+ return { type: "cron", expression: draft.cronExpression.trim() };
if (draft.scheduleMode === "interval") {
const everyMs = Math.round(Number(draft.intervalMinutes) * 60_000);
return { type: "interval", everyMs };
@@ -327,6 +350,7 @@ export function taskToDraft(task: ScheduledTask): DraftState {
timeOfDay: schedule.type === "fixed_time" ? schedule.timeOfDay.padStart(5, "0") : "09:00",
runAt: schedule.type === "once" ? toDateTimeLocalValue(new Date(schedule.runAt)) : "",
savedRunAt: schedule.type === "once" ? schedule.runAt : "",
+ cronExpression: schedule.type === "cron" ? schedule.expression : DEFAULT_CRON_EXPRESSION,
weekdays,
projectId: task.projectId,
threadId: task.threadId ?? "",
diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json
index 648fd58859dbe..2502fdb2ea123 100644
--- a/apps/web/src/i18n/translations/de.json
+++ b/apps/web/src/i18n/translations/de.json
@@ -9428,6 +9428,8 @@
"6e820a7742353257": "Gib ein Intervall von mindestens einer Minute ein.",
"9e596c405f5cea09": "„Einmal“ ist hier nicht verfügbar",
"e450f26e1af0a074": "Diese Umgebung verwendet eine ältere Version von T3 Code. Aktualisiere sie, um eine einmalige Aufgabe zu planen, oder wähle einen anderen Zeitplan.",
+ "14f522da60702611": "Cron ist hier nicht verfügbar",
+ "00ea5df0d5cc65e6": "In dieser Umgebung läuft eine ältere Version von T3 Code. Aktualisiere sie, um eine Cron-Aufgabe zu planen, oder wähle einen anderen Zeitplan.",
"71d8554090924454": "Checkout-Pfad ist erforderlich",
"a34b72de0ff1cbd0": "Gib den Pfad des Checkouts ein, in dem die Aufgabe laufen soll.",
"99a8c45121157edd": "Geplante Aufgabe konnte nicht gespeichert werden",
@@ -9462,6 +9464,16 @@
"196658ca8d7106b1": "Aufgabe erstellen",
"5baf27d764acc26d": "Nur ausführen, wenn alle Filter zutreffen. Andere Anfragen werden als gefiltert protokolliert. Trenne „ist eines von“-Werte mit Kommas; ein Wert darf kein Komma enthalten.",
"1abe7fdace9bed26": "Filter hinzufügen",
+ "316f12ddbabba34e": "Ausdruck",
+ "8999d6b440d32f4d": "Minute, Stunde, Tag des Monats, Monat, Wochentag, in der Zeitzone der Umgebung.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " wird montags bis freitags von 9:00 bis 16:30 alle 30 Minuten ausgeführt."
+ ],
"ce5c81a41b72193a": "Neue Aufgabe",
"58d9625d53534eab": "Keine Umgebungen verfügbar",
"5a8eb023f363e0d8": "Verbinde eine Umgebung, um geplante Aufgaben zu verwalten.",
@@ -9501,6 +9513,7 @@
"ce1b005dfc83db03": "Zu einer Uhrzeit",
"dac46f3c9d007f8b": "Einmal",
"3a851981dc1fdfc4": "In einem Intervall",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Per Webhook",
"0d15db4c81851479": "Anfragen mit demselben Schlüssel werden innerhalb von 7 Tagen nur einmal ausgeführt.",
"a844a27ea5562bea": "Beim Zusammenfassen wird die neueste Payload einmal ausgeführt, wenn das Zeitfenster ab der ersten Zustellung endet. Leere Schlüssel werden normal ausgeführt.",
@@ -11302,6 +11315,8 @@
"ded467fac40e823e": "Einmal, {time}",
"32f36b059ed73dc0": "Alle {minutes} Min.",
"b1eb053919fcb482": "Alle {seconds} Sek.",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Täglich um {time}",
"29d245e6c8e8b5d7": "Täglich um {time} {zone}",
"5115c6bf9ed1decd": "Werktags um {time}",
@@ -11309,6 +11324,7 @@
"e1222cad4667e338": "{days} um {time}",
"74b25bf2e8d10313": "{days} um {time} {zone}",
"4ee38ebaddb9d978": "Ungültige Ausführungszeit",
+ "eda6a4ccc66dea8a": "Ungültiger Cron-Ausdruck",
"2b5678bf6b6792d4": "Wähle ein Datum und eine Uhrzeit.",
"f062630735a207ea": "Diese Uhrzeit existiert in deiner Zeitzone nicht.",
"75265b7ef76cfedd": "Wähle eine Uhrzeit.",
diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json
index 599944358b5bb..55d30fe711271 100644
--- a/apps/web/src/i18n/translations/en.json
+++ b/apps/web/src/i18n/translations/en.json
@@ -9436,6 +9436,8 @@
"6e820a7742353257": "Enter an interval of at least one minute.",
"9e596c405f5cea09": "Once is not available here",
"e450f26e1af0a074": "This environment runs an older T3 Code. Update it to schedule a one-time task, or pick another schedule.",
+ "14f522da60702611": "Cron is not available here",
+ "00ea5df0d5cc65e6": "This environment runs an older T3 Code. Update it to schedule a cron task, or pick another schedule.",
"71d8554090924454": "Checkout path is required",
"a34b72de0ff1cbd0": "Enter the path of the checkout to run in.",
"99a8c45121157edd": "Could not save scheduled task",
@@ -9470,6 +9472,17 @@
"196658ca8d7106b1": "Create task",
"5baf27d764acc26d": "Run only when every filter matches. Other requests are logged as filtered. Separate “is one of” values with commas; a value can't contain a comma.",
"1abe7fdace9bed26": "Add filter",
+ "316f12ddbabba34e": "Expression",
+ "8999d6b440d32f4d": "Minute, hour, day of month, month, weekday, in the environment's time zone.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " ",
+ "runs every 30 minutes from 9:00 to 16:30 on weekdays."
+ ],
"ce5c81a41b72193a": "New task",
"58d9625d53534eab": "No environments available",
"5a8eb023f363e0d8": "Connect an environment to manage scheduled tasks.",
@@ -9509,6 +9522,7 @@
"ce1b005dfc83db03": "At a time",
"dac46f3c9d007f8b": "Once",
"3a851981dc1fdfc4": "Every interval",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "On webhook",
"0d15db4c81851479": "Requests with the same key run only once within 7 days.",
"a844a27ea5562bea": "Coalescing runs the latest payload once when the window from the first delivery closes. Empty keys run normally.",
@@ -11310,6 +11324,8 @@
"ded467fac40e823e": "Once, {time}",
"32f36b059ed73dc0": "Every {minutes} min",
"b1eb053919fcb482": "Every {seconds} sec",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Daily at {time}",
"29d245e6c8e8b5d7": "Daily at {time} {zone}",
"5115c6bf9ed1decd": "Weekdays at {time}",
@@ -11317,6 +11333,7 @@
"e1222cad4667e338": "{days} at {time}",
"74b25bf2e8d10313": "{days} at {time} {zone}",
"4ee38ebaddb9d978": "Invalid run time",
+ "eda6a4ccc66dea8a": "Invalid cron expression",
"2b5678bf6b6792d4": "Pick a date and time.",
"f062630735a207ea": "That time does not exist in your time zone.",
"75265b7ef76cfedd": "Pick a time.",
diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json
index 956f4e17a9617..71ee62b068e25 100644
--- a/apps/web/src/i18n/translations/es.json
+++ b/apps/web/src/i18n/translations/es.json
@@ -9424,6 +9424,8 @@
"6e820a7742353257": "Introduce un intervalo de al menos un minuto.",
"9e596c405f5cea09": "Una vez no está disponible aquí",
"e450f26e1af0a074": "Este entorno ejecuta una versión antigua de T3 Code. Actualízalo para programar una tarea única o elige otra programación.",
+ "14f522da60702611": "Cron no está disponible aquí",
+ "00ea5df0d5cc65e6": "Este entorno ejecuta una versión anterior de T3 Code. Actualízala para programar una tarea cron o elige otra programación.",
"71d8554090924454": "Se requiere la ruta del checkout",
"a34b72de0ff1cbd0": "Introduce la ruta del checkout donde ejecutar.",
"99a8c45121157edd": "No se pudo guardar la tarea programada",
@@ -9458,6 +9460,16 @@
"196658ca8d7106b1": "Crear tarea",
"5baf27d764acc26d": "Se ejecuta solo cuando coinciden todos los filtros. Las demás solicitudes se registran como filtradas. Separa los valores de «es uno de» con comas; un valor no puede contener una coma.",
"1abe7fdace9bed26": "Añadir filtro",
+ "316f12ddbabba34e": "Expresión",
+ "8999d6b440d32f4d": "Minuto, hora, día del mes, mes y día de la semana, en la zona horaria del entorno.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " se ejecuta cada 30 minutos de 9:00 a 16:30, de lunes a viernes."
+ ],
"ce5c81a41b72193a": "Nueva tarea",
"58d9625d53534eab": "No hay entornos disponibles",
"5a8eb023f363e0d8": "Conecta un entorno para gestionar las tareas programadas.",
@@ -9497,6 +9509,7 @@
"ce1b005dfc83db03": "A una hora",
"dac46f3c9d007f8b": "Una vez",
"3a851981dc1fdfc4": "Cada intervalo",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Al recibir un webhook",
"0d15db4c81851479": "Las solicitudes con la misma clave solo se ejecutan una vez en 7 días.",
"a844a27ea5562bea": "La agrupación ejecuta una vez la carga más reciente cuando se cierra la ventana abierta por la primera entrega. Las claves vacías se ejecutan con normalidad.",
@@ -11295,6 +11308,8 @@
"ded467fac40e823e": "Una vez, {time}",
"32f36b059ed73dc0": "Cada {minutes} min",
"b1eb053919fcb482": "Cada {seconds} s",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Cada día a las {time}",
"29d245e6c8e8b5d7": "Cada día a las {time} {zone}",
"5115c6bf9ed1decd": "Entre semana a las {time}",
@@ -11302,6 +11317,7 @@
"e1222cad4667e338": "{days} a las {time}",
"74b25bf2e8d10313": "{days} a las {time} {zone}",
"4ee38ebaddb9d978": "Hora de ejecución no válida",
+ "eda6a4ccc66dea8a": "Expresión cron no válida",
"2b5678bf6b6792d4": "Elige una fecha y una hora.",
"f062630735a207ea": "Esa hora no existe en tu zona horaria.",
"75265b7ef76cfedd": "Elige una hora.",
diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json
index 1c982cc6d6f58..fbb9f4a19e55a 100644
--- a/apps/web/src/i18n/translations/fr.json
+++ b/apps/web/src/i18n/translations/fr.json
@@ -9426,6 +9426,8 @@
"6e820a7742353257": "Saisissez un intervalle d’au moins une minute.",
"9e596c405f5cea09": "Une fois n’est pas disponible ici",
"e450f26e1af0a074": "Cet environnement exécute une ancienne version de T3 Code. Mettez-le à jour pour planifier une tâche ponctuelle, ou choisissez une autre planification.",
+ "14f522da60702611": "Cron n'est pas disponible ici",
+ "00ea5df0d5cc65e6": "Cet environnement utilise une ancienne version de T3 Code. Mettez-la à jour pour planifier une tâche cron, ou choisissez une autre planification.",
"71d8554090924454": "Le chemin du checkout est requis",
"a34b72de0ff1cbd0": "Saisissez le chemin du checkout où exécuter la tâche.",
"99a8c45121157edd": "Impossible d’enregistrer la tâche planifiée",
@@ -9460,6 +9462,16 @@
"196658ca8d7106b1": "Créer la tâche",
"5baf27d764acc26d": "N’exécute que si tous les filtres correspondent. Les autres requêtes sont journalisées comme filtrées. Séparez les valeurs « fait partie de » par des virgules ; une valeur ne peut pas contenir de virgule.",
"1abe7fdace9bed26": "Ajouter un filtre",
+ "316f12ddbabba34e": "Expression",
+ "8999d6b440d32f4d": "Minute, heure, jour du mois, mois, jour de la semaine, dans le fuseau horaire de l'environnement.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " s'exécute toutes les 30 minutes de 9:00 à 16:30, du lundi au vendredi."
+ ],
"ce5c81a41b72193a": "Nouvelle tâche",
"58d9625d53534eab": "Aucun environnement disponible",
"5a8eb023f363e0d8": "Connectez un environnement pour gérer les tâches planifiées.",
@@ -9499,6 +9511,7 @@
"ce1b005dfc83db03": "À une heure",
"dac46f3c9d007f8b": "Une fois",
"3a851981dc1fdfc4": "À intervalle",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Sur webhook",
"0d15db4c81851479": "Les requêtes avec la même clé ne s’exécutent qu’une fois en 7 jours.",
"a844a27ea5562bea": "Le regroupement exécute une fois la dernière charge utile quand la fenêtre ouverte par la première livraison se ferme. Les clés vides s’exécutent normalement.",
@@ -11300,6 +11313,8 @@
"ded467fac40e823e": "Une fois, {time}",
"32f36b059ed73dc0": "Toutes les {minutes} min",
"b1eb053919fcb482": "Toutes les {seconds} s",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Tous les jours à {time}",
"29d245e6c8e8b5d7": "Tous les jours à {time} {zone}",
"5115c6bf9ed1decd": "En semaine à {time}",
@@ -11307,6 +11322,7 @@
"e1222cad4667e338": "{days} à {time}",
"74b25bf2e8d10313": "{days} à {time} {zone}",
"4ee38ebaddb9d978": "Heure d’exécution non valide",
+ "eda6a4ccc66dea8a": "Expression cron invalide",
"2b5678bf6b6792d4": "Choisissez une date et une heure.",
"f062630735a207ea": "Cette heure n’existe pas dans votre fuseau horaire.",
"75265b7ef76cfedd": "Choisissez une heure.",
diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json
index 879531a396d2a..1b10995e80462 100644
--- a/apps/web/src/i18n/translations/ja.json
+++ b/apps/web/src/i18n/translations/ja.json
@@ -9381,6 +9381,8 @@
"6e820a7742353257": "1 分以上の間隔を入力してください。",
"9e596c405f5cea09": "ここでは「1 回」を利用できません",
"e450f26e1af0a074": "この環境では古い T3 Code が動作しています。1 回限りのタスクをスケジュールするには更新するか、別のスケジュールを選んでください。",
+ "14f522da60702611": "この環境では Cron を利用できません",
+ "00ea5df0d5cc65e6": "この環境では古いバージョンの T3 Code が実行されています。cron タスクをスケジュールするには、T3 Code を更新するか、別のスケジュールを選択してください。",
"71d8554090924454": "チェックアウトのパスが必要です",
"a34b72de0ff1cbd0": "実行するチェックアウトのパスを入力してください。",
"99a8c45121157edd": "スケジュールタスクを保存できませんでした",
@@ -9415,6 +9417,16 @@
"196658ca8d7106b1": "タスクを作成",
"5baf27d764acc26d": "すべてのフィルターに一致した場合のみ実行します。それ以外のリクエストはフィルター済みとして記録されます。「いずれかに一致」の値はカンマで区切ってください。値にカンマを含めることはできません。",
"1abe7fdace9bed26": "フィルターを追加",
+ "316f12ddbabba34e": "式",
+ "8999d6b440d32f4d": "分、時、日、月、曜日。環境のタイムゾーンが使用されます。",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " は月曜日から金曜日の 9:00 から 16:30 まで、30 分ごとに実行されます。"
+ ],
"ce5c81a41b72193a": "新しいタスク",
"58d9625d53534eab": "利用できる環境はありません",
"5a8eb023f363e0d8": "スケジュールタスクを管理するには環境に接続してください。",
@@ -9454,6 +9466,7 @@
"ce1b005dfc83db03": "時刻を指定",
"dac46f3c9d007f8b": "1 回",
"3a851981dc1fdfc4": "一定の間隔",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Webhook 受信時",
"0d15db4c81851479": "同じキーのリクエストは 7 日以内に 1 回だけ実行されます。",
"a844a27ea5562bea": "集約すると、最初の配信からの期間が終了したときに最新のペイロードで 1 回だけ実行します。キーが空の場合は通常どおり実行します。",
@@ -11250,6 +11263,8 @@
"ded467fac40e823e": "1 回、{time}",
"32f36b059ed73dc0": "{minutes} 分ごと",
"b1eb053919fcb482": "{seconds} 秒ごと",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "毎日 {time}",
"29d245e6c8e8b5d7": "毎日 {time} {zone}",
"5115c6bf9ed1decd": "平日 {time}",
@@ -11257,6 +11272,7 @@
"e1222cad4667e338": "{days} の {time}",
"74b25bf2e8d10313": "{days} の {time} {zone}",
"4ee38ebaddb9d978": "無効な実行時刻",
+ "eda6a4ccc66dea8a": "無効な cron 式",
"2b5678bf6b6792d4": "日付と時刻を選択してください。",
"f062630735a207ea": "その時刻はお使いのタイムゾーンには存在しません。",
"75265b7ef76cfedd": "時刻を選択してください。",
diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json
index fae8ce2ec6fc4..37e00cddf3a82 100644
--- a/apps/web/src/i18n/translations/ko.json
+++ b/apps/web/src/i18n/translations/ko.json
@@ -9384,6 +9384,8 @@
"6e820a7742353257": "1분 이상의 간격을 입력하세요.",
"9e596c405f5cea09": "여기에서는 한 번 실행을 사용할 수 없습니다",
"e450f26e1af0a074": "이 환경은 이전 버전의 T3 Code를 실행합니다. 일회성 작업을 예약하려면 업데이트하거나 다른 일정을 선택하세요.",
+ "14f522da60702611": "이 환경에서는 Cron을 사용할 수 없습니다",
+ "00ea5df0d5cc65e6": "이 환경은 이전 버전의 T3 Code를 실행하고 있습니다. cron 작업을 예약하려면 T3 Code를 업데이트하거나 다른 일정을 선택하세요.",
"71d8554090924454": "체크아웃 경로가 필요합니다",
"a34b72de0ff1cbd0": "실행할 체크아웃 경로를 입력하세요.",
"99a8c45121157edd": "예약된 작업을 저장할 수 없습니다",
@@ -9418,6 +9420,16 @@
"196658ca8d7106b1": "작업 만들기",
"5baf27d764acc26d": "모든 필터가 일치할 때만 실행합니다. 다른 요청은 필터링됨으로 기록됩니다. “다음 중 하나” 값은 쉼표로 구분하며, 값에는 쉼표를 넣을 수 없습니다.",
"1abe7fdace9bed26": "필터 추가",
+ "316f12ddbabba34e": "표현식",
+ "8999d6b440d32f4d": "분, 시, 일, 월, 요일. 환경의 시간대를 기준으로 합니다.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ "은 월요일부터 금요일까지 9:00부터 16:30까지 30분마다 실행됩니다."
+ ],
"ce5c81a41b72193a": "새 작업",
"58d9625d53534eab": "사용 가능한 환경이 없습니다",
"5a8eb023f363e0d8": "예약된 작업을 관리하려면 환경을 연결하세요.",
@@ -9457,6 +9469,7 @@
"ce1b005dfc83db03": "지정 시간",
"dac46f3c9d007f8b": "한 번",
"3a851981dc1fdfc4": "일정 간격",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "웹후크 수신 시",
"0d15db4c81851479": "키가 같은 요청은 7일 이내에 한 번만 실행됩니다.",
"a844a27ea5562bea": "병합하면 첫 전송부터 시작된 기간이 끝날 때 최신 페이로드로 한 번 실행합니다. 키가 비어 있으면 정상적으로 실행됩니다.",
@@ -11247,6 +11260,8 @@
"ded467fac40e823e": "한 번, {time}",
"32f36b059ed73dc0": "{minutes}분마다",
"b1eb053919fcb482": "{seconds}초마다",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "매일 {time}",
"29d245e6c8e8b5d7": "매일 {time} {zone}",
"5115c6bf9ed1decd": "평일 {time}",
@@ -11254,6 +11269,7 @@
"e1222cad4667e338": "{days} {time}",
"74b25bf2e8d10313": "{days} {time} {zone}",
"4ee38ebaddb9d978": "잘못된 실행 시간",
+ "eda6a4ccc66dea8a": "잘못된 cron 표현식",
"2b5678bf6b6792d4": "날짜와 시간을 선택하세요.",
"f062630735a207ea": "해당 시간은 현재 시간대에 존재하지 않습니다.",
"75265b7ef76cfedd": "시간을 선택하세요.",
diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json
index 7010bef288b16..c44c5287cb0cc 100644
--- a/apps/web/src/i18n/translations/pt-BR.json
+++ b/apps/web/src/i18n/translations/pt-BR.json
@@ -9425,6 +9425,8 @@
"6e820a7742353257": "Informe um intervalo de pelo menos um minuto.",
"9e596c405f5cea09": "\"Uma vez\" não está disponível aqui",
"e450f26e1af0a074": "Este ambiente roda uma versão antiga do T3 Code. Atualize-o para agendar uma tarefa única ou escolha outro agendamento.",
+ "14f522da60702611": "Cron não está disponível aqui",
+ "00ea5df0d5cc65e6": "Este ambiente executa uma versão mais antiga do T3 Code. Atualize-a para agendar uma tarefa cron ou escolha outro agendamento.",
"71d8554090924454": "O caminho do checkout é obrigatório",
"a34b72de0ff1cbd0": "Informe o caminho do checkout em que executar.",
"99a8c45121157edd": "Não foi possível salvar a tarefa agendada",
@@ -9459,6 +9461,16 @@
"196658ca8d7106b1": "Criar tarefa",
"5baf27d764acc26d": "Executa só quando todos os filtros correspondem. As outras requisições são registradas como filtradas. Separe os valores de “é um de” com vírgulas; um valor não pode conter vírgula.",
"1abe7fdace9bed26": "Adicionar filtro",
+ "316f12ddbabba34e": "Expressão",
+ "8999d6b440d32f4d": "Minuto, hora, dia do mês, mês e dia da semana, no fuso horário do ambiente.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " é executado a cada 30 minutos, das 9:00 às 16:30, de segunda a sexta-feira."
+ ],
"ce5c81a41b72193a": "Nova tarefa",
"58d9625d53534eab": "Nenhum ambiente disponível",
"5a8eb023f363e0d8": "Conecte um ambiente para gerenciar tarefas agendadas.",
@@ -9498,6 +9510,7 @@
"ce1b005dfc83db03": "Em um horário",
"dac46f3c9d007f8b": "Uma vez",
"3a851981dc1fdfc4": "A cada intervalo",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Por webhook",
"0d15db4c81851479": "Requisições com a mesma chave executam só uma vez em 7 dias.",
"a844a27ea5562bea": "O agrupamento executa o payload mais recente uma vez quando a janela iniciada pela primeira entrega fecha. Chaves vazias executam normalmente.",
@@ -11299,6 +11312,8 @@
"ded467fac40e823e": "Uma vez, {time}",
"32f36b059ed73dc0": "A cada {minutes} min",
"b1eb053919fcb482": "A cada {seconds} s",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Diariamente às {time}",
"29d245e6c8e8b5d7": "Diariamente às {time} {zone}",
"5115c6bf9ed1decd": "Dias úteis às {time}",
@@ -11306,6 +11321,7 @@
"e1222cad4667e338": "{days} às {time}",
"74b25bf2e8d10313": "{days} às {time} {zone}",
"4ee38ebaddb9d978": "Horário de execução inválido",
+ "eda6a4ccc66dea8a": "Expressão cron inválida",
"2b5678bf6b6792d4": "Escolha uma data e um horário.",
"f062630735a207ea": "Esse horário não existe no seu fuso horário.",
"75265b7ef76cfedd": "Escolha um horário.",
diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json
index 0766d953dd02d..c83218ccd5b74 100644
--- a/apps/web/src/i18n/translations/ru.json
+++ b/apps/web/src/i18n/translations/ru.json
@@ -9428,6 +9428,8 @@
"6e820a7742353257": "Введите интервал не меньше одной минуты.",
"9e596c405f5cea09": "«Один раз» здесь недоступно",
"e450f26e1af0a074": "В этом окружении работает старая версия T3 Code. Обновите её, чтобы запланировать разовую задачу, или выберите другое расписание.",
+ "14f522da60702611": "Cron недоступен в этой среде",
+ "00ea5df0d5cc65e6": "В этой среде используется старая версия T3 Code. Обновите её, чтобы запланировать задачу cron, или выберите другое расписание.",
"71d8554090924454": "Требуется путь к копии",
"a34b72de0ff1cbd0": "Введите путь к копии, в которой нужно выполнять задачу.",
"99a8c45121157edd": "Не удалось сохранить запланированную задачу",
@@ -9462,6 +9464,16 @@
"196658ca8d7106b1": "Создать задачу",
"5baf27d764acc26d": "Выполнять, только если совпадают все фильтры. Остальные запросы записываются как отфильтрованные. Значения для «одно из» разделяйте запятыми; значение не может содержать запятую.",
"1abe7fdace9bed26": "Добавить фильтр",
+ "316f12ddbabba34e": "Выражение",
+ "8999d6b440d32f4d": "Минута, час, день месяца, месяц, день недели. Используется часовой пояс среды.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " запускается каждые 30 минут с 9:00 до 16:30 с понедельника по пятницу."
+ ],
"ce5c81a41b72193a": "Новая задача",
"58d9625d53534eab": "Нет доступных окружений",
"5a8eb023f363e0d8": "Подключите окружение, чтобы управлять запланированными задачами.",
@@ -9501,6 +9513,7 @@
"ce1b005dfc83db03": "В определённое время",
"dac46f3c9d007f8b": "Один раз",
"3a851981dc1fdfc4": "С интервалом",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "По вебхуку",
"0d15db4c81851479": "Запросы с одинаковым ключом выполняются только один раз в течение 7 дней.",
"a844a27ea5562bea": "При объединении последний payload выполняется один раз, когда закрывается окно, отсчитанное от первой доставки. Пустые ключи выполняются как обычно.",
@@ -11300,6 +11313,8 @@
"ded467fac40e823e": "Один раз, {time}",
"32f36b059ed73dc0": "Каждые {minutes} мин",
"b1eb053919fcb482": "Каждые {seconds} с",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Ежедневно в {time}",
"29d245e6c8e8b5d7": "Ежедневно в {time} {zone}",
"5115c6bf9ed1decd": "По будням в {time}",
@@ -11307,6 +11322,7 @@
"e1222cad4667e338": "{days} в {time}",
"74b25bf2e8d10313": "{days} в {time} {zone}",
"4ee38ebaddb9d978": "Недопустимое время запуска",
+ "eda6a4ccc66dea8a": "Недопустимое выражение cron",
"2b5678bf6b6792d4": "Выберите дату и время.",
"f062630735a207ea": "Такого времени нет в вашем часовом поясе.",
"75265b7ef76cfedd": "Выберите время.",
diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json
index 5e6d1607edf31..d15bf1fa48018 100644
--- a/apps/web/src/i18n/translations/sv.json
+++ b/apps/web/src/i18n/translations/sv.json
@@ -9434,6 +9434,8 @@
"6e820a7742353257": "Ange ett intervall på minst en minut.",
"9e596c405f5cea09": "En gång är inte tillgängligt här",
"e450f26e1af0a074": "Den här miljön kör en äldre version av T3 Code. Uppdatera den för att schemalägga en engångsuppgift, eller välj ett annat schema.",
+ "14f522da60702611": "Cron är inte tillgängligt här",
+ "00ea5df0d5cc65e6": "Den här miljön kör en äldre version av T3 Code. Uppdatera den för att schemalägga en cron-uppgift, eller välj ett annat schema.",
"71d8554090924454": "Sökväg till utcheckningen krävs",
"a34b72de0ff1cbd0": "Ange sökvägen till utcheckningen som ska köras i.",
"99a8c45121157edd": "Kunde inte spara den schemalagda uppgiften",
@@ -9468,6 +9470,16 @@
"196658ca8d7106b1": "Skapa uppgift",
"5baf27d764acc26d": "Kör bara när alla filter matchar. Andra begäranden loggas som filtrerade. Separera värden för ”är en av” med kommatecken; ett värde får inte innehålla kommatecken.",
"1abe7fdace9bed26": "Lägg till filter",
+ "316f12ddbabba34e": "Uttryck",
+ "8999d6b440d32f4d": "Minut, timme, dag i månaden, månad, veckodag, i miljöns tidszon.",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " körs var 30:e minut från 9:00 till 16:30, måndag till fredag."
+ ],
"ce5c81a41b72193a": "Ny uppgift",
"58d9625d53534eab": "Inga miljöer tillgängliga",
"5a8eb023f363e0d8": "Anslut en miljö för att hantera schemalagda uppgifter.",
@@ -9507,6 +9519,7 @@
"ce1b005dfc83db03": "Vid en tid",
"dac46f3c9d007f8b": "En gång",
"3a851981dc1fdfc4": "Med intervall",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "Vid webhook",
"0d15db4c81851479": "Begäranden med samma nyckel körs bara en gång inom 7 dagar.",
"a844a27ea5562bea": "Sammanslagning kör den senaste nyttolasten en gång när fönstret från den första leveransen stängs. Tomma nycklar körs som vanligt.",
@@ -11308,6 +11321,8 @@
"ded467fac40e823e": "En gång, {time}",
"32f36b059ed73dc0": "Var {minutes}:e min",
"b1eb053919fcb482": "Var {seconds}:e s",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "Dagligen kl. {time}",
"29d245e6c8e8b5d7": "Dagligen kl. {time} {zone}",
"5115c6bf9ed1decd": "Vardagar kl. {time}",
@@ -11315,6 +11330,7 @@
"e1222cad4667e338": "{days} kl. {time}",
"74b25bf2e8d10313": "{days} kl. {time} {zone}",
"4ee38ebaddb9d978": "Ogiltig körtid",
+ "eda6a4ccc66dea8a": "Ogiltigt cron-uttryck",
"2b5678bf6b6792d4": "Välj ett datum och en tid.",
"f062630735a207ea": "Den tiden finns inte i din tidszon.",
"75265b7ef76cfedd": "Välj en tid.",
diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json
index c86b9e6c55e41..a87dba739289c 100644
--- a/apps/web/src/i18n/translations/zh.json
+++ b/apps/web/src/i18n/translations/zh.json
@@ -9442,6 +9442,8 @@
"6e820a7742353257": "请输入至少一分钟的间隔。",
"9e596c405f5cea09": "此环境不支持单次运行",
"e450f26e1af0a074": "此环境运行的是旧版 T3 Code。请更新后再创建单次定时任务,或选择其他定时规则。",
+ "14f522da60702611": "此环境不支持 Cron",
+ "00ea5df0d5cc65e6": "此环境运行的 T3 Code 版本较旧。请更新 T3 Code 以安排 cron 任务,或选择其他计划。",
"71d8554090924454": "请填写工作副本路径",
"a34b72de0ff1cbd0": "请输入任务运行所在的工作副本路径。",
"99a8c45121157edd": "无法保存定时任务",
@@ -9476,6 +9478,16 @@
"196658ca8d7106b1": "创建任务",
"5baf27d764acc26d": "仅在所有筛选条件都满足时运行。其他请求会记为已过滤。“属于以下值之一”的多个值用英文逗号分隔,值本身不能包含逗号。",
"1abe7fdace9bed26": "添加筛选条件",
+ "316f12ddbabba34e": "表达式",
+ "8999d6b440d32f4d": "分钟、小时、日期、月份、星期,使用环境的时区。",
+ "3d083dde966e59e9": [
+ {
+ "i": 1,
+ "k": "_gt_value_1",
+ "v": "v"
+ },
+ " 会在周一至周五的 9:00 至 16:30 之间每 30 分钟运行一次。"
+ ],
"ce5c81a41b72193a": "新建任务",
"58d9625d53534eab": "没有可用的环境",
"5a8eb023f363e0d8": "连接一个环境以管理定时任务。",
@@ -9515,6 +9527,7 @@
"ce1b005dfc83db03": "固定时间",
"dac46f3c9d007f8b": "单次",
"3a851981dc1fdfc4": "按间隔",
+ "dc797371956718d8": "Cron",
"dff69f5877b71ab0": "收到 webhook 时",
"0d15db4c81851479": "键相同的请求在 7 天内只运行一次。",
"a844a27ea5562bea": "从首次投递开始计算合并窗口,窗口结束时仅使用最新请求内容运行一次。键为空时正常运行。",
@@ -11324,6 +11337,8 @@
"ded467fac40e823e": "一次,{time}",
"32f36b059ed73dc0": "每 {minutes} 分钟",
"b1eb053919fcb482": "每 {seconds} 秒",
+ "cadde1c1929b7f2e": "Cron {expression}",
+ "49d0713d482827a7": "Cron {expression} {zone}",
"d6d2c794518c8906": "每天 {time}",
"29d245e6c8e8b5d7": "每天 {time} {zone}",
"5115c6bf9ed1decd": "工作日 {time}",
@@ -11331,6 +11346,7 @@
"e1222cad4667e338": "{days} 的 {time}",
"74b25bf2e8d10313": "{days} 的 {time} {zone}",
"4ee38ebaddb9d978": "运行时间无效",
+ "eda6a4ccc66dea8a": "无效的 cron 表达式",
"2b5678bf6b6792d4": "请选择日期和时间。",
"f062630735a207ea": "你所在的时区不存在这个时间。",
"75265b7ef76cfedd": "请选择时间。",
diff --git a/docs/orchestration-v2/orchestrator-mcp-server.md b/docs/orchestration-v2/orchestrator-mcp-server.md
index fa2770bb10cf7..b14ca40093bb3 100644
--- a/docs/orchestration-v2/orchestrator-mcp-server.md
+++ b/docs/orchestration-v2/orchestrator-mcp-server.md
@@ -465,8 +465,10 @@ returned unchanged, and a thread with no active provider turn returns
`schedule_task`, `list_scheduled_tasks`, and `delete_scheduled_task` manage
recurring work in the app scheduler; `schedule_task` with a `scheduledTaskId`
updates an existing task. A schedule
-runs its prompt on an interval, at a fixed time in the server's local time
-zone, or on each qualifying webhook request, even when no turn is active.
+runs its prompt on an interval, at a fixed time, on a five-field cron
+expression, once at a date and time, or on each qualifying webhook request, even
+when no turn is active. Fixed-time and cron schedules use the server's local
+time zone.
Without a signature, anyone with the webhook URL can trigger a run.
Signature checks, filters, and dedupe can skip a webhook request.
`bindToCurrentThread` defaults to `true` only when the caller has a thread in
diff --git a/docs/user/project-settings.md b/docs/user/project-settings.md
index 84ffbbebd5a4d..64baf0f9532b4 100644
--- a/docs/user/project-settings.md
+++ b/docs/user/project-settings.md
@@ -88,6 +88,16 @@ environment's time zone, which may differ from your phone's. Choose **Once**
to run a task a single time at a date and time in your own time zone. If the
environment is offline then, the task runs when it is back.
+Choose **Cron** for a schedule the other options can't express, such as every
+30 minutes during business hours on weekdays. Enter a standard five-field cron
+expression: minute, hour, day of month, month, and weekday. For example,
+`*/30 9-16 * * 1-5` runs at :00 and :30 from 9:00 to 16:30, Monday to Friday.
+Cron schedules use the environment's time zone, like fixed-time schedules. If
+the environment is offline at run time, only its first missed run can still
+happen, and only if the environment is back within 10 minutes of it. Other
+missed runs are skipped, the task shows the miss as a failed run, and it waits
+for its next time.
+
Under **Destination**, choose where runs go. **New thread each run** keeps every
run separate. The two one-thread choices start a thread on the first run and post
later runs there: one continues the same conversation, the other starts each run
diff --git a/evals/mcp-tool-use/cases/pull-requests.ndjson b/evals/mcp-tool-use/cases/pull-requests.ndjson
index 2e14e45f7f250..6423f43acf3c8 100644
--- a/evals/mcp-tool-use/cases/pull-requests.ndjson
+++ b/evals/mcp-tool-use/cases/pull-requests.ndjson
@@ -37,3 +37,4 @@
{"id": "link-one-pr", "area": "pull-requests", "privacy": "commit-safe", "kind": "control", "pattern": "single link stays single", "experience": "Linking one named PR is ordinary work.", "setup": {"role": "top", "context": "No pull requests are linked to this thread.", "world": {"repo": "acme/app", "branch": "main"}}, "prompt": "link https://github.com/acme/app/pull/130 here", "expect": {"calls": [{"tool": "link_pull_request", "args": {"url": "~/pull/130"}}], "notCalls": ["link_pull_requests"]}, "maxSteps": 6, "source": {"thread": "Synthetic control for batch link"}}
{"id": "schedule-one-time-date", "area": "pull-requests", "kind": "bad", "pattern": "one-off date scheduled as a daily task", "experience": "Theo asked whether a scheduled task can run at a specific date and time. schedule_task only had daily times, intervals, and webhooks, so a one-off request became a daily task.", "source": {"report": "maintainer request, 2026-10-31: scheduled tasks could not run at one date and time"}, "rule": "schedule: {type:'once',runAt} for one date and time", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"schedule_task": {"scheduledTaskId": "scheduled-task-4", "title": "Cut 2.0 release branch", "schedule": {"type": "once", "runAt": "2026-11-03T09:00:00.000Z"}, "enabled": true, "nextRunAt": "2026-11-03T09:00:00.000Z"}}}, "prompt": "On November 3rd at 9am UTC, start a new thread that cuts the 2.0 release branch from main in acme/app. Only that one time.", "expect": {"calls": [{"tool": "schedule_task", "args": {"schedule.type": "once", "schedule.runAt": "~11-03T09:00"}}], "notCalls": ["delegate_task", "run_scheduled_task_now"]}, "notes": "Mock result shape is an approximation."}
{"id": "schedule-fresh-session-per-run", "area": "pull-requests", "kind": "guard", "pattern": "recurring task that should not accumulate context", "experience": "A recurring triage task kept one thread so the user could read its history, but each run carried every earlier run's context into the next.", "rule": "schedule_task `freshSession: true` keeps runs in one thread while each run starts a fresh session.", "privacy": "commit-safe", "setup": {"role": "top", "context": "Today is Monday 2026-11-02, 10:00 local time.", "mocks": {"schedule_task": {"scheduledTaskId": "scheduled-task-7", "title": "Triage new issues", "enabled": true, "projectId": "project-1", "boundThreadId": null, "freshSession": true, "schedule": {"type": "fixed_time", "timeOfDay": "09:00"}, "nextRunAt": "2026-11-03T09:00:00-08:00", "lastRunStatus": "never"}}}, "prompt": "Every morning at 9, triage new issues in acme/app. Keep all the runs in one thread so I can scroll back, but each run should start clean without remembering the previous days.", "expect": {"calls": [{"tool": "schedule_task", "args": {"schedule.type": "fixed_time", "freshSession": true}}], "notCalls": ["delegate_task", "run_scheduled_task_now"]}, "source": {"request": "juliusmarminge (maintainer) request, 2026-11-03: automations in one thread with separate provider sessions"}, "notes": "schedule-one-off-tomorrow is the control: an ordinary schedule must not set freshSession."}
+{"id": "schedule-business-hours-cron", "area": "pull-requests", "kind": "bad", "pattern": "interval limited to weekday business hours", "experience": "A user wanted a task every 30 minutes, but only during business hours on weekdays. Intervals run around the clock and fixed times take one time of day, so the only options were a 24/7 interval or one task per slot.", "source": {"request": "user request, 2026-11-08: intervals restricted to weekdays and business hours"}, "rule": "schedule: {type:'cron',expression} for clock-aligned recurrence such as weekday business hours", "privacy": "commit-safe", "setup": {"role": "top", "context": "Today is Monday 2026-11-09, 08:00 local time.", "mocks": {"schedule_task": {"scheduledTaskId": "scheduled-task-8", "title": "Check main CI", "schedule": {"type": "cron", "expression": "*/30 9-16 * * 1-5"}, "enabled": true, "nextRunAt": "2026-11-09T09:00:00-06:00"}}}, "prompt": "Every 30 minutes during business hours, 9 to 5 on weekdays, check whether CI on main in acme/app is green and tell me if it is not.", "expect": {"calls": [{"tool": "schedule_task", "args": {"schedule.type": "cron"}}], "notCalls": ["delegate_task", "run_scheduled_task_now"]}, "notes": "Any expression that limits runs to weekdays and 9 to 5 is correct; the grader checks the type only. Mock result shape is an approximation."}
diff --git a/packages/client-runtime/src/scheduledTaskTimeZone.ts b/packages/client-runtime/src/scheduledTaskTimeZone.ts
index 9321ab11acbe8..5b8717e0842d9 100644
--- a/packages/client-runtime/src/scheduledTaskTimeZone.ts
+++ b/packages/client-runtime/src/scheduledTaskTimeZone.ts
@@ -1,7 +1,7 @@
import * as DateTime from "effect/DateTime";
/**
- * Short label for the server zone a fixed-time schedule runs in. With a run time it names
+ * Short label for the server zone a fixed-time or cron schedule runs in. With a run time it names
* that instant's offset (PST/PDT); without one it uses the generic name (PT).
*/
export function scheduleTimeZoneLabel(
diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts
index b1b014cbc1312..fe9b44a351f49 100644
--- a/packages/contracts/src/environment.ts
+++ b/packages/contracts/src/environment.ts
@@ -193,6 +193,8 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({
triage: Schema.optionalKey(Schema.Boolean),
/** Server accepts `{ type: "once" }` scheduled tasks; older servers reject them on save. */
oneTimeSchedules: Schema.optionalKey(Schema.Boolean),
+ /** Server accepts `{ type: "cron" }` scheduled tasks; older servers reject them on save. */
+ cronSchedules: Schema.optionalKey(Schema.Boolean),
/** Server honors `freshContext` on sends; older servers ignore it and keep the old context. */
freshContext: Schema.optionalKey(Schema.Boolean),
/** Server saves and runs scheduled task `threadMode`; older servers ignore it. */
diff --git a/packages/contracts/src/orchestratorMcp.ts b/packages/contracts/src/orchestratorMcp.ts
index d7c607744d4a7..e974208abd2c3 100644
--- a/packages/contracts/src/orchestratorMcp.ts
+++ b/packages/contracts/src/orchestratorMcp.ts
@@ -69,7 +69,7 @@ const OrchestratorMcpSchedule = Schema.Union([
OrchestratorMcpScheduleFromJsonString,
]).annotate({
description:
- "Trigger: {type:'interval',everyMs}, {type:'fixed_time',timeOfDay,weekdays?}, {type:'once',runAt}, or {type:'webhook'}.",
+ "Trigger: {type:'interval',everyMs}, {type:'fixed_time',timeOfDay,weekdays?}, {type:'once',runAt}, {type:'cron',expression}, or {type:'webhook'}.",
});
const OrchestratorMcpTargetOptionsFromRecord = Schema.Record(
diff --git a/packages/contracts/src/scheduledTask.test.ts b/packages/contracts/src/scheduledTask.test.ts
index c9b4d597bd0a3..f91497fd4b88f 100644
--- a/packages/contracts/src/scheduledTask.test.ts
+++ b/packages/contracts/src/scheduledTask.test.ts
@@ -3,6 +3,7 @@ import * as Schema from "effect/Schema";
import {
MIN_SCHEDULED_TASK_INTERVAL_MS,
+ scheduledTaskCronError,
ScheduledTaskSchedule,
ScheduledTaskUpsertSchedule,
} from "./scheduledTask.ts";
@@ -38,6 +39,30 @@ describe("ScheduledTaskSchedule", () => {
expect(() => decodeUpsertSchedule({ type: "once", runAt })).toThrow();
}
});
+
+ it("accepts five-field cron and says why it refuses other expressions", () => {
+ expect(decodeUpsertSchedule({ type: "cron", expression: " */30 9-17 * * MON-FRI " })).toEqual({
+ type: "cron",
+ expression: "*/30 9-17 * * MON-FRI",
+ });
+ expect(decodeSchedule({ type: "cron", expression: "0 9 29 2 *" })).toEqual({
+ type: "cron",
+ expression: "0 9 29 2 *",
+ });
+ const reason = scheduledTaskCronError;
+ // A seconds field would let a task run every second.
+ expect(reason("* * * * * *")).toMatch(/five fields/);
+ expect(reason("0 9 * *")).toMatch(/five fields/);
+ expect(reason("@daily")).toMatch(/five fields/);
+ expect(reason("61 * * * *")).toMatch(/between 0 and 59/);
+ expect(reason("0 0 30 2 *")).toMatch(/never matches/);
+ expect(() => decodeUpsertSchedule({ type: "cron", expression: "0 0 31 4 *" })).toThrow(
+ /never matches/,
+ );
+ expect(() => decodeSchedule({ type: "cron", expression: "* * * * * *" })).toThrow(
+ /five fields/,
+ );
+ });
});
it.each(["literal", " ", "\t\n", "{{body.bad", "{{unknown.field}}"])(
diff --git a/packages/contracts/src/scheduledTask.ts b/packages/contracts/src/scheduledTask.ts
index 4297ad94b73e9..2236bbbbd95b9 100644
--- a/packages/contracts/src/scheduledTask.ts
+++ b/packages/contracts/src/scheduledTask.ts
@@ -1,3 +1,5 @@
+import * as Cron from "effect/Cron";
+import * as Result from "effect/Result";
import * as Schema from "effect/Schema";
import {
@@ -73,6 +75,42 @@ const ScheduledTaskOnceSchedule = Schema.Struct({
),
});
+/**
+ * Parses a five-field cron expression: minute, hour, day of month, month, weekday.
+ * A seconds field is refused, so a task never runs more than once a minute. With
+ * no time zone, the expression is read in the host's local time.
+ */
+export function parseScheduledTaskCron(
+ expression: string,
+ timeZone?: Parameters[1],
+): Result.Result {
+ const fields = expression.trim().split(/\s+/);
+ if (fields.length !== 5)
+ return Result.fail("Use five fields: minute, hour, day of month, month, weekday.");
+ const parsed = Cron.parse(fields.join(" "), timeZone);
+ if (Result.isFailure(parsed)) return Result.fail(parsed.failure.message);
+ try {
+ // Dates like Feb 30 never occur, so the task could never run.
+ Cron.next(parsed.success, 0);
+ } catch {
+ return Result.fail("This expression never matches a real date.");
+ }
+ return Result.succeed(parsed.success);
+}
+
+/** Why a cron expression cannot be saved, or null when it can. */
+export function scheduledTaskCronError(expression: string): string | null {
+ const parsed = parseScheduledTaskCron(expression);
+ return Result.isFailure(parsed) ? parsed.failure : null;
+}
+
+const ScheduledTaskCronSchedule = Schema.Struct({
+ type: Schema.Literal("cron"),
+ expression: TrimmedNonEmptyString.check(
+ Schema.makeFilter((value) => scheduledTaskCronError(value) ?? true),
+ ).annotate({ description: "Five fields, such as '*/30 9-17 * * 1-5'." }),
+}).annotate({ description: "Cron in the environment's time zone." });
+
const ScheduledTaskWebhookSignatureFields = {
header: TrimmedNonEmptyString.annotate({
description: "Header with the signature, such as x-hub-signature-256.",
@@ -195,6 +233,7 @@ export const ScheduledTaskSchedule = Schema.Union([
ScheduledTaskIntervalSchedule,
ScheduledTaskFixedTimeSchedule,
ScheduledTaskOnceSchedule,
+ ScheduledTaskCronSchedule,
ScheduledTaskWebhookSchedule,
]);
export type ScheduledTaskSchedule = typeof ScheduledTaskSchedule.Type;
@@ -210,6 +249,7 @@ export const ScheduledTaskUpsertSchedule = Schema.Union([
}),
ScheduledTaskFixedTimeSchedule,
ScheduledTaskOnceSchedule,
+ ScheduledTaskCronSchedule,
ScheduledTaskUpsertWebhookSchedule,
]);
export type ScheduledTaskUpsertSchedule = typeof ScheduledTaskUpsertSchedule.Type;