Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: refresh schedule status after cadence updates

[._.]/ Adam Eivy2ee152cd0a18
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index 746a48aad0..3cc19c057f 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -12,7 +12,7 @@ import TaskConfigDrawer from './schedule/TaskConfigDrawer';
import MaintenanceRunForm from './schedule/MaintenanceRunForm';
import { TASK_FILTERS, DEFAULT_FILTER_ID, TASK_SORTS, DEFAULT_SORT_ID, suggestedOrderSteps } from './schedule/scheduleConstants';
-export function mergeUpdatedTaskInterval(schedule, taskType, interval) {
+export function mergeUpdatedTaskInterval(schedule, taskType, interval, status) {
if (!schedule) return schedule;
return {
...schedule,
@@ -21,6 +21,7 @@ export function mergeUpdatedTaskInterval(schedule, taskType, interval) {
[taskType]: {
...(schedule.tasks?.[taskType] || {}),
...interval,
+ ...(status !== undefined ? { status } : {}),
},
},
};
@@ -110,7 +111,7 @@ export default function ScheduleTab({ apps, providers, providersLoaded, activePr
// Apply the authoritative response before resolving so a rapid second edit
// reads the value that was just persisted instead of overwriting it from a
// stale render while a background refetch is still in flight.
- setSchedule(current => mergeUpdatedTaskInterval(current, taskType, result.interval));
+ setSchedule(current => mergeUpdatedTaskInterval(current, taskType, result.interval, result.status));
return true;
}, []);
diff --git a/client/src/components/cos/tabs/ScheduleTab.test.jsx b/client/src/components/cos/tabs/ScheduleTab.test.jsx
index 1a29d50f3d..21d2912f30 100644
--- a/client/src/components/cos/tabs/ScheduleTab.test.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.test.jsx
@@ -56,6 +56,29 @@ describe('mergeUpdatedTaskInterval', () => {
});
expect(schedule.tasks['plan-feature'].dataInputs).toEqual(['project-goals']);
});
+
+ it('replaces stale derived status when a mutation returns its post-write status', () => {
+ const status = {
+ shouldRun: false,
+ reason: 'cron-cooldown',
+ cronExpression: '0 3 * * 0,1,3,4,5,6',
+ nextRunAt: '2026-09-23T10:00:00.000Z',
+ };
+ const schedule = {
+ tasks: {
+ 'release-check': {
+ type: 'cron',
+ cronExpression: '0 3 * * 0-6',
+ status: { shouldRun: false, nextRunAt: '2026-09-22T10:00:00.000Z' },
+ },
+ },
+ };
+
+ expect(mergeUpdatedTaskInterval(schedule, 'release-check', {
+ type: 'cron',
+ cronExpression: status.cronExpression,
+ }, status).tasks['release-check'].status).toEqual(status);
+ });
});
describe('ScheduleTab on-demand feedback', () => {
diff --git a/server/routes/cosScheduleRoutes.js b/server/routes/cosScheduleRoutes.js
index 90fa875b73..6ed6456e45 100644
--- a/server/routes/cosScheduleRoutes.js
+++ b/server/routes/cosScheduleRoutes.js
@@ -244,12 +244,17 @@ router.put('/schedule/task/:taskType', asyncHandler(async (req, res) => {
if (settings.runAfter.length === 0) settings.runAfter = null;
}
const result = await taskSchedule.updateTaskInterval(taskType, settings);
+ // The persisted interval is only half of the response the Schedule page
+ // needs. `status.nextRunAt` is derived from the cron expression and the
+ // user's timezone, so return its post-write value instead of making the
+ // client keep the old countdown after a schedule edit.
+ const status = await taskSchedule.shouldRunTask(taskType);
await logCosScheduleUpdate({
target: taskType,
patch: settings,
source: { route: `${req.baseUrl}${req.route?.path ?? ''}`, method: req.method },
});
- res.json({ success: true, taskType, interval: result });
+ res.json({ success: true, taskType, interval: result, status });
}));
// GET /api/cos/schedule/due - Get all tasks that are due to run
diff --git a/server/routes/cosScheduleRoutes.test.js b/server/routes/cosScheduleRoutes.test.js
index d349951ad1..49c9a8e44e 100644
--- a/server/routes/cosScheduleRoutes.test.js
+++ b/server/routes/cosScheduleRoutes.test.js
@@ -177,6 +177,28 @@ describe('CoS Schedule Routes', () => {
expect(response.body.success).toBe(true);
});
+ it('returns the post-write readiness status for an updated schedule', async () => {
+ const status = {
+ shouldRun: false,
+ reason: 'cron-cooldown',
+ cronExpression: '0 3 * * 0,1,3,4,5,6',
+ nextRunAt: '2026-09-23T10:00:00.000Z',
+ };
+ taskSchedule.updateTaskInterval.mockResolvedValue({
+ type: 'cron',
+ cronExpression: status.cronExpression,
+ });
+ taskSchedule.shouldRunTask.mockResolvedValue(status);
+
+ const response = await request(app)
+ .put('/api/cos/schedule/task/release-check')
+ .send({ type: 'cron', cronExpression: status.cronExpression });
+
+ expect(response.status).toBe(200);
+ expect(response.body.status).toEqual(status);
+ expect(taskSchedule.shouldRunTask).toHaveBeenCalledWith('release-check');
+ });
+
it('should return 400 for invalid enabled type', async () => {
const response = await request(app)
.put('/api/cos/schedule/task/review')