Skip to content

Commit 0c9e8cc

Browse files
committed
fix(cron): allow null fallbacks in cron tool patch payload schema
1 parent 36a91ac commit 0c9e8cc

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/agents/tools/cron-tool.schema.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ describe("createCronToolSchema", () => {
224224
displayName: null,
225225
sessionKey: null,
226226
payload: {
227+
model: null,
227228
toolsAllow: null,
229+
fallbacks: null,
228230
},
229231
},
230232
}),
@@ -261,6 +263,8 @@ describe("createCronToolSchema", () => {
261263
expect(patchProps?.payload?.properties?.toolsAllow?.description).toMatch(/null to clear/i);
262264
expect(patchProps?.payload?.properties?.model?.type).toBe("string");
263265
expect(patchProps?.payload?.properties?.model?.description).toMatch(/null to clear/i);
266+
expect(patchProps?.payload?.properties?.fallbacks?.type).toBe("array");
267+
expect(patchProps?.payload?.properties?.fallbacks?.description).toMatch(/null to clear/i);
264268
});
265269

266270
it("projects nullable cron fields for Gemini models behind OpenAI-compatible providers", () => {
@@ -273,6 +277,9 @@ describe("createCronToolSchema", () => {
273277
expect(propertyAt(jjccGeminiSchemaRecord, "patch.payload.toolsAllow")).toMatchObject({
274278
type: "array",
275279
});
280+
expect(propertyAt(jjccGeminiSchemaRecord, "patch.payload.fallbacks")).toMatchObject({
281+
type: "array",
282+
});
276283
expect(propertyAt(jjccGeminiSchemaRecord, "patch.delivery.channel")).toMatchObject({
277284
type: "string",
278285
});

src/agents/tools/cron-tool.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ function failureDestinationModeSchema(params: { nullableClears: boolean }) {
109109
return Type.Optional(Type.Union(variants));
110110
}
111111

112-
function cronPayloadObjectSchema(params: { model: TSchema; toolsAllow: TSchema }) {
112+
function cronPayloadObjectSchema(params: {
113+
model: TSchema;
114+
toolsAllow: TSchema;
115+
fallbacks: TSchema;
116+
}) {
113117
return Type.Object(
114118
{
115119
kind: optionalStringEnum(CRON_PAYLOAD_KINDS, { description: "Payload kind" }),
@@ -120,7 +124,7 @@ function cronPayloadObjectSchema(params: { model: TSchema; toolsAllow: TSchema }
120124
timeoutSeconds: optionalFiniteNumberSchema({ minimum: 0 }),
121125
lightContext: Type.Optional(Type.Boolean()),
122126
allowUnsafeExternalContent: Type.Optional(Type.Boolean()),
123-
fallbacks: Type.Optional(Type.Array(Type.String(), { description: "Fallback models" })),
127+
fallbacks: params.fallbacks,
124128
toolsAllow: params.toolsAllow,
125129
},
126130
{ additionalProperties: true },
@@ -161,6 +165,7 @@ function createCronPayloadSchema(): TSchema {
161165
cronPayloadObjectSchema({
162166
model: Type.Optional(Type.String({ description: "Model override" })),
163167
toolsAllow: Type.Optional(Type.Array(Type.String(), { description: "Allowed tools" })),
168+
fallbacks: Type.Optional(Type.Array(Type.String(), { description: "Fallback models" })),
164169
}),
165170
);
166171
}
@@ -313,6 +318,7 @@ function createCronPatchObjectSchema(): TSchema {
313318
cronPayloadObjectSchema({
314319
model: nullableStringSchema("Model override, or null to clear"),
315320
toolsAllow: nullableStringArraySchema("Allowed tool ids, or null to clear"),
321+
fallbacks: nullableStringArraySchema("Fallback models, or null to clear"),
316322
}),
317323
),
318324
delivery: createCronDeliveryPatchSchema(),

0 commit comments

Comments
 (0)