@@ -316,7 +316,7 @@ describe("scheduleRestartSentinelWake", () => {
316316 expect ( mocks . resolveOutboundTarget ) . not . toHaveBeenCalled ( ) ;
317317 } ) ;
318318
319- it ( "falls back to the base session when the thread entry only has partial route metadata" , async ( ) => {
319+ it ( "merges base session routing into partial thread metadata" , async ( ) => {
320320 mocks . consumeRestartSentinel . mockResolvedValue ( {
321321 payload : {
322322 sessionKey : "agent:main:matrix:channel:!lowercased:example.org:thread:$thread-event" ,
@@ -329,14 +329,20 @@ describe("scheduleRestartSentinelWake", () => {
329329 mocks . loadSessionEntry
330330 . mockReturnValueOnce ( {
331331 cfg : { } ,
332- entry : { origin : { provider : "matrix" , threadId : "$thread-event" } } ,
332+ entry : {
333+ origin : { provider : "matrix" , accountId : "acct-thread" , threadId : "$thread-event" } ,
334+ } ,
333335 } )
334336 . mockReturnValueOnce ( {
335337 cfg : { } ,
336338 entry : { lastChannel : "matrix" , lastTo : "room:!MixedCase:example.org" } ,
337339 } ) ;
338340 mocks . deliveryContextFromSession
339- . mockReturnValueOnce ( { channel : "matrix" , threadId : "$thread-event" } )
341+ . mockReturnValueOnce ( {
342+ channel : "matrix" ,
343+ accountId : "acct-thread" ,
344+ threadId : "$thread-event" ,
345+ } )
340346 . mockReturnValueOnce ( { channel : "matrix" , to : "room:!MixedCase:example.org" } ) ;
341347 mocks . resolveOutboundTarget . mockReturnValue ( {
342348 ok : true as const ,
@@ -349,12 +355,14 @@ describe("scheduleRestartSentinelWake", () => {
349355 expect . objectContaining ( {
350356 channel : "matrix" ,
351357 to : "room:!MixedCase:example.org" ,
358+ accountId : "acct-thread" ,
352359 } ) ,
353360 ) ;
354361 expect ( mocks . deliverOutboundPayloads ) . toHaveBeenCalledWith (
355362 expect . objectContaining ( {
356363 channel : "matrix" ,
357364 to : "room:!MixedCase:example.org" ,
365+ accountId : "acct-thread" ,
358366 threadId : "$thread-event" ,
359367 } ) ,
360368 ) ;
0 commit comments