mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 18:51:23 +00:00
fix cron announce routing and timeout handling
This commit is contained in:
@@ -8,7 +8,7 @@ function cronAgentTurnPayloadSchema(params: { message: TSchema }) {
|
||||
message: params.message,
|
||||
model: Type.Optional(Type.String()),
|
||||
thinking: Type.Optional(Type.String()),
|
||||
timeoutSeconds: Type.Optional(Type.Integer({ minimum: 1 })),
|
||||
timeoutSeconds: Type.Optional(Type.Integer({ minimum: 0 })),
|
||||
allowUnsafeExternalContent: Type.Optional(Type.Boolean()),
|
||||
deliver: Type.Optional(Type.Boolean()),
|
||||
channel: Type.Optional(Type.String()),
|
||||
|
||||
@@ -180,6 +180,26 @@ describe("gateway server cron", () => {
|
||||
const mergeJobId = typeof mergeJobIdValue === "string" ? mergeJobIdValue : "";
|
||||
expect(mergeJobId.length > 0).toBe(true);
|
||||
|
||||
const noTimeoutRes = await rpcReq(ws, "cron.add", {
|
||||
name: "no-timeout payload",
|
||||
enabled: true,
|
||||
schedule: { kind: "every", everyMs: 60_000 },
|
||||
sessionTarget: "isolated",
|
||||
wakeMode: "next-heartbeat",
|
||||
payload: { kind: "agentTurn", message: "hello", timeoutSeconds: 0 },
|
||||
});
|
||||
expect(noTimeoutRes.ok).toBe(true);
|
||||
const noTimeoutPayload = noTimeoutRes.payload as
|
||||
| {
|
||||
payload?: {
|
||||
kind?: unknown;
|
||||
timeoutSeconds?: unknown;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
expect(noTimeoutPayload?.payload?.kind).toBe("agentTurn");
|
||||
expect(noTimeoutPayload?.payload?.timeoutSeconds).toBe(0);
|
||||
|
||||
const mergeUpdateRes = await rpcReq(ws, "cron.update", {
|
||||
id: mergeJobId,
|
||||
patch: {
|
||||
|
||||
Reference in New Issue
Block a user