@@ -95,7 +95,7 @@ test("sessions.list discovers store targets at most once per agent", async () =>
9595 }
9696} ) ;
9797
98- test ( "startup prewarm fills session snapshot and title caches before the first list" , async ( ) => {
98+ test ( "startup prewarm fills the session snapshot before the first list" , async ( ) => {
9999 const { storePath } = await createSessionStoreDir ( ) ;
100100 const sessionKey = "agent:main:warm-cache" ;
101101 const sessionId = "warm-cache" ;
@@ -114,8 +114,6 @@ test("startup prewarm fills session snapshot and title caches before the first l
114114 sessionKey,
115115 storePath,
116116 } ) ;
117- const titleBatchSpy = vi . spyOn ( sessionAccessor , "readSessionTranscriptTitleProbeBatch" ) ;
118- const titlePageSpy = vi . spyOn ( sessionAccessor , "readSessionTranscriptMessageEventPage" ) ;
119117 let sidecar : ReturnType < typeof scheduleGatewayHandlerPrewarm > | undefined ;
120118 vi . useFakeTimers ( ) ;
121119 try {
@@ -145,10 +143,6 @@ test("startup prewarm fills session snapshot and title caches before the first l
145143 await vi . advanceTimersToNextTimerAsync ( ) ;
146144 await sessionPrewarm ;
147145 sidecar . stop ( ) ;
148- expect ( titleBatchSpy ) . toHaveBeenCalled ( ) ;
149- expect ( titlePageSpy ) . not . toHaveBeenCalled ( ) ;
150- titleBatchSpy . mockClear ( ) ;
151- titlePageSpy . mockClear ( ) ;
152146 vi . useRealTimers ( ) ;
153147 const cachedEntries = sessionAccessor . listSessionEntriesReadOnly ( {
154148 agentId : "main" ,
@@ -157,14 +151,17 @@ test("startup prewarm fills session snapshot and title caches before the first l
157151 storePath,
158152 } ) ;
159153
160- const result = await directSessionReq ( "sessions.list" , {
154+ const result = await directSessionReq < {
155+ sessions : Array < { derivedTitle ?: string ; key ?: string } > ;
156+ } > ( "sessions.list" , {
161157 ...LIST_PARAMS ,
162158 includeDerivedTitles : true ,
163159 } ) ;
164160
165161 expect ( result . ok ) . toBe ( true ) ;
166- expect ( titleBatchSpy ) . not . toHaveBeenCalled ( ) ;
167- expect ( titlePageSpy ) . not . toHaveBeenCalled ( ) ;
162+ expect ( result . payload ?. sessions ) . toContainEqual (
163+ expect . objectContaining ( { key : sessionKey , derivedTitle : "Warm title" } ) ,
164+ ) ;
168165 const afterListEntries = sessionAccessor . listSessionEntriesReadOnly ( {
169166 agentId : "main" ,
170167 clone : false ,
@@ -175,8 +172,6 @@ test("startup prewarm fills session snapshot and title caches before the first l
175172 } finally {
176173 sidecar ?. stop ( ) ;
177174 vi . useRealTimers ( ) ;
178- titleBatchSpy . mockRestore ( ) ;
179- titlePageSpy . mockRestore ( ) ;
180175 }
181176} ) ;
182177
0 commit comments