@@ -1200,7 +1200,7 @@ describe("memory-core doctor dreaming migration", () => {
12001200 expect ( retryEntriesAfter ) . toEqual ( retryEntriesBefore ) ;
12011201 } ) ;
12021202
1203- it ( "leaves the legacy memory sidecar in place when canonical rows conflict " , async ( ) => {
1203+ it ( "keeps canonical rows and archives a conflicting derived legacy index " , async ( ) => {
12041204 const stateDir = path . join ( rootDir , "state" ) ;
12051205 const legacyPath = path . join ( stateDir , "memory" , "main.sqlite" ) ;
12061206 const agentPath = path . join ( stateDir , "agents" , "main" , "agent" , "openclaw-agent.sqlite" ) ;
@@ -1209,22 +1209,21 @@ describe("memory-core doctor dreaming migration", () => {
12091209
12101210 const result = await legacyMemoryIndexMigration ( ) . migrateLegacyState ( migrationParams ( ) ) ;
12111211
1212- expect ( result . warnings ) . toEqual ( [
1213- expect . stringContaining (
1214- "Skipped Memory Core legacy memory index import for agent main because legacy rows could not be imported: Error: legacy memory files rows conflict ",
1215- ) ,
1212+ expect ( result . warnings ) . toEqual ( [ ] ) ;
1213+ expect ( result . changes ) . toEqual ( [
1214+ "Resolved Memory Core legacy memory index conflict for agent main by keeping canonical per-agent SQLite rows",
1215+ expect . stringContaining ( "Archived Memory Core legacy memory index sidecar" ) ,
12161216 ] ) ;
1217- expect ( result . changes ) . toEqual ( [ ] ) ;
12181217 expect ( readMemoryRows ( agentPath ) ) . toEqual ( {
12191218 sources : [ { path : "MEMORY.md" , source : "memory" , hash : "canonical-file-hash" } ] ,
12201219 chunks : [ { id : "canonical-chunk" , text : "canonical memory remains authoritative" } ] ,
12211220 cache : [ ] ,
12221221 } ) ;
1223- await expect ( fs . access ( legacyPath ) ) . resolves . toBeUndefined ( ) ;
1224- await expect ( fs . access ( `${ legacyPath } .migrated` ) ) . rejects . toThrow ( ) ;
1222+ await expect ( fs . access ( legacyPath ) ) . rejects . toThrow ( ) ;
1223+ await expect ( fs . access ( `${ legacyPath } .migrated` ) ) . resolves . toBeUndefined ( ) ;
12251224 } ) ;
12261225
1227- it ( "copies conflicting custom sidecars to the canonical retry path " , async ( ) => {
1226+ it ( "archives conflicting custom derived indexes without creating a retry copy " , async ( ) => {
12281227 const stateDir = path . join ( rootDir , "state" ) ;
12291228 const legacyPath = path . join ( rootDir , "custom-memory" , "main.sqlite" ) ;
12301229 const retryPath = path . join ( stateDir , "memory" , "main.sqlite" ) ;
@@ -1255,19 +1254,14 @@ describe("memory-core doctor dreaming migration", () => {
12551254 ) ;
12561255
12571256 expect ( result . changes ) . toEqual ( [
1258- `Copied Memory Core legacy memory index sidecar retry path -> ${ retryPath } ` ,
1259- ] ) ;
1260- expect ( result . warnings ) . toEqual ( [
1261- expect . stringContaining (
1262- "Skipped Memory Core legacy memory index import for agent main because legacy rows could not be imported: Error: legacy memory files rows conflict" ,
1263- ) ,
1264- ] ) ;
1265- expect ( retryPreview ?. preview ) . toEqual ( [
1266- `- Memory Core legacy memory index: ${ retryPath } -> ${ agentPath } ` ,
1257+ "Resolved Memory Core legacy memory index conflict for agent main by keeping canonical per-agent SQLite rows" ,
1258+ expect . stringContaining ( "Archived Memory Core legacy memory index sidecar" ) ,
12671259 ] ) ;
1268- await expect ( fs . access ( legacyPath ) ) . resolves . toBeUndefined ( ) ;
1269- await expect ( fs . access ( retryPath ) ) . resolves . toBeUndefined ( ) ;
1270- await expect ( fs . access ( `${ legacyPath } .migrated` ) ) . rejects . toThrow ( ) ;
1260+ expect ( result . warnings ) . toEqual ( [ ] ) ;
1261+ expect ( retryPreview ) . toBeNull ( ) ;
1262+ await expect ( fs . access ( legacyPath ) ) . rejects . toThrow ( ) ;
1263+ await expect ( fs . access ( retryPath ) ) . rejects . toThrow ( ) ;
1264+ await expect ( fs . access ( `${ legacyPath } .migrated` ) ) . resolves . toBeUndefined ( ) ;
12711265 } ) ;
12721266
12731267 it ( "copies custom sidecars to the retry path when canonical database setup fails" , async ( ) => {
0 commit comments