File tree Expand file tree Collapse file tree
packages/integrations/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,6 +501,56 @@ describe("integrations", () => {
501501 ) . rejects . toThrow ( ) ;
502502 } ) ;
503503
504+ it ( "defaults missing create_task priority and urgency to medium" , async ( ) => {
505+ const result = await planInboxItemWithResponses (
506+ {
507+ inboxItem : {
508+ id : "inbox-1" ,
509+ userId : "123" ,
510+ sourceEventId : "event-1" ,
511+ rawText : "Schedule a tax task" ,
512+ normalizedText : "Schedule a tax task" ,
513+ processingStatus : "received" ,
514+ linkedTaskIds : [ ] ,
515+ createdAt : "2026-03-13T08:00:00.000Z"
516+ } ,
517+ userProfile : buildDefaultUserProfile ( "123" ) ,
518+ tasks : [ ] ,
519+ scheduleBlocks : [ ] ,
520+ referenceTime : "2026-03-13T08:00:00.000Z"
521+ } ,
522+ {
523+ responses : {
524+ parse : async ( ) => ( {
525+ output_parsed : {
526+ confidence : 0.91 ,
527+ summary : "Create and schedule a tax task." ,
528+ actions : [
529+ {
530+ type : "create_task" ,
531+ alias : "new_task_1" ,
532+ title : "Submit taxes" ,
533+ priority : null ,
534+ urgency : null
535+ }
536+ ]
537+ }
538+ } )
539+ }
540+ }
541+ ) ;
542+
543+ expect ( result . actions ) . toEqual ( [
544+ {
545+ type : "create_task" ,
546+ alias : "new_task_1" ,
547+ title : "Submit taxes" ,
548+ priority : "medium" ,
549+ urgency : "medium"
550+ }
551+ ] ) ;
552+ } ) ;
553+
504554 it ( "parses structured turn routing output from the Responses API client" , async ( ) => {
505555 const result = await routeTurnWithResponses (
506556 {
Original file line number Diff line number Diff line change @@ -287,12 +287,19 @@ function normalizePlanningOutput(
287287 actions : output . actions . map ( ( action ) => {
288288 switch ( action . type ) {
289289 case "create_task" :
290+ if ( ! action . alias || ! action . title ) {
291+ return {
292+ type : "clarify" as const ,
293+ reason : "Model returned an incomplete create_task action."
294+ } ;
295+ }
296+
290297 return {
291298 type : action . type ,
292299 alias : action . alias ,
293300 title : action . title ,
294- priority : action . priority ,
295- urgency : action . urgency
301+ priority : action . priority ?? "medium" ,
302+ urgency : action . urgency ?? "medium"
296303 } ;
297304 case "create_schedule_block" :
298305 return {
You can’t perform that action at this time.
0 commit comments