From 52e73b13432b9b2fef682796699e0b111790a194 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 25 May 2026 17:59:32 +0300 Subject: [PATCH] test(agent/agentcontextconfig): isolate TestContextPartsFromDir from host HOME (#25649) ContextPartsFromDir scans ~/.coder/skills via DefaultSkillsDir. On machines with real skills installed, these leaked into test results. Set HOME/USERPROFILE to temp dirs on the parent test so subtests run in a clean environment. --- agent/agentcontextconfig/api_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/agentcontextconfig/api_test.go b/agent/agentcontextconfig/api_test.go index a04bd0e15c..78cd79024e 100644 --- a/agent/agentcontextconfig/api_test.go +++ b/agent/agentcontextconfig/api_test.go @@ -42,8 +42,11 @@ func writeSkillMetaFile(t *testing.T, dir, name, description string) string { return writeSkillMetaFileInRoot(t, filepath.Join(dir, ".agents", "skills"), name, description) } +//nolint:paralleltest,tparallel // Uses t.Setenv to isolate HOME. func TestContextPartsFromDir(t *testing.T) { - t.Parallel() + // Prevent ~/.coder/skills on the host from leaking into results. + t.Setenv("HOME", t.TempDir()) + t.Setenv("USERPROFILE", t.TempDir()) t.Run("ReturnsInstructionFilePart", func(t *testing.T) { t.Parallel()