Skip to content

Commit 6ad3eea

Browse files
committed
Auto-merge upstream openclaw/openclaw
2 parents e8fa108 + 2f130c4 commit 6ad3eea

3 files changed

Lines changed: 82 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai
2929
- Fireworks/FirePass: disable Kimi K2.5 Turbo reasoning output by forcing thinking off on the FirePass path and hardening the provider wrapper so hidden reasoning no longer leaks into visible replies. (#63607) Thanks @frankekn.
3030
- Sessions/model selection: preserve catalog-backed session model labels and keep already-qualified session model refs stable when catalog metadata is unavailable, so Control UI model selection survives reloads without bogus provider-prefixed values. (#61382) Thanks @Mule-ME.
3131
- Gateway/startup: keep WebSocket RPC available while channels and plugin sidecars start, hold `chat.history` unavailable until startup sidecars finish so synchronous history reads cannot stall startup (reported in #63450), refresh advertised gateway methods after deferred plugin reloads, and enforce the pre-auth WebSocket upgrade budget before the no-handler 503 path so upgrade floods cannot bypass connection limits during that window. (#63480) Thanks @neeravmakwana.
32+
- Dreaming/cron: reconcile managed dreaming cron from the resolved gateway startup config so boot-time schedule recovery respects the configured cadence and timezone. (#63873) Thanks @mbelinky.
3233
- Gateway/tailscale: start Tailscale exposure and the gateway update check before awaiting channel and plugin sidecar startup so remote operators are not locked out when startup sidecars stall.
3334
- QQBot/streaming: make block streaming configurable per QQ bot account via `streaming.mode` (`"partial"` | `"off"`, default `"partial"`) instead of hardcoding it off, so responses can be delivered incrementally. (#63746)
3435
- Dreaming/gateway: require `operator.admin` for persistent `/dreaming on|off` changes and treat missing gateway client scopes as unprivileged instead of silently allowing config writes. (#63872) Thanks @mbelinky.

extensions/memory-core/src/dreaming.test.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import fs from "node:fs/promises";
22
import path from "node:path";
33
import type { OpenClawConfig } from "openclaw/plugin-sdk/memory-core";
44
import { describe, expect, it, vi } from "vitest";
5+
import {
6+
clearInternalHooks,
7+
createInternalHookEvent,
8+
registerInternalHook,
9+
triggerInternalHook,
10+
} from "../../../src/hooks/internal-hooks.js";
511
import {
612
__testing,
713
reconcileShortTermDreamingCronJob,
14+
registerShortTermPromotionDreaming,
815
resolveShortTermPromotionDreamingConfig,
916
runShortTermDreamingPromotionIfTriggered,
1017
} from "./dreaming.js";
@@ -661,6 +668,63 @@ describe("short-term dreaming cron reconciliation", () => {
661668
});
662669
});
663670

671+
describe("gateway startup reconciliation", () => {
672+
it("uses the startup cfg when reconciling the managed dreaming cron job", async () => {
673+
clearInternalHooks();
674+
const logger = createLogger();
675+
const harness = createCronHarness();
676+
const api = {
677+
config: { plugins: { entries: {} } },
678+
pluginConfig: {},
679+
logger,
680+
runtime: {},
681+
registerHook: (event: string, handler: Parameters<typeof registerInternalHook>[1]) => {
682+
registerInternalHook(event, handler);
683+
},
684+
on: vi.fn(),
685+
} as never;
686+
687+
try {
688+
registerShortTermPromotionDreaming(api);
689+
await triggerInternalHook(
690+
createInternalHookEvent("gateway", "startup", "gateway:startup", {
691+
cfg: {
692+
hooks: { internal: { enabled: true } },
693+
plugins: {
694+
entries: {
695+
"memory-core": {
696+
config: {
697+
dreaming: {
698+
enabled: true,
699+
frequency: "15 4 * * *",
700+
timezone: "UTC",
701+
},
702+
},
703+
},
704+
},
705+
},
706+
} as OpenClawConfig,
707+
deps: { cron: harness.cron },
708+
}),
709+
);
710+
711+
expect(harness.addCalls).toHaveLength(1);
712+
expect(harness.addCalls[0]).toMatchObject({
713+
schedule: {
714+
kind: "cron",
715+
expr: "15 4 * * *",
716+
tz: "UTC",
717+
},
718+
});
719+
expect(logger.info).toHaveBeenCalledWith(
720+
expect.stringContaining("created managed dreaming cron job"),
721+
);
722+
} finally {
723+
clearInternalHooks();
724+
}
725+
});
726+
});
727+
664728
describe("short-term dreaming trigger", () => {
665729
it("applies promotions when the managed dreaming heartbeat event fires", async () => {
666730
const logger = createLogger();

extensions/memory-core/src/dreaming.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ function resolveCronServiceFromStartupEvent(event: unknown): CronServiceLike | n
307307
return cron as CronServiceLike;
308308
}
309309

310+
function resolveStartupConfigFromEvent(event: unknown, fallback: OpenClawConfig): OpenClawConfig {
311+
const startupEvent = asRecord(event);
312+
const startupContext = asRecord(startupEvent?.context);
313+
const startupCfg = asRecord(startupContext?.cfg);
314+
if (!startupCfg) {
315+
return fallback;
316+
}
317+
return startupCfg as OpenClawConfig;
318+
}
319+
310320
export function resolveShortTermPromotionDreamingConfig(params: {
311321
pluginConfig?: Record<string, unknown>;
312322
cfg?: OpenClawConfig;
@@ -584,9 +594,14 @@ export function registerShortTermPromotionDreaming(api: OpenClawPluginApi): void
584594
"gateway:startup",
585595
async (event: unknown) => {
586596
try {
597+
// Use the resolved startup snapshot so cron reconciliation matches the boot config.
598+
const startupCfg = resolveStartupConfigFromEvent(event, api.config);
587599
const config = resolveShortTermPromotionDreamingConfig({
588-
pluginConfig: resolveMemoryCorePluginConfig(api.config) ?? api.pluginConfig,
589-
cfg: api.config,
600+
pluginConfig:
601+
resolveMemoryCorePluginConfig(startupCfg) ??
602+
resolveMemoryCorePluginConfig(api.config) ??
603+
api.pluginConfig,
604+
cfg: startupCfg,
590605
});
591606
const cron = resolveCronServiceFromStartupEvent(event);
592607
if (!cron && config.enabled) {

0 commit comments

Comments
 (0)