fix cron announce routing and timeout handling

This commit is contained in:
Tyler Yust
2026-02-17 11:40:04 -08:00
parent e1015a5197
commit 75001a0490
12 changed files with 298 additions and 43 deletions

View File

@@ -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()),

View File

@@ -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: {