mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:48:26 +00:00
cron: infer payload kind for model-only update patches (openclaw#15664) thanks @rodrigouroz
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check (fails on current origin/main in src/memory/embedding-manager.test-harness.ts; unchanged by this PR) Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeCronJobCreate } from "./normalize.js";
|
||||
import { normalizeCronJobCreate, normalizeCronJobPatch } from "./normalize.js";
|
||||
|
||||
describe("normalizeCronJobCreate", () => {
|
||||
it("maps legacy payload.provider to payload.channel and strips provider", () => {
|
||||
@@ -293,3 +293,31 @@ describe("normalizeCronJobCreate", () => {
|
||||
expect(delivery.to).toBe("123");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizeCronJobPatch", () => {
|
||||
it("infers agentTurn kind for model-only payload patches", () => {
|
||||
const normalized = normalizeCronJobPatch({
|
||||
payload: {
|
||||
model: "anthropic/claude-sonnet-4-5",
|
||||
},
|
||||
}) as unknown as Record<string, unknown>;
|
||||
|
||||
const payload = normalized.payload as Record<string, unknown>;
|
||||
expect(payload.kind).toBe("agentTurn");
|
||||
expect(payload.model).toBe("anthropic/claude-sonnet-4-5");
|
||||
});
|
||||
|
||||
it("does not infer agentTurn kind for delivery-only legacy hints", () => {
|
||||
const normalized = normalizeCronJobPatch({
|
||||
payload: {
|
||||
channel: "telegram",
|
||||
to: "+15550001111",
|
||||
},
|
||||
}) as unknown as Record<string, unknown>;
|
||||
|
||||
const payload = normalized.payload as Record<string, unknown>;
|
||||
expect(payload.kind).toBeUndefined();
|
||||
expect(payload.channel).toBe("telegram");
|
||||
expect(payload.to).toBe("+15550001111");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user