ui(cron): add advanced controls for run-if-due and routing (#31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
This commit is contained in:
Tak Hoffman
2026-03-02 07:24:33 -06:00
committed by GitHub
parent 127217612c
commit 254bb7ceee
10 changed files with 418 additions and 7 deletions

View File

@@ -137,6 +137,53 @@ describe("applyJobPatch", () => {
expect(job.delivery?.accountId).toBeUndefined();
});
it("persists agentTurn payload.lightContext updates when editing existing jobs", () => {
const job = createIsolatedAgentTurnJob("job-light-context", {
mode: "announce",
channel: "telegram",
});
job.payload = {
kind: "agentTurn",
message: "do it",
lightContext: true,
};
applyJobPatch(job, {
payload: {
kind: "agentTurn",
message: "do it",
lightContext: false,
},
});
expect(job.payload.kind).toBe("agentTurn");
if (job.payload.kind === "agentTurn") {
expect(job.payload.lightContext).toBe(false);
}
});
it("applies payload.lightContext when replacing payload kind via patch", () => {
const job = createIsolatedAgentTurnJob("job-light-context-switch", {
mode: "announce",
channel: "telegram",
});
job.payload = { kind: "systemEvent", text: "ping" };
applyJobPatch(job, {
payload: {
kind: "agentTurn",
message: "do it",
lightContext: true,
},
});
const payload = job.payload as CronJob["payload"];
expect(payload.kind).toBe("agentTurn");
if (payload.kind === "agentTurn") {
expect(payload.lightContext).toBe(true);
}
});
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 cases = [