66 setRuntimeConfigSnapshot ,
77} from "../config/runtime-snapshot.js" ;
88import type { OpenClawConfig } from "../config/types.openclaw.js" ;
9+ import { clearPluginMetadataLifecycleCaches } from "../plugins/plugin-metadata-lifecycle.js" ;
910import { captureEnv , withPathResolutionEnv } from "../test-utils/env.js" ;
1011import { createFixtureSuite } from "../test-utils/fixture-suite.js" ;
1112import { createTempHomeEnv , type TempHomeEnv } from "../test-utils/temp-home.js" ;
@@ -171,6 +172,7 @@ afterAll(async () => {
171172
172173afterEach ( ( ) => {
173174 clearRuntimeConfigSnapshot ( ) ;
175+ clearPluginMetadataLifecycleCaches ( ) ;
174176} ) ;
175177
176178describe ( "buildWorkspaceSkillCommandSpecs" , ( ) => {
@@ -286,8 +288,8 @@ describe("buildWorkspaceSkillCommandSpecs", () => {
286288 } ,
287289 } satisfies OpenClawConfig ;
288290
289- // Prime plugin discovery before the bundle exists so command loading proves
290- // it sees the current filesystem state instead of a stale cached snapshot .
291+ // Prime plugin discovery before the bundle exists; clear the lifecycle cache
292+ // below to model the install/reload boundary that exposes new plugin files .
291293 buildWorkspaceSkillCommandSpecs ( workspaceDir , {
292294 ...resolveTestSkillDirs ( workspaceDir ) ,
293295 config,
@@ -313,6 +315,7 @@ describe("buildWorkspaceSkillCommandSpecs", () => {
313315 ] . join ( "\n" ) ,
314316 "utf-8" ,
315317 ) ;
318+ clearPluginMetadataLifecycleCaches ( ) ;
316319
317320 const commands = buildWorkspaceSkillCommandSpecs ( workspaceDir , {
318321 ...resolveTestSkillDirs ( workspaceDir ) ,
0 commit comments