From 28d11713dbd90ebda5e098f3198a0173309e23dd Mon Sep 17 00:00:00 2001 From: Chrys <53332481+ChrAlpha@users.noreply.github.com> Date: Fri, 17 Apr 2026 23:17:04 +0800 Subject: [PATCH] fix: preserve empty skill discovery roots (#384) --- internal/workspace/image_preference.go | 6 +++++- internal/workspace/image_preference_test.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/workspace/image_preference.go b/internal/workspace/image_preference.go index 5ffd6f12..6abc7e05 100644 --- a/internal/workspace/image_preference.go +++ b/internal/workspace/image_preference.go @@ -138,7 +138,11 @@ func workspaceSkillDiscoveryRootsFromMetadata(metadata map[string]any) ([]string return []string{}, true } - return normalizeWorkspaceSkillDiscoveryRoots(roots), true + normalized := normalizeWorkspaceSkillDiscoveryRoots(roots) + if normalized == nil { + return []string{}, true + } + return normalized, true } func withWorkspaceImagePreference(metadata map[string]any, image string) map[string]any { diff --git a/internal/workspace/image_preference_test.go b/internal/workspace/image_preference_test.go index 157a09f2..f1ab7a8b 100644 --- a/internal/workspace/image_preference_test.go +++ b/internal/workspace/image_preference_test.go @@ -163,6 +163,9 @@ func TestWorkspaceSkillDiscoveryRootsExplicitDisableRemainsPresent(t *testing.T) if !ok { t.Fatal("expected skill discovery roots key to remain present") } + if roots == nil { + t.Fatal("expected explicit disable to return a non-nil empty slice") + } if len(roots) != 0 { t.Fatalf("expected explicit disable with no roots, got %#v", roots) }