Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(pipes): stop leaking raw cron into schedule labels

Louis Beaumont9d7f8ba8c90e
diff --git a/apps/screenpipe-app-tauri/components/settings/pipe-trigger-picker.tsx b/apps/screenpipe-app-tauri/components/settings/pipe-trigger-picker.tsx
index 0cc6c4f26..ebd6c4ac4 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipe-trigger-picker.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipe-trigger-picker.tsx
@@ -63,7 +63,9 @@ interface Option {
}
const OPTIONS: Option[] = [
- { id: "schedule", group: "recurring", label: "on a schedule", sub: "every N minutes, daily, cron" },
+ // "cron" is implementation vocabulary, not the user's — the picker offers
+ // plain cadences and keeps the raw expression as an advanced escape hatch.
+ { id: "schedule", group: "recurring", label: "on a schedule", sub: "hourly, daily, every N minutes" },
{ id: "meeting_started", group: "meetings", label: "meeting starts", sub: "a call is detected" },
{ id: "meeting_ended", group: "meetings", label: "meeting ends", sub: "a call wraps up" },
{ id: "slack", group: "slack", label: "new message", sub: "in a channel you pick", app: "slack" },
diff --git a/apps/screenpipe-app-tauri/lib/utils/schedule-format.test.ts b/apps/screenpipe-app-tauri/lib/utils/schedule-format.test.ts
index 28d3583d6..adcff9d07 100644
--- a/apps/screenpipe-app-tauri/lib/utils/schedule-format.test.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/schedule-format.test.ts
@@ -96,4 +96,35 @@ describe("humanizeSchedule", () => {
expect(humanizeSchedule("0 22 * * 0")).toBe("10 PM · Sun");
expect(humanizeSchedule("0 9 * * *")).toBe("daily · 9 AM");
});
+
+ // These four shapes used to fall through every branch and hit the raw-string
+ // fallback, so the task list literally rendered "0 * * * *" and
+ // "30 17 * * *" at people. A schedule label must never show raw cron.
+ test("hourly cron (fixed minute, wildcard hour)", () => {
+ expect(humanizeSchedule("0 * * * *")).toBe("hourly");
+ expect(humanizeSchedule("15 * * * *")).toBe("hourly · :15");
+ expect(humanizeSchedule("5 * * * *")).toBe("hourly · :05");
+ expect(humanizeSchedule("5 * * * 1-5")).toBe("hourly · :05 · weekdays");
+ });
+
+ test("cron with non-zero minutes", () => {
+ expect(humanizeSchedule("30 17 * * *")).toBe("daily · 5:30 PM");
+ expect(humanizeSchedule("45 9 * * 1-5")).toBe("9:45 AM · weekdays");
+ expect(humanizeSchedule("30 0 * * *")).toBe("daily · 12:30 AM");
+ expect(humanizeSchedule("30 12 * * *")).toBe("daily · 12:30 PM");
+ });
+
+ test("never leaks raw cron for common shapes", () => {
+ for (const cron of [
+ "0 * * * *",
+ "15 * * * *",
+ "30 17 * * *",
+ "45 9 * * 1-5",
+ "0 17 * * *",
+ "*/30 * * * *",
+ "0 */4 * * *",
+ ]) {
+ expect(humanizeSchedule(cron)).not.toContain("*");
+ }
+ });
});
diff --git a/apps/screenpipe-app-tauri/lib/utils/schedule-format.ts b/apps/screenpipe-app-tauri/lib/utils/schedule-format.ts
index 945640991..77447a22d 100644
--- a/apps/screenpipe-app-tauri/lib/utils/schedule-format.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/schedule-format.ts
@@ -28,6 +28,14 @@ function formatHour(h: number): string {
return `${h - 12} PM`;
}
+/** Format a 24h time as "9 AM" on the hour, else "9:30 AM". */
+function formatTime(h: number, m: number): string {
+ if (!m) return formatHour(h);
+ const suffix = h < 12 ? "AM" : "PM";
+ const h12 = h % 12 === 0 ? 12 : h % 12;
+ return `${h12}:${String(m).padStart(2, "0")} ${suffix}`;
+}
+
/** Convert a cron day-of-week field to a readable label (e.g. "weekdays", "weekends", "daily", "except Mon", "Sun, Tue, Wed"). */
export function humanizeDow(dow: string): string {
if (!dow || dow === "*") return "";
@@ -109,9 +117,20 @@ export function humanizeSchedule(schedule: string | undefined): string {
}
return label;
}
- // 0 H * * dow → "9 AM · Mon" or "daily · 10 PM"
- if (min === "0" && /^\d+$/.test(hour) && dom === "*" && mon === "*") {
- const timeStr = formatHour(parseInt(hour));
+ // M * * * * → "hourly" / "hourly · :15". A fixed minute with a wildcard
+ // hour is one of the most common crons and used to fall through to the
+ // raw-string fallback, so rows rendered "0 * * * *" verbatim.
+ if (/^\d+$/.test(min) && hour === "*" && dom === "*" && mon === "*") {
+ const m = parseInt(min);
+ const base = m === 0 ? "hourly" : `hourly · :${String(m).padStart(2, "0")}`;
+ if (dow === "*") return base;
+ const dayLabel = humanizeDow(dow);
+ return dayLabel ? `${base} · ${dayLabel}` : base;
+ }
+ // M H * * dow → "9 AM · Mon", "daily · 10 PM", "daily · 5:30 PM".
+ // Minutes were previously required to be 0, so "30 17 * * *" leaked raw.
+ if (/^\d+$/.test(min) && /^\d+$/.test(hour) && dom === "*" && mon === "*") {
+ const timeStr = formatTime(parseInt(hour), parseInt(min));
if (dow === "*") return `daily · ${timeStr}`;
const dayLabel = humanizeDow(dow);
return dayLabel ? `${timeStr} · ${dayLabel}` : timeStr;