@@ -195,6 +195,42 @@ describe("normalizeCronJobCreate", () => {
195195 expectAnnounceDeliveryTarget ( delivery , { channel : "telegram" , to : "7200373102" } ) ;
196196 } ) ;
197197
198+ it ( "normalizes whitespace-only payload text to empty strings so validation rejects it" , ( ) => {
199+ const agentTurn = normalizeCronJobCreate ( {
200+ name : "blank agent turn" ,
201+ enabled : true ,
202+ schedule : { kind : "every" , everyMs : 60_000 } ,
203+ sessionTarget : "isolated" ,
204+ wakeMode : "now" ,
205+ payload : {
206+ kind : "agentTurn" ,
207+ message : " " ,
208+ } ,
209+ } ) as unknown as Record < string , unknown > ;
210+ expect ( agentTurn . payload ) . toEqual ( { kind : "agentTurn" , message : "" } ) ;
211+ expect ( validateCronAddParams ( agentTurn ) ) . toBe ( false ) ;
212+
213+ const systemEvent = normalizeCronJobCreate ( {
214+ name : "blank system event" ,
215+ enabled : true ,
216+ schedule : { kind : "every" , everyMs : 60_000 } ,
217+ sessionTarget : "main" ,
218+ wakeMode : "now" ,
219+ payload : {
220+ kind : "systemEvent" ,
221+ text : " " ,
222+ } ,
223+ } ) as unknown as Record < string , unknown > ;
224+ expect ( systemEvent . payload ) . toEqual ( { kind : "systemEvent" , text : "" } ) ;
225+ expect ( validateCronAddParams ( systemEvent ) ) . toBe ( false ) ;
226+
227+ const update = normalizeCronJobPatch ( {
228+ payload : { kind : "agentTurn" , message : " " } ,
229+ } ) as unknown as Record < string , unknown > ;
230+ expect ( update . payload ) . toEqual ( { kind : "agentTurn" , message : "" } ) ;
231+ expect ( validateCronUpdateParams ( { id : "job-1" , patch : update } ) ) . toBe ( false ) ;
232+ } ) ;
233+
198234 it ( "normalizes delivery accountId and strips blanks" , ( ) => {
199235 const normalized = normalizeIsolatedAgentTurnCreateJob ( {
200236 name : "delivery account" ,
0 commit comments