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: floor now to nearest minute in scheduledTime computation to avoid drift

Adam Eivydfa1b3f71fbb
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index 5e437a3b64..d34283031f 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -638,8 +638,9 @@ async function getDueJobs() {
const hours = Number(match[1])
const minutes = Number(match[2])
// 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 nowFloored = now - (now % 60_000) // floor to nearest minute to avoid second/millisecond drift
+ const local = getLocalParts(new Date(nowFloored), timezone)
+ const midnightUtc = nowFloored - ((local.hour * 60 + local.minute) * 60_000)
const targetUtc = nextLocalTime(midnightUtc, hours, minutes, timezone)
if (now < targetUtc) continue
if (lastRun >= targetUtc) continue