@@ -167,21 +167,12 @@ function buildRoutedTurn(input: {
167167 policy : {
168168 action : input . action ,
169169 reason : "test" ,
170- requiresWrite :
171- input . action === "execute_mutation" ||
172- input . action === "recover_and_execute" ,
170+ requiresWrite : input . action === "execute_mutation" ,
173171 requiresConfirmation : input . action === "present_proposal" ,
174- useMutationPipeline :
175- input . action === "execute_mutation" ||
176- input . action === "recover_and_execute" ,
172+ useMutationPipeline : input . action === "execute_mutation" ,
177173 ...( input . resolvedProposalId
178174 ? { targetProposalId : input . resolvedProposalId }
179175 : { } ) ,
180- ...( input . action === "recover_and_execute"
181- ? { mutationInputSource : "recovered_proposal" as const }
182- : input . action === "execute_mutation"
183- ? { mutationInputSource : "direct_user_turn" as const }
184- : { } ) ,
185176 ...( input . clarificationSlots
186177 ? { clarificationSlots : input . clarificationSlots }
187178 : { } ) ,
@@ -247,15 +238,6 @@ async function seedOutstandingFollowUpBundle(titles: string[]) {
247238 await store . saveTaskCaptureResult ( {
248239 inboxItemId : "inbox-seed" ,
249240 confidence : 1 ,
250- plannerRun : {
251- id : "ignored" ,
252- userId : "123" ,
253- inboxItemId : "inbox-seed" ,
254- version : "test" ,
255- modelInput : { } ,
256- modelOutput : { } ,
257- confidence : 1 ,
258- } as never ,
259241 tasks : titles . map ( ( title , index ) => ( {
260242 alias : `task_${ index + 1 } ` ,
261243 task : {
@@ -545,7 +527,7 @@ describe("telegram webhook route", () => {
545527 expect ( response . status ) . toBe ( 200 ) ;
546528 expect (
547529 ( response . body as { processing : { outcome : string } } ) . processing . outcome ,
548- ) . toBe ( "completed_tasks " ) ;
530+ ) . toBe ( "completed " ) ;
549531 expect ( listTasksForTests ( ) [ 0 ] ) . toMatchObject ( {
550532 lifecycleState : "done" ,
551533 } ) ;
@@ -576,7 +558,7 @@ describe("telegram webhook route", () => {
576558 expect ( response . status ) . toBe ( 200 ) ;
577559 expect (
578560 ( response . body as { processing : { outcome : string } } ) . processing . outcome ,
579- ) . toBe ( "completed_tasks " ) ;
561+ ) . toBe ( "completed " ) ;
580562 expect (
581563 listTasksForTests ( ) . find ( ( task ) => task . id === taskIds [ 0 ] ) ,
582564 ) . toMatchObject ( {
@@ -614,7 +596,7 @@ describe("telegram webhook route", () => {
614596 expect ( response . status ) . toBe ( 200 ) ;
615597 expect (
616598 ( response . body as { processing : { outcome : string } } ) . processing . outcome ,
617- ) . toBe ( "archived_tasks " ) ;
599+ ) . toBe ( "archived " ) ;
618600 expect (
619601 listTasksForTests ( ) . find ( ( task ) => task . id === taskIds [ 0 ] ) ,
620602 ) . toMatchObject ( {
@@ -1215,7 +1197,7 @@ describe("telegram webhook route", () => {
12151197 turnRouter : async ( ) =>
12161198 buildRoutedTurn ( {
12171199 turnType : "confirmation" ,
1218- action : "recover_and_execute " ,
1200+ action : "execute_mutation " ,
12191201 resolvedProposalId : "proposal-1" ,
12201202 resolvedOperation : {
12211203 operationKind : "plan" ,
@@ -1236,7 +1218,7 @@ describe("telegram webhook route", () => {
12361218 expect ( response . status ) . toBe ( 200 ) ;
12371219 expect ( response . body ) . toMatchObject ( {
12381220 accepted : true ,
1239- turnRoute : "confirmed_mutation " ,
1221+ turnRoute : "mutation " ,
12401222 processing : {
12411223 outcome : "planned" ,
12421224 } ,
@@ -1364,34 +1346,34 @@ describe("telegram webhook route", () => {
13641346 turnRouter : async ( ) =>
13651347 buildRoutedTurn ( {
13661348 turnType : "confirmation" ,
1367- action : "recover_and_execute " ,
1349+ action : "execute_mutation " ,
13681350 resolvedProposalId : "proposal-1" ,
1351+ resolvedOperation : {
1352+ operationKind : "reschedule" ,
1353+ targetRef : null ,
1354+ resolvedFields : {
1355+ scheduleFields : {
1356+ time : { kind : "absolute" , hour : 16 , minute : 0 } ,
1357+ } ,
1358+ } ,
1359+ missingFields : [ ] ,
1360+ originatingText :
1361+ "Move the scheduled review block 1 hour later" ,
1362+ startedAt : new Date ( ) . toISOString ( ) ,
1363+ } ,
13691364 } ) ,
13701365 } ,
13711366 ) ;
13721367
13731368 expect ( response . status ) . toBe ( 200 ) ;
13741369 expect ( response . body ) . toMatchObject ( {
13751370 accepted : true ,
1376- turnRoute : "confirmed_mutation " ,
1371+ turnRoute : "mutation " ,
13771372 processing : {
1378- outcome : "updated_schedule " ,
1373+ outcome : "needs_clarification " ,
13791374 } ,
13801375 } ) ;
1381- expect ( planner ) . toHaveBeenCalledWith (
1382- expect . objectContaining ( {
1383- inboxItem : expect . objectContaining ( {
1384- rawText : "Move the scheduled review block 1 hour later" ,
1385- } ) ,
1386- } ) ,
1387- ) ;
1388- expect ( editTelegramMessageMock ) . toHaveBeenCalledWith (
1389- expect . objectContaining ( {
1390- chatId : "999" ,
1391- messageId : 88 ,
1392- text : expect . stringContaining ( "Moved it to" ) ,
1393- } ) ,
1394- ) ;
1376+ expect ( planner ) . not . toHaveBeenCalled ( ) ;
13951377 } ) ;
13961378
13971379 it ( "completes a recent task from a confirmed mutation recovery turn" , async ( ) => {
@@ -1500,18 +1482,26 @@ describe("telegram webhook route", () => {
15001482 turnRouter : async ( ) =>
15011483 buildRoutedTurn ( {
15021484 turnType : "confirmation" ,
1503- action : "recover_and_execute " ,
1485+ action : "execute_mutation " ,
15041486 resolvedProposalId : "proposal-1" ,
1487+ resolvedOperation : {
1488+ operationKind : "complete" ,
1489+ targetRef : { entityId : undefined , description : "Journaling session" , entityKind : undefined } ,
1490+ resolvedFields : { } ,
1491+ missingFields : [ ] ,
1492+ originatingText : "Mark journaling as done" ,
1493+ startedAt : new Date ( ) . toISOString ( ) ,
1494+ } ,
15051495 } ) ,
15061496 } ,
15071497 ) ;
15081498
15091499 expect ( response . status ) . toBe ( 200 ) ;
15101500 expect ( response . body ) . toMatchObject ( {
15111501 accepted : true ,
1512- turnRoute : "confirmed_mutation " ,
1502+ turnRoute : "mutation " ,
15131503 processing : {
1514- outcome : "completed_tasks " ,
1504+ outcome : "completed " ,
15151505 } ,
15161506 } ) ;
15171507 expect ( listTasksForTests ( ) ) . toHaveLength ( 1 ) ;
@@ -1563,35 +1553,33 @@ describe("telegram webhook route", () => {
15631553 turnRouter : async ( ) =>
15641554 buildRoutedTurn ( {
15651555 turnType : "confirmation" ,
1566- action : "recover_and_execute " ,
1556+ action : "execute_mutation " ,
15671557 resolvedProposalId : "proposal-nonexistent" ,
1558+ // No resolvedOperation — simulates ambiguous/failed proposal rehydration
15681559 } ) ,
15691560 } ,
15701561 ) ;
15711562
15721563 expect ( response . status ) . toBe ( 200 ) ;
15731564 expect ( response . body ) . toMatchObject ( {
15741565 accepted : true ,
1575- turnRoute : "confirmed_mutation " ,
1566+ turnRoute : "mutation " ,
15761567 processing : {
1577- outcome : "conversation_replied" ,
1578- reply :
1579- "I need a bit more detail to proceed. What would you like me to schedule?" ,
1568+ outcome : "needs_clarification" ,
15801569 } ,
15811570 } ) ;
15821571 expect ( planner ) . not . toHaveBeenCalled ( ) ;
1583- expect ( listPlannerRunsForTests ( ) ) . toHaveLength ( 0 ) ;
15841572 expect ( listTasksForTests ( ) ) . toHaveLength ( 0 ) ;
15851573 expect ( listScheduleBlocksForTests ( ) ) . toHaveLength ( 0 ) ;
15861574 expect ( sendTelegramMessageMock ) . toHaveBeenCalledWith ( {
15871575 chatId : "999" ,
1588- text : "Applying that " ,
1576+ text : "Checking your schedule " ,
15891577 } ) ;
15901578 expect ( editTelegramMessageMock ) . toHaveBeenCalledWith (
15911579 expect . objectContaining ( {
15921580 chatId : "999" ,
15931581 messageId : 88 ,
1594- text : "I need a bit more detail to proceed. What would you like me to schedule? " ,
1582+ text : "I need a bit more detail to proceed." ,
15951583 } ) ,
15961584 ) ;
15971585 } ) ;
0 commit comments