fix(memory-core): wake managed dreaming jobs immediately (#65053)

* fix(memory-core): wake managed dreaming jobs immediately

* docs(changelog): add dreaming wake entry

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
Daniel Alkurdi
2026-04-13 01:37:21 +10:00
committed by GitHub
parent d0f090e188
commit b8c95e5825
3 changed files with 12 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ Docs: https://docs.openclaw.ai
- Plugins/memory: restore cached memory capability public artifacts on plugin-registry cache hits so memory-backed artifact surfaces stay visible after warm loads. Thanks @sercada and @vincentkoc.
- Gateway/cron: preserve requested isolated-agent config across runtime reloads so subagent jobs and heartbeat overrides keep the right workspace and heartbeat settings when the hot-loaded snapshot is stale. Thanks @l0cka and @vincentkoc.
- Cron/isolated sessions: persist the right transcript path for each isolated run, including fresh session rollovers, so cron runs stop appending to stale session files. Thanks @samrusani and @vincentkoc.
- Dreaming/cron: wake managed dreaming jobs immediately instead of waiting for the next heartbeat, so scheduled dreaming runs start when the cron fires. (#65053) Thanks @l0cka and @vincentkoc.
## 2026.4.11

View File

@@ -415,7 +415,7 @@ describe("short-term dreaming cron reconciliation", () => {
expect(harness.addCalls[0]).toMatchObject({
name: constants.MANAGED_DREAMING_CRON_NAME,
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: {
kind: "systemEvent",
text: constants.DREAMING_SYSTEM_EVENT_TEXT,
@@ -488,6 +488,7 @@ describe("short-term dreaming cron reconciliation", () => {
id: "job-primary",
patch: {
enabled: true,
wakeMode: "now",
schedule: desired.schedule,
payload: desired.payload,
},
@@ -502,7 +503,7 @@ describe("short-term dreaming cron reconciliation", () => {
enabled: true,
schedule: { kind: "cron", expr: "0 3 * * *" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: { kind: "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
createdAtMs: 10,
};
@@ -548,7 +549,7 @@ describe("short-term dreaming cron reconciliation", () => {
enabled: true,
schedule: { kind: "cron", expr: "0 3 * * *" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: { kind: "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
createdAtMs: 10,
};
@@ -645,7 +646,7 @@ describe("short-term dreaming cron reconciliation", () => {
enabled: true,
schedule: { kind: "cron", expr: "0 3 * * *" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: { kind: "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
createdAtMs: 10,
};
@@ -679,7 +680,7 @@ describe("short-term dreaming cron reconciliation", () => {
enabled: true,
schedule: { kind: "cron", expr: "0 3 * * *" },
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: { kind: "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
createdAtMs: 10,
};

View File

@@ -47,7 +47,7 @@ type ManagedCronJobCreate = {
enabled: boolean;
schedule: CronSchedule;
sessionTarget: "main";
wakeMode: "next-heartbeat";
wakeMode: "now";
payload: CronPayload;
};
@@ -57,7 +57,7 @@ type ManagedCronJobPatch = {
enabled?: boolean;
schedule?: CronSchedule;
sessionTarget?: "main";
wakeMode?: "next-heartbeat";
wakeMode?: "now";
payload?: CronPayload;
};
@@ -154,7 +154,7 @@ function buildManagedDreamingCronJob(
...(config.timezone ? { tz: config.timezone } : {}),
},
sessionTarget: "main",
wakeMode: "next-heartbeat",
wakeMode: "now",
payload: {
kind: "systemEvent",
text: DREAMING_SYSTEM_EVENT_TEXT,
@@ -257,8 +257,8 @@ function buildManagedDreamingPatch(
patch.sessionTarget = "main";
}
const wakeMode = normalizeLowercaseStringOrEmpty(normalizeTrimmedString(job.wakeMode));
if (wakeMode !== "next-heartbeat") {
patch.wakeMode = "next-heartbeat";
if (wakeMode !== "now") {
patch.wakeMode = "now";
}
const payloadKind = normalizeLowercaseStringOrEmpty(normalizeTrimmedString(job.payload?.kind));