fix(skill): ignore unchanged missing-root probes

This commit is contained in:
Tianyi Cui
2026-07-29 21:12:01 +08:00
parent cf7f14948c
commit e9233123eb
2 changed files with 48 additions and 7 deletions
@@ -92,6 +92,31 @@ beforeEach(() => {
})
describe('skill-local watcher failures', () => {
it('ignores missing-path probes until the observed path actually changes', async () => {
const home = await tempDir('skill-watch-missing-stable')
const ctx = new Context()
await ctx.plugin(SkillService)
const fiber = await ctx.plugin(SkillLocal, {
dshHome: join(home, '.dsh'),
agentsHome: join(home, '.agents'),
watch: true,
watchPollIntervalMs: 10,
})
expect(await ctx.skills.snapshot()).toEqual({ skills: [], complete: true })
expect(watcherHarness.watchFiles).toHaveLength(2)
let invalidations = 0
ctx.on('skills/change', () => { invalidations += 1 })
for (const control of watcherHarness.watchFiles) {
control.listener({} as Stats, {} as Stats)
}
await settle()
expect(invalidations).toBe(0)
expect(watcherHarness.watchFiles).toHaveLength(2)
await fiber.dispose()
})
it('marks a startup failure incomplete and retries discovery without caching it', async () => {
const home = await tempDir('skill-watch-start-error')
const root = join(home, '.dsh/skills')