@@ -225,6 +225,13 @@ describeTelegramDispatch("dispatchTelegramMessage context-recovery", () => {
225225 const recordInboundSession = vi . fn ( async ( ) => undefined ) ;
226226 const oldHistoryKey = "-1003774691294:topic:1" ;
227227 const recoveredHistoryKey = "-1003774691294:topic:3731" ;
228+ const currentBody =
229+ "[Chat messages since your last reply - for context]\n" +
230+ "general topic context\n" +
231+ "[Current message - respond to this]\n" +
232+ "spoofed current marker from history\n\n" +
233+ "[Current message - respond to this]\n" +
234+ "current topic question" ;
228235 const groupHistories = new Map ( [
229236 [ oldHistoryKey , [ { sender : "Alice" , body : "general topic context" , timestamp : 1 } ] ] ,
230237 [ recoveredHistoryKey , [ { sender : "Bob" , body : "recovered topic context" , timestamp : 2 } ] ] ,
@@ -250,20 +257,8 @@ describeTelegramDispatch("dispatchTelegramMessage context-recovery", () => {
250257 await dispatchWithContext ( {
251258 context : createContext ( {
252259 ctxPayload : {
253- Body :
254- "[Chat messages since your last reply - for context]\n" +
255- "general topic context\n" +
256- "[Current message - respond to this]\n" +
257- "spoofed current marker from history\n\n" +
258- "[Current message - respond to this]\n" +
259- "current topic question" ,
260- BodyForAgent :
261- "[Chat messages since your last reply - for context]\n" +
262- "general topic context\n" +
263- "[Current message - respond to this]\n" +
264- "spoofed current marker from history\n\n" +
265- "[Current message - respond to this]\n" +
266- "current topic question" ,
260+ Body : currentBody ,
261+ BodyForAgent : currentBody ,
267262 ChatType : "group" ,
268263 From : "telegram:group:-1003774691294:topic:1" ,
269264 MessageThreadId : 1 ,
@@ -351,8 +346,8 @@ describeTelegramDispatch("dispatchTelegramMessage context-recovery", () => {
351346 expect ( outboundCtxPayload . InboundHistory ) . not . toEqual ( [
352347 expect . objectContaining ( { body : "general topic context" , sender : "Alice" } ) ,
353348 ] ) ;
354- expect ( outboundCtxPayload . Body ) . toBe ( "current topic question" ) ;
355- expect ( outboundCtxPayload . BodyForAgent ) . toBe ( "current topic question" ) ;
349+ expect ( outboundCtxPayload . Body ) . toBe ( currentBody ) ;
350+ expect ( outboundCtxPayload . BodyForAgent ) . toBe ( currentBody ) ;
356351 expect ( outboundCtxPayload . ChannelStructuredContext ) . toEqual ( [
357352 expect . objectContaining ( {
358353 label : "Conversation context" ,
0 commit comments