11import {
22 buildCapturedTask ,
33 type ConversationEntity ,
4- type InboxPlanningOutput ,
54 type PendingWriteOperation ,
65 type RoutedTurn ,
76 type TurnInterpretationType ,
@@ -44,7 +43,6 @@ const {
4443 classifyTurnWithResponsesMock,
4544 summarizeConversationMemoryWithResponsesMock,
4645 respondToConversationTurnWithResponsesMock,
47- recoverConfirmedMutationWithResponsesMock,
4846 interpretWriteTurnWithResponsesMock,
4947} = vi . hoisted ( ( ) => ( {
5048 editTelegramMessageMock : vi . fn ( ) ,
@@ -54,7 +52,6 @@ const {
5452 classifyTurnWithResponsesMock : vi . fn ( ) ,
5553 summarizeConversationMemoryWithResponsesMock : vi . fn ( ) ,
5654 respondToConversationTurnWithResponsesMock : vi . fn ( ) ,
57- recoverConfirmedMutationWithResponsesMock : vi . fn ( ) ,
5855 interpretWriteTurnWithResponsesMock : vi . fn ( ) ,
5956} ) ) ;
6057
@@ -66,41 +63,9 @@ vi.mock("@atlas/integrations", async () => {
6663 return {
6764 ...actual ,
6865 getDefaultCalendarAdapter : ( ) => actual . getDefaultCalendarAdapter ( ) ,
69- planInboxItemWithResponses : async ( ) => ( {
70- confidence : 0.9 ,
71- summary : "Captured and scheduled Review launch checklist." ,
72- actions : [
73- {
74- type : "create_task" ,
75- alias : "new_task_1" ,
76- title : "Review launch checklist" ,
77- priority : "medium" ,
78- urgency : "medium" ,
79- } ,
80- {
81- type : "create_schedule_block" ,
82- taskRef : {
83- kind : "created_task" ,
84- alias : "new_task_1" ,
85- } ,
86- scheduleConstraint : {
87- dayReference : null ,
88- weekday : null ,
89- weekOffset : null ,
90- explicitHour : 9 ,
91- minute : 0 ,
92- preferredWindow : null ,
93- sourceText : "default next slot" ,
94- } ,
95- reason : "Schedule the new task in the next slot." ,
96- } ,
97- ] ,
98- } ) ,
9966 editTelegramMessage : editTelegramMessageMock ,
10067 respondToConversationTurnWithResponses :
10168 respondToConversationTurnWithResponsesMock ,
102- recoverConfirmedMutationWithResponses :
103- recoverConfirmedMutationWithResponsesMock ,
10469 classifyTurnWithResponses : classifyTurnWithResponsesMock ,
10570 routeTurnWithResponses : routeTurnWithResponsesMock ,
10671 interpretWriteTurnWithResponses : interpretWriteTurnWithResponsesMock ,
@@ -349,7 +314,6 @@ beforeEach(async () => {
349314 classifyTurnWithResponsesMock . mockReset ( ) ;
350315 summarizeConversationMemoryWithResponsesMock . mockReset ( ) ;
351316 respondToConversationTurnWithResponsesMock . mockReset ( ) ;
352- recoverConfirmedMutationWithResponsesMock . mockReset ( ) ;
353317 interpretWriteTurnWithResponsesMock . mockReset ( ) ;
354318 interpretWriteTurnWithResponsesMock . mockResolvedValue ( {
355319 operationKind : "plan" ,
@@ -385,12 +349,6 @@ beforeEach(async () => {
385349 respondToConversationTurnWithResponsesMock . mockResolvedValue ( {
386350 reply : "Mocked conversation reply." ,
387351 } ) ;
388- recoverConfirmedMutationWithResponsesMock . mockResolvedValue ( {
389- outcome : "needs_clarification" ,
390- recoveredText : null ,
391- reason : "Mocked recovery fallback." ,
392- userReplyMessage : "Could you clarify what you want me to change?" ,
393- } ) ;
394352 sendTelegramMessageMock . mockResolvedValue ( {
395353 ok : true ,
396354 result : {
@@ -1147,38 +1105,6 @@ describe("telegram webhook route", () => {
11471105 missingFields : [ "time" ] ,
11481106 replyText : "Would you like me to schedule it at 3pm?" ,
11491107 } ) ;
1150- const planner = vi . fn (
1151- async ( ) : Promise < InboxPlanningOutput > => ( {
1152- confidence : 0.9 ,
1153- summary : "Scheduled the dentist reminder for 3pm." ,
1154- actions : [
1155- {
1156- type : "create_task" ,
1157- alias : "new_task_1" ,
1158- title : "Dentist reminder" ,
1159- priority : "medium" ,
1160- urgency : "medium" ,
1161- } ,
1162- {
1163- type : "create_schedule_block" ,
1164- taskRef : {
1165- kind : "created_task" ,
1166- alias : "new_task_1" ,
1167- } ,
1168- scheduleConstraint : {
1169- dayReference : null ,
1170- weekday : null ,
1171- weekOffset : null ,
1172- explicitHour : 15 ,
1173- minute : 0 ,
1174- preferredWindow : null ,
1175- sourceText : "at 3pm" ,
1176- } ,
1177- reason : "The user confirmed the proposed 3pm slot." ,
1178- } ,
1179- ] ,
1180- } ) ,
1181- ) ;
11821108
11831109 const response = await handleTelegramWebhook (
11841110 buildRequest ( {
@@ -1203,7 +1129,6 @@ describe("telegram webhook route", () => {
12031129 store : getDefaultInboxProcessingStore ( ) ,
12041130 calendar : getDefaultCalendarAdapter ( ) ,
12051131 primeProcessingStore : seedInboxItemForProcessingTests ,
1206- planner,
12071132 conversationMemorySummarizer : async ( ) => ( {
12081133 summary :
12091134 "The assistant proposed a concrete 3pm schedule and the user is now confirming it." ,
@@ -1237,7 +1162,6 @@ describe("telegram webhook route", () => {
12371162 outcome : "created" ,
12381163 } ,
12391164 } ) ;
1240- expect ( planner ) . not . toHaveBeenCalled ( ) ;
12411165 expect ( listTasksForTests ( ) ) . toHaveLength ( 1 ) ;
12421166 expect ( sendTelegramMessageMock ) . toHaveBeenCalledTimes ( 1 ) ;
12431167 expect ( sendTelegramMessageMock ) . toHaveBeenCalledWith ( {
@@ -1259,30 +1183,6 @@ describe("telegram webhook route", () => {
12591183 proposalId : "proposal-1" ,
12601184 originatingTurnText : "Move the scheduled review block 1 hour later" ,
12611185 } ) ;
1262- const planner = vi . fn (
1263- async ( ) : Promise < InboxPlanningOutput > => ( {
1264- confidence : 0.88 ,
1265- summary : "Moved the scheduled review block one hour later." ,
1266- actions : [
1267- {
1268- type : "move_schedule_block" ,
1269- blockRef : {
1270- alias : "schedule_block_1" ,
1271- } ,
1272- scheduleConstraint : {
1273- dayReference : null ,
1274- weekday : null ,
1275- weekOffset : null ,
1276- explicitHour : 16 ,
1277- minute : 0 ,
1278- preferredWindow : null ,
1279- sourceText : "1 hour later" ,
1280- } ,
1281- reason : "The user asked to push it 1 hour later." ,
1282- } ,
1283- ] ,
1284- } ) ,
1285- ) ;
12861186
12871187 seedInboxItemForProcessingTests ( {
12881188 id : "inbox-existing" ,
@@ -1344,7 +1244,6 @@ describe("telegram webhook route", () => {
13441244 store : getDefaultInboxProcessingStore ( ) ,
13451245 calendar : getDefaultCalendarAdapter ( ) ,
13461246 primeProcessingStore : seedInboxItemForProcessingTests ,
1347- planner,
13481247 conversationMemorySummarizer : async ( ) => ( {
13491248 summary :
13501249 "The recent exchange includes one concrete proposal to move the existing review block one hour later." ,
@@ -1379,13 +1278,11 @@ describe("telegram webhook route", () => {
13791278 outcome : "needs_clarification" ,
13801279 } ,
13811280 } ) ;
1382- expect ( planner ) . not . toHaveBeenCalled ( ) ;
13831281 } ) ;
13841282
13851283 it ( "completes a recent task from a confirmed mutation recovery turn" , async ( ) => {
13861284 process . env . TELEGRAM_WEBHOOK_SECRET = "test-webhook-secret" ;
13871285
1388- // Seed the task directly instead of relying on the old planner flow
13891286 const store = getDefaultInboxProcessingStore ( ) ;
13901287 seedInboxItemForProcessingTests ( {
13911288 id : "inbox-seed-journal" ,
@@ -1490,8 +1387,6 @@ describe("telegram webhook route", () => {
14901387
14911388 it ( "falls back to clarification when confirmed mutation recovery is ambiguous" , async ( ) => {
14921389 process . env . TELEGRAM_WEBHOOK_SECRET = "test-webhook-secret" ;
1493- const planner = vi . fn ( ) ;
1494-
14951390 const response = await handleTelegramWebhook (
14961391 buildRequest ( {
14971392 update_id : 55 ,
@@ -1514,7 +1409,6 @@ describe("telegram webhook route", () => {
15141409 {
15151410 store : getDefaultInboxProcessingStore ( ) ,
15161411 primeProcessingStore : seedInboxItemForProcessingTests ,
1517- planner,
15181412 conversationMemorySummarizer : async ( ) => ( {
15191413 summary : "There were multiple possible recent proposals." ,
15201414 } ) ,
@@ -1536,7 +1430,6 @@ describe("telegram webhook route", () => {
15361430 outcome : "needs_clarification" ,
15371431 } ,
15381432 } ) ;
1539- expect ( planner ) . not . toHaveBeenCalled ( ) ;
15401433 expect ( listTasksForTests ( ) ) . toHaveLength ( 0 ) ;
15411434 expect ( listScheduleBlocksForTests ( ) ) . toHaveLength ( 0 ) ;
15421435 expect ( sendTelegramMessageMock ) . toHaveBeenCalledWith ( {
0 commit comments