@@ -270,18 +270,21 @@ describe("session accessor file-backed seam", () => {
270270 it ( "cleans scoped lifecycle entries and unreferenced transcript artifacts" , async ( ) => {
271271 const nowMs = Date . now ( ) ;
272272 const oldDate = new Date ( nowMs - 600_000 ) ;
273- const removedTranscriptPath = path . join ( tempDir , "removed-lifecycle.jsonl" ) ;
274- const customTranscriptPath = path . join ( tempDir , "custom-lifecycle-old.jsonl" ) ;
275- const freshDefaultTranscriptPath = path . join ( tempDir , "custom-lifecycle.jsonl" ) ;
276- const freshTranscriptPath = path . join ( tempDir , "fresh-lifecycle.jsonl" ) ;
277- const referencedTranscriptPath = path . join ( tempDir , "referenced.jsonl" ) ;
278- const orphanTranscriptPath = path . join ( tempDir , "orphan-lifecycle.jsonl" ) ;
279- const siblingDir = `${ tempDir } -sibling-sessions` ;
273+ const lifecycleSessionsDir = path . join ( tempDir , "state" , "agents" , "main" , "sessions" ) ;
274+ const lifecycleStorePath = path . join ( lifecycleSessionsDir , "sessions.json" ) ;
275+ const removedTranscriptPath = path . join ( lifecycleSessionsDir , "removed-lifecycle.jsonl" ) ;
276+ const customTranscriptPath = path . join ( lifecycleSessionsDir , "custom-lifecycle-old.jsonl" ) ;
277+ const freshDefaultTranscriptPath = path . join ( lifecycleSessionsDir , "custom-lifecycle.jsonl" ) ;
278+ const freshTranscriptPath = path . join ( lifecycleSessionsDir , "fresh-lifecycle.jsonl" ) ;
279+ const referencedTranscriptPath = path . join ( lifecycleSessionsDir , "referenced.jsonl" ) ;
280+ const orphanTranscriptPath = path . join ( lifecycleSessionsDir , "orphan-lifecycle.jsonl" ) ;
281+ const siblingDir = path . join ( tempDir , "state" , "agents" , "sibling" , "sessions" ) ;
280282 const siblingTranscriptPath = path . join ( siblingDir , "sibling-lifecycle.jsonl" ) ;
283+ fs . mkdirSync ( lifecycleSessionsDir , { recursive : true } ) ;
281284 fs . mkdirSync ( siblingDir , { recursive : true } ) ;
282285
283286 fs . writeFileSync (
284- storePath ,
287+ lifecycleStorePath ,
285288 JSON . stringify ( {
286289 "agent:main:lifecycle-cleanup-removed" : {
287290 sessionId : "removed-lifecycle" ,
@@ -324,22 +327,22 @@ describe("session accessor file-backed seam", () => {
324327 fs . utimesSync ( orphanTranscriptPath , oldDate , oldDate ) ;
325328
326329 const result = await cleanupSessionLifecycleArtifacts ( {
327- storePath,
330+ storePath : lifecycleStorePath ,
328331 sessionKeySegmentPrefix : "lifecycle-cleanup-" ,
329332 transcriptContentMarker : "lifecycle-marker-" ,
330333 orphanTranscriptMinAgeMs : 300_000 ,
331334 nowMs,
332335 } ) ;
333336
334337 expect ( result ) . toEqual ( { removedEntries : 3 , archivedTranscriptArtifacts : 3 } ) ;
335- const loaded = loadSessionStore ( storePath , { skipCache : true } ) ;
338+ const loaded = loadSessionStore ( lifecycleStorePath , { skipCache : true } ) ;
336339 expect ( loaded ) . not . toHaveProperty ( "agent:main:lifecycle-cleanup-removed" ) ;
337340 expect ( loaded ) . not . toHaveProperty ( "agent:main:lifecycle-cleanup-custom" ) ;
338341 expect ( loaded ) . not . toHaveProperty ( "agent:main:lifecycle-cleanup-sibling" ) ;
339342 expect ( loaded ) . toHaveProperty ( "agent:main:lifecycle-cleanup-fresh" ) ;
340343 expect ( loaded ) . toHaveProperty ( "agent:main:telegram:group:lifecycle-cleanup-room" ) ;
341344 expect ( loaded ) . toHaveProperty ( "agent:main:regular" ) ;
342- const files = fs . readdirSync ( tempDir ) ;
345+ const files = fs . readdirSync ( lifecycleSessionsDir ) ;
343346 expect (
344347 files . filter ( ( file ) => file . startsWith ( "removed-lifecycle.jsonl.deleted." ) ) ,
345348 ) . toHaveLength ( 1 ) ;
0 commit comments