From 063fb963c5c33d099faa593d17e60e0a875430cd Mon Sep 17 00:00:00 2001 From: Thomas Mustier <6326440+tmustier@users.noreply.github.com> Date: Tue, 28 Jul 2026 07:40:26 +0100 Subject: [PATCH] fix(coding-agent): isolate autoload-disabled package test from real home directory (#7167) * fix(coding-agent): isolate autoload-disabled package test from real home directory The test asserted result.skills is exactly empty, but resolve() also scans ~/.agents/skills via getHomeDir(). On machines where that directory is populated the test failed; CI runners have no ~/.agents/skills, so it always passed there. Stub HOME to the temp dir with the same save/restore pattern used by neighbouring tests. * fix(coding-agent): use vi.stubEnv for home directory isolation Replaces the manual try/finally save/restore with vi.stubEnv plus vi.unstubAllEnvs in afterEach, shrinking the fix to two added lines. * fix(coding-agent): plant decoy user skill so the empty-skills assertion cannot pass vacuously With an empty sandbox, result.skills equal to [] could not distinguish the package skill being correctly excluded from skill resolution being broken entirely. A decoy skill in the stubbed HOME's .agents/skills proves scanning still works while the package skill stays excluded. * fix(coding-agent): simplify home isolation test --- packages/coding-agent/test/package-manager.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/coding-agent/test/package-manager.test.ts b/packages/coding-agent/test/package-manager.test.ts index 68cc0ec77..53eedf579 100644 --- a/packages/coding-agent/test/package-manager.test.ts +++ b/packages/coding-agent/test/package-manager.test.ts @@ -1702,6 +1702,7 @@ Content`, }); it("should resolve autoload-disabled package entries as positive-only without a global package", async () => { + vi.stubEnv("HOME", tempDir); const pkgDir = join(tempDir, "positive-only-pkg"); mkdirSync(join(pkgDir, "extensions"), { recursive: true }); mkdirSync(join(pkgDir, "skills", "foo"), { recursive: true });