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: compute scheduledTime from local midnight to prevent premature job execution

Adam Eivye54967a79bec
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index c2cf1f4179..5e437a3b64 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -637,7 +637,10 @@ async function getDueJobs() {
if (!match) continue // skip jobs with invalid scheduledTime format
const hours = Number(match[1])
const minutes = Number(match[2])
- const targetUtc = nextLocalTime(now - DAY, hours, minutes, timezone)
+ // Compute today's scheduled UTC time from local midnight to avoid firing before scheduled time
+ const local = getLocalParts(new Date(now), timezone)
+ const midnightUtc = now - ((local.hour * 60 + local.minute) * 60_000)
+ const targetUtc = nextLocalTime(midnightUtc, hours, minutes, timezone)
if (now < targetUtc) continue
if (lastRun >= targetUtc) continue
}