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

address review: validate scheduledTime format in getNextDueJob and cos.js to prevent NaN

Adam Eivye9093fc85567
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index 29979433c3..d2b015b64d 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -1054,9 +1054,11 @@ async function getNextDueJob() {
// If job has scheduledTime, find next occurrence in user's timezone
if (job.scheduledTime) {
- const [hours, minutes] = job.scheduledTime.split(':').map(Number)
- const candidate = nextLocalTime(nextDue, hours, minutes, timezone)
- if (candidate > nextDue) nextDue = candidate
+ const match = String(job.scheduledTime).match(/^([01]\d|2[0-3]):([0-5]\d)$/)
+ if (match) {
+ const candidate = nextLocalTime(nextDue, Number(match[1]), Number(match[2]), timezone)
+ if (candidate > nextDue) nextDue = candidate
+ }
}
}
diff --git a/server/services/cos.js b/server/services/cos.js
index 2c54dadf18..d892154f0d 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -2607,8 +2607,10 @@ function computeNextJobFireTime(job, timezone) {
let nextDue = lastRun + job.intervalMs;
if (job.scheduledTime) {
- const [hours, minutes] = job.scheduledTime.split(':').map(Number);
- nextDue = nextLocalTime(nextDue, hours, minutes, timezone);
+ const match = String(job.scheduledTime).match(/^([01]\d|2[0-3]):([0-5]\d)$/);
+ if (match) {
+ nextDue = nextLocalTime(nextDue, Number(match[1]), Number(match[2]), timezone);
+ }
}
// If weekdaysOnly, skip to next weekday (using local day-of-week)