@@ -28,6 +28,7 @@ import {
2828 listWebPushSubscriptions ,
2929 readPersistedVapidKeyPair ,
3030} from "./push-web-store.js" ;
31+ import { readRestartSentinel } from "./restart-sentinel.js" ;
3132import {
3233 autoMigrateLegacyState ,
3334 autoMigrateLegacyPluginDoctorState ,
@@ -1729,7 +1730,7 @@ describe("state migrations", () => {
17291730 await expect ( fs . readFile ( `${ routingPath } .migrated` , "utf8" ) ) . resolves . toContain ( "robot wake" ) ;
17301731 } ) ;
17311732
1732- it ( "auto-migrates standalone legacy voice wake JSON settings" , async ( ) => {
1733+ it ( "auto-migrates standalone legacy JSON settings" , async ( ) => {
17331734 const root = await createTempDir ( ) ;
17341735 const stateDir = path . join ( root , ".openclaw" ) ;
17351736 const env = createEnv ( stateDir ) ;
@@ -1741,14 +1742,31 @@ describe("state migrations", () => {
17411742 JSON . stringify ( { triggers : [ "wake" ] } ) ,
17421743 "utf8" ,
17431744 ) ;
1745+ const expectedSentinel = {
1746+ kind : "update" as const ,
1747+ status : "ok" as const ,
1748+ ts : 321 ,
1749+ message : "Update completed" ,
1750+ } ;
1751+ const restartSentinelPath = path . join ( stateDir , "restart-sentinel.json" ) ;
1752+ await fs . writeFile (
1753+ restartSentinelPath ,
1754+ `${ JSON . stringify ( { version : 1 , payload : expectedSentinel } ) } \n` ,
1755+ "utf8" ,
1756+ ) ;
17441757
17451758 const result = await autoMigrateLegacyState ( { cfg, env, homedir : ( ) => root } ) ;
17461759
17471760 expect ( result . skipped ) . toBe ( false ) ;
17481761 expect ( result . migrated ) . toBe ( true ) ;
17491762 expect ( result . warnings ) . toStrictEqual ( [ ] ) ;
1763+ expect ( result . changes ) . toContain (
1764+ "Imported the legacy restart sentinel into shared SQLite state." ,
1765+ ) ;
17501766 await expect ( loadVoiceWakeConfig ( stateDir ) ) . resolves . toMatchObject ( { triggers : [ "wake" ] } ) ;
1767+ await expect ( readRestartSentinel ( env ) ) . resolves . toMatchObject ( { payload : expectedSentinel } ) ;
17511768 await expectMissingPath ( path . join ( settingsDir , "voicewake.json" ) ) ;
1769+ await expectMissingPath ( restartSentinelPath ) ;
17521770 } ) ;
17531771
17541772 it ( "runs plugin doctor migrations after repairing shared state schema" , async ( ) => {
0 commit comments