@devries-cameron20 / t3code-1 / commits / 86729b45f9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

revert: "fix(scheduler): label fixed-time tasks with the server timezone" (#18653) (#22230)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 20, 2026 at 02:02 UTC 86729b45f92490946f0fcda9f9f454fabfea8bcb
7 files changed +11 -121
apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts
-47
@@ -6,7 +6,6 @@ import * as DateTime from "effect/DateTime";
6 import * as Effect from "effect/Effect";
7 import * as Layer from "effect/Layer";
8 import * as Schema from "effect/Schema";
9 -import * as Stream from "effect/Stream";
9 import * as TestClock from "effect/testing/TestClock";
10
11 import * as ThreadLaunchService from "../orchestration-v2/ThreadLaunchService.ts";
@@ -59,52 +58,6 @@ it.effect("rejects a stale form save after deletion while preserving explicit-id
58 }).pipe(Effect.provide(SqlitePersistence.layerMemory)),
59 );
60
62 -it.effect("includes the scheduler zone in empty lists and subscription updates", () =>
63 - Effect.gen(function* () {
64 - const layerDependencies = Layer.mergeAll(
65 - NodeCrypto.layer,
66 - Scheduler.layer,
67 - Layer.mock(ThreadLaunchService.ThreadLaunchService)({}),
68 - Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({
69 - namedProjectsRoot: "/projects",
70 - isScratchProject: () => Effect.succeed(false),
71 - }),
72 - Layer.mock(ThreadManagementService.ThreadManagementService)({}),
73 - Layer.mock(SecretRequests.SecretRequests)({}),
74 - );
75 - yield* Effect.gen(function* () {
76 - const service = yield* ScheduledTaskService.ScheduledTaskService;
77 - const timeZone = DateTime.zoneToString(DateTime.zoneMakeLocal());
78 - expect(yield* service.list()).toEqual({ tasks: [], timeZone });
79 -
80 - const input = yield* decodeUpsertInput({
81 - title: "Morning review",
82 - prompt: "Review the open pull requests.",
83 - enabled: false,
84 - schedule: { type: "fixed_time", timeOfDay: "09:00" },
85 - projectId: "project-schedule-zone",
86 - workspaceStrategy: { type: "root" },
87 - modelSelection: { instanceId: "codex", model: "gpt-5.4" },
88 - runtimeMode: "full-access",
89 - interactionMode: "default",
90 - });
91 - const snapshots = yield* service.subscribeList().pipe(
92 - Stream.tap((snapshot) =>
93 - snapshot.tasks.length === 0 ? service.upsert(input) : Effect.void,
94 - ),
95 - Stream.take(2),
96 - Stream.runCollect,
97 - );
98 - const populated = yield* service.list();
99 - expect(populated).toMatchObject({
100 - timeZone,
101 - tasks: [{ title: "Morning review", schedule: input.schedule }],
102 - });
103 - expect(snapshots).toEqual([{ tasks: [], timeZone }, populated]);
104 - }).pipe(Effect.provide(ScheduledTaskService.layer.pipe(Layer.provide(layerDependencies))));
105 - }).pipe(Effect.provide(SqlitePersistence.layerMemory)),
106 -);
107 -
61 it.effect("preserves a due run when a save only pads the scheduled hour", () =>
62 Effect.gen(function* () {
63 const dueAt = DateTime.makeZonedUnsafe(
apps/server/src/scheduledTasks/ScheduledTaskService.ts
+1 -4
@@ -936,10 +936,7 @@ export const layer = Layer.effect(
936
937 const list: ScheduledTaskService["Service"]["list"] = () =>
938 listRows().pipe(
939 - Effect.map((tasks) => ({
940 - tasks,
941 - timeZone: DateTime.zoneToString(DateTime.zoneMakeLocal()),
942 - })),
939 + Effect.map((tasks) => ({ tasks })),
940 Effect.mapError((cause) => taskError("Could not list schedule tasks.", { cause })),
941 );
942
apps/server/src/ws.ts
-1
@@ -1321,7 +1321,6 @@ export const layerWsRpc = (
1321 currentSession.scopes.includes(AuthOrchestrationOperateScope)
1322 ? result
1323 : {
1324 - ...result,
1324 tasks: result.tasks.map(({ webhook: _webhook, ...task }) => task),
1325 };
1326 const authorizeEffect = <A, E, R>(
apps/web/src/components/chat/ThreadAutomationsPanel.permissions.browser.test.tsx
+2 -41
@@ -1,10 +1,4 @@
1 -import {
2 - EnvironmentId,
3 - ThreadId,
4 - ScheduledTaskId,
5 - type ScheduledTask,
6 - type ScheduledTaskListResult,
7 -} from "@t3tools/contracts";
1 +import { EnvironmentId, ThreadId, ScheduledTaskId, type ScheduledTask } from "@t3tools/contracts";
2 import { act } from "react";
3 import { createRoot, type Root } from "react-dom/client";
4 import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
@@ -34,7 +28,7 @@ vi.mock(import("../../state/use-atom-command"), async (importOriginal) => {
28 });
29 vi.mock(import("../../state/query"), async (importOriginal) => ({
30 ...(await importOriginal()),
37 - useEnvironmentQuery: (() => ({ data: listResult, error: null })) as never,
31 + useEnvironmentQuery: (() => ({ data: { tasks: [task] }, error: null })) as never,
32 }));
33
34 import { ThreadAutomationsPanel } from "./ThreadAutomationsPanel";
@@ -47,15 +41,12 @@ const task = {
41 enabled: true,
42 schedule: { type: "interval", everyMs: 60000 },
43 lastRunStatus: "never",
50 - nextRunAt: null,
44 } as ScheduledTask;
52 -let listResult: ScheduledTaskListResult & { timeZone?: string };
45 let root: Root;
46 let container: HTMLDivElement;
47 beforeEach(() => {
48 vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
49 state.allowed = true;
58 - listResult = { tasks: [task] };
50 state.toggle.mockReset().mockResolvedValue({ _tag: "Success" });
51 state.run.mockReset().mockResolvedValue({ _tag: "Success" });
52 container = document.createElement("div");
@@ -93,33 +84,3 @@ it("rejects a retained toggle after task permission is revoked", async () => {
84 await act(async () => byLabel("Pause Daily review").click());
85 expect(state.toggle).toHaveBeenCalledOnce();
86 });
96 -
97 -it("labels fixed times with the server zone and preserves labels from older servers", async () => {
98 - const tasks: ScheduledTask[] = [
99 - { ...task, schedule: { type: "fixed_time", timeOfDay: "09:00" } },
100 - { ...task, id: ScheduledTaskId.make("interval"), title: "Interval review" },
101 - {
102 - ...task,
103 - id: ScheduledTaskId.make("webhook"),
104 - title: "Webhook review",
105 - schedule: { type: "webhook", signature: null },
106 - },
107 - ];
108 - const labels = () => Array.from(container.querySelectorAll("li p"), (row) => row.textContent);
109 -
110 - listResult = { tasks, timeZone: "Asia/Kolkata" };
111 - await renderPanel();
112 - expect(labels()).toEqual(["Daily at 09:00 Asia/Kolkata", "Every 1 min", "On webhook"]);
113 -
114 - listResult = { tasks, timeZone: "Etc/UTC" };
115 - await renderPanel();
116 - expect(labels()).toEqual(["Daily at 09:00 UTC", "Every 1 min", "On webhook"]);
117 -
118 - listResult = { tasks, timeZone: "UTC" };
119 - await renderPanel();
120 - expect(labels()).toEqual(["Daily at 09:00 UTC", "Every 1 min", "On webhook"]);
121 -
122 - listResult = { tasks };
123 - await renderPanel();
124 - expect(labels()).toEqual(["Daily at 09:00", "Every 1 min", "On webhook"]);
125 -});
apps/web/src/components/chat/ThreadAutomationsPanel.tsx
+4 -8
@@ -37,10 +37,10 @@ const STATUS_DOT_CLASS: Record<ScheduledTask["lastRunStatus"], string> = {
37 failed: "bg-destructive",
38 };
39
40 -function taskScheduleLine(task: ScheduledTask, timeZone: string | undefined) {
40 +function taskScheduleLine(task: ScheduledTask) {
41 return (
42 <>
43 - {scheduleLabel(task.schedule, timeZone)}
43 + {scheduleLabel(task.schedule)}
44 {task.enabled && task.nextRunAt !== null ? (
45 <>
46 {" · next "}
@@ -185,15 +185,11 @@ export function ThreadAutomationsPanel(props: {
185 <span className="block truncate text-sm font-medium text-foreground/80">
186 {task.title}
187 </span>
188 - <p className="truncate text-2xs text-muted-foreground">
189 - {taskScheduleLine(task, tasksQuery.data?.timeZone)}
190 - </p>
188 + <p className="truncate text-2xs text-muted-foreground">{taskScheduleLine(task)}</p>
189 </TooltipTrigger>
190 <TooltipPopup side="left">
191 <p className="font-medium">{task.title}</p>
194 - <p className="text-muted-foreground">
195 - {taskScheduleLine(task, tasksQuery.data?.timeZone)}
196 - </p>
192 + <p className="text-muted-foreground">{taskScheduleLine(task)}</p>
193 </TooltipPopup>
194 </Tooltip>
195 <Tooltip>
apps/web/src/components/settings/ScheduledTasksSettings.tsx
+4 -18
@@ -179,11 +179,7 @@ function splitModelKey(value: string): ModelSelection | null {
179 };
180 }
181
182 -function scheduleTimeZoneLabel(timeZone: string | undefined) {
183 - return timeZone === "Etc/UTC" ? "UTC" : timeZone;
184 -}
185 -
186 -export function scheduleLabel(schedule: ScheduledTaskSchedule, timeZone?: string): string {
182 +export function scheduleLabel(schedule: ScheduledTaskSchedule): string {
183 if (schedule.type === "webhook") return "On webhook";
184 if (schedule.type === "interval") {
185 const minutes = schedule.everyMs / 60_000;
@@ -198,8 +194,7 @@ export function scheduleLabel(schedule: ScheduledTaskSchedule, timeZone?: string
194 : weekdays.length === 5 && weekdays.every((day) => day >= 1 && day <= 5)
195 ? "Weekdays"
196 : weekdays.map((day) => WEEKDAY_LABELS[day]).join(", ");
201 - const zone = scheduleTimeZoneLabel(timeZone);
202 - return `${days} at ${schedule.timeOfDay}${zone === undefined ? "" : ` ${zone}`}`;
197 + return `${days} at ${schedule.timeOfDay}`;
198 }
199
200 /**
@@ -369,7 +364,6 @@ function ScheduledTaskEnvironmentList({
364 return {
365 environment,
366 connected: index >= 0,
372 - timeZone: data?.timeZone,
367 tasks: data?.tasks.filter((task) =>
368 matchesScheduledTaskScope(scope, environment.environmentId, task.projectId),
369 ),
@@ -411,7 +405,7 @@ function ScheduledTaskEnvironmentList({
405
406 return (
407 <SettingsGroup>
414 - {populated.map(({ environment, tasks, timeZone }) => {
408 + {populated.map(({ environment, tasks }) => {
409 const { primary, secondary } = settingsScopeEnvironmentLabels(environment, environments);
410 const transport = environmentTransportLabel(environment);
411 return (
@@ -441,7 +435,6 @@ function ScheduledTaskEnvironmentList({
435 key={task.id}
436 environmentId={environment.environmentId}
437 task={task}
444 - timeZone={timeZone}
438 onEdit={() => onEdit(environment.environmentId, task)}
439 />
440 ))}
@@ -557,7 +550,6 @@ function ScheduledTaskEnvironmentSection({
550 key={task.id}
551 environmentId={environment.environmentId}
552 task={task}
560 - timeZone={tasksQuery.data?.timeZone}
553 onEdit={() => onEdit(environment.environmentId, task)}
554 />
555 ))
@@ -571,12 +563,10 @@ function ScheduledTaskEnvironmentSection({
563 function ScheduledTaskRow({
564 environmentId,
565 task,
574 - timeZone,
566 onEdit,
567 }: {
568 readonly environmentId: EnvironmentId;
569 readonly task: ScheduledTask;
579 - readonly timeZone: string | undefined;
570 readonly onEdit: () => void;
571 }) {
572 const canOperate = useAtomValue(
@@ -621,7 +611,7 @@ function ScheduledTaskRow({
611 status={
612 <div className="flex flex-wrap items-center gap-2">
613 <span>
624 - {scheduleLabel(task.schedule, timeZone)} ·{" "}
614 + {scheduleLabel(task.schedule)} ·{" "}
615 {!task.enabled ? (
616 "Paused"
617 ) : isWebhook ? (
@@ -1008,7 +998,6 @@ function ScheduledTaskEditorForm({
998 draft.editingId !== null &&
999 tasksQuery.data !== null &&
1000 !tasksQuery.data.tasks.some((entry) => entry.id === draft.editingId);
1011 - const runAtZone = scheduleTimeZoneLabel(tasksQuery.data?.timeZone);
1001 const liveTask = tasksQuery.data
1002 ? (tasksQuery.data.tasks.find((entry) => entry.id === draft.editingId) ?? null)
1003 : task;
@@ -1512,9 +1501,6 @@ function ScheduledTaskEditorForm({
1501 setDraft((current) => ({ ...current, timeOfDay: event.target.value }))
1502 }
1503 />
1515 - {runAtZone === undefined ? null : (
1516 - <span className="text-xs text-muted-foreground">{runAtZone}</span>
1517 - )}
1504 <span className="text-xs text-muted-foreground">on</span>
1505 </div>
1506 <ToggleGroup
packages/contracts/src/scheduledTask.ts
-2
@@ -196,8 +196,6 @@ export const ScheduledTaskListResult = Schema.Struct({
196 // Trigger types grow over time; a client must not lose the whole list over
197 // one task it cannot decode.
198 tasks: ForwardCompatibleArray(ScheduledTask),
199 - /** The server's IANA zone for fixed-time schedules. Absent from older servers. */
200 - timeZone: Schema.optional(TrimmedNonEmptyString),
199 });
200 export type ScheduledTaskListResult = typeof ScheduledTaskListResult.Type;
201