cron: separate webhook POST delivery from announce (#17901)

* cron: split webhook delivery from announce mode

* cron: validate webhook delivery target

* cron: remove legacy webhook fallback config

* fix: finalize cron webhook delivery prep (#17901) (thanks @advaitpaliwal)

---------

Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
This commit is contained in:
Advait Paliwal
2026-02-16 02:36:00 -08:00
committed by GitHub
parent d841c9b26b
commit bc67af6ad8
33 changed files with 698 additions and 236 deletions

View File

@@ -67,24 +67,51 @@ export const CronPayloadPatchSchema = Type.Union([
cronAgentTurnPayloadSchema({ message: Type.Optional(NonEmptyString) }),
]);
const CronDeliveryBaseProperties = {
const CronDeliverySharedProperties = {
channel: Type.Optional(Type.Union([Type.Literal("last"), NonEmptyString])),
to: Type.Optional(Type.String()),
bestEffort: Type.Optional(Type.Boolean()),
};
export const CronDeliverySchema = Type.Object(
const CronDeliveryNoopSchema = Type.Object(
{
mode: Type.Union([Type.Literal("none"), Type.Literal("announce")]),
...CronDeliveryBaseProperties,
mode: Type.Literal("none"),
...CronDeliverySharedProperties,
to: Type.Optional(Type.String()),
},
{ additionalProperties: false },
);
const CronDeliveryAnnounceSchema = Type.Object(
{
mode: Type.Literal("announce"),
...CronDeliverySharedProperties,
to: Type.Optional(Type.String()),
},
{ additionalProperties: false },
);
const CronDeliveryWebhookSchema = Type.Object(
{
mode: Type.Literal("webhook"),
...CronDeliverySharedProperties,
to: NonEmptyString,
},
{ additionalProperties: false },
);
export const CronDeliverySchema = Type.Union([
CronDeliveryNoopSchema,
CronDeliveryAnnounceSchema,
CronDeliveryWebhookSchema,
]);
export const CronDeliveryPatchSchema = Type.Object(
{
mode: Type.Optional(Type.Union([Type.Literal("none"), Type.Literal("announce")])),
...CronDeliveryBaseProperties,
mode: Type.Optional(
Type.Union([Type.Literal("none"), Type.Literal("announce"), Type.Literal("webhook")]),
),
...CronDeliverySharedProperties,
to: Type.Optional(Type.String()),
},
{ additionalProperties: false },
);
@@ -111,7 +138,6 @@ export const CronJobSchema = Type.Object(
name: NonEmptyString,
description: Type.Optional(Type.String()),
enabled: Type.Boolean(),
notify: Type.Optional(Type.Boolean()),
deleteAfterRun: Type.Optional(Type.Boolean()),
createdAtMs: Type.Integer({ minimum: 0 }),
updatedAtMs: Type.Integer({ minimum: 0 }),
@@ -140,7 +166,6 @@ export const CronAddParamsSchema = Type.Object(
agentId: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
description: Type.Optional(Type.String()),
enabled: Type.Optional(Type.Boolean()),
notify: Type.Optional(Type.Boolean()),
deleteAfterRun: Type.Optional(Type.Boolean()),
schedule: CronScheduleSchema,
sessionTarget: Type.Union([Type.Literal("main"), Type.Literal("isolated")]),
@@ -157,7 +182,6 @@ export const CronJobPatchSchema = Type.Object(
agentId: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
description: Type.Optional(Type.String()),
enabled: Type.Optional(Type.Boolean()),
notify: Type.Optional(Type.Boolean()),
deleteAfterRun: Type.Optional(Type.Boolean()),
schedule: Type.Optional(CronScheduleSchema),
sessionTarget: Type.Optional(Type.Union([Type.Literal("main"), Type.Literal("isolated")])),