Merge aa31765544377db6849f077a68cfed072947e08c into 5e417b44e1540f528d2ae63e3e20229a902d1db2
This commit is contained in:
commit
15732f2ecb
@ -101,7 +101,8 @@ function coercePayload(payload: UnknownRecord) {
|
|||||||
typeof next.model === "string" ||
|
typeof next.model === "string" ||
|
||||||
typeof next.thinking === "string" ||
|
typeof next.thinking === "string" ||
|
||||||
typeof next.timeoutSeconds === "number" ||
|
typeof next.timeoutSeconds === "number" ||
|
||||||
typeof next.allowUnsafeExternalContent === "boolean";
|
typeof next.allowUnsafeExternalContent === "boolean" ||
|
||||||
|
Array.isArray(next.fallbacks);
|
||||||
if (hasMessage) {
|
if (hasMessage) {
|
||||||
next.kind = "agentTurn";
|
next.kind = "agentTurn";
|
||||||
} else if (hasText) {
|
} else if (hasText) {
|
||||||
|
|||||||
@ -214,6 +214,53 @@ describe("applyJobPatch", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("persists agentTurn payload.fallbacks updates when editing existing jobs", () => {
|
||||||
|
const job = createIsolatedAgentTurnJob("job-fallbacks", {
|
||||||
|
mode: "announce",
|
||||||
|
channel: "telegram",
|
||||||
|
});
|
||||||
|
job.payload = {
|
||||||
|
kind: "agentTurn",
|
||||||
|
message: "do it",
|
||||||
|
fallbacks: ["anthropic/claude-sonnet-4-6"],
|
||||||
|
};
|
||||||
|
|
||||||
|
applyJobPatch(job, {
|
||||||
|
payload: {
|
||||||
|
kind: "agentTurn",
|
||||||
|
message: "do it",
|
||||||
|
fallbacks: ["openai/gpt-4o", "anthropic/claude-haiku-4-5"],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(job.payload.kind).toBe("agentTurn");
|
||||||
|
if (job.payload.kind === "agentTurn") {
|
||||||
|
expect(job.payload.fallbacks).toEqual(["openai/gpt-4o", "anthropic/claude-haiku-4-5"]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies payload.fallbacks when replacing payload kind via patch", () => {
|
||||||
|
const job = createIsolatedAgentTurnJob("job-fallbacks-switch", {
|
||||||
|
mode: "announce",
|
||||||
|
channel: "telegram",
|
||||||
|
});
|
||||||
|
job.payload = { kind: "systemEvent", text: "ping" };
|
||||||
|
|
||||||
|
applyJobPatch(job, {
|
||||||
|
payload: {
|
||||||
|
kind: "agentTurn",
|
||||||
|
message: "do it",
|
||||||
|
fallbacks: ["anthropic/claude-sonnet-4-6"],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const payload = job.payload as CronJob["payload"];
|
||||||
|
expect(payload.kind).toBe("agentTurn");
|
||||||
|
if (payload.kind === "agentTurn") {
|
||||||
|
expect(payload.fallbacks).toEqual(["anthropic/claude-sonnet-4-6"]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it("rejects webhook delivery without a valid http(s) target URL", () => {
|
it("rejects webhook delivery without a valid http(s) target URL", () => {
|
||||||
const expectedError = "cron webhook delivery requires delivery.to to be a valid http(s) URL";
|
const expectedError = "cron webhook delivery requires delivery.to to be a valid http(s) URL";
|
||||||
const cases = [
|
const cases = [
|
||||||
|
|||||||
@ -704,6 +704,9 @@ function mergeCronPayload(existing: CronPayload, patch: CronPayloadPatch): CronP
|
|||||||
if (typeof patch.bestEffortDeliver === "boolean") {
|
if (typeof patch.bestEffortDeliver === "boolean") {
|
||||||
next.bestEffortDeliver = patch.bestEffortDeliver;
|
next.bestEffortDeliver = patch.bestEffortDeliver;
|
||||||
}
|
}
|
||||||
|
if (Array.isArray(patch.fallbacks)) {
|
||||||
|
next.fallbacks = patch.fallbacks;
|
||||||
|
}
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,6 +775,7 @@ function buildPayloadFromPatch(patch: CronPayloadPatch): CronPayload {
|
|||||||
channel: patch.channel,
|
channel: patch.channel,
|
||||||
to: patch.to,
|
to: patch.to,
|
||||||
bestEffortDeliver: patch.bestEffortDeliver,
|
bestEffortDeliver: patch.bestEffortDeliver,
|
||||||
|
fallbacks: patch.fallbacks,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user