Skip to content

Official Codebase of 3DCodeVerse

Python

skills: an empty selection is a legal desired set — the sweep runs on every path

gaoypengbcb8ed15431a
diff --git a/harness/codeverse/skills/materialize.py b/harness/codeverse/skills/materialize.py
index c54c2a4d..0f8d80e5 100644
--- a/harness/codeverse/skills/materialize.py
+++ b/harness/codeverse/skills/materialize.py
@@ -36,6 +36,7 @@ import os
import shutil
import time
from collections.abc import Sequence
+from contextlib import suppress
from pathlib import Path
from typing import Any
@@ -208,6 +209,11 @@ def attach_skills(
)
out = SkillsMaterialized(listed=[s.name for s in sel], selections=list(sel),
reasons={s.name: s.reason for s in sel})
+ if not sel or single_shot:
+ # an empty selection is a legal desired set: the sweep must still run, or last
+ # round's bundles stay live where the native CLIs discover skills by directory
+ with suppress(OSError):
+ materialize_skills(ws_root, [])
if not sel:
write_index(ws_root, "")
return out
diff --git a/harness/tests/skills/test_materialize_prompting.py b/harness/tests/skills/test_materialize_prompting.py
index e5a33bd9..6c810c63 100644
--- a/harness/tests/skills/test_materialize_prompting.py
+++ b/harness/tests/skills/test_materialize_prompting.py
@@ -111,6 +111,18 @@ def test_a_skill_that_is_no_longer_routed_is_removed_from_the_workspace(ws, libr
assert not (ws / root / "cv3d-blender-forms").exists()
+def test_an_empty_selection_still_sweeps_last_rounds_bundles(ws, library):
+ """attach_skills' empty-selection early return used to skip the sweep entirely:
+ last round's bundles stayed live in both discovery roots, where the native CLIs
+ discover skills by directory (V4b). An empty route is a legal desired set."""
+ materialize_skills(ws, [library["cv3d-part-contact"]])
+ out = attach_skills(ws, track="static_object", language="threejs", kind="generation",
+ agent_kind="claude-code", library={})
+ assert out.listed == []
+ for root in SKILL_ROOTS:
+ assert not (ws / root / "cv3d-part-contact").exists(), f"stale bundle survived in {root}"
+
+
# --------------------------------------------------------------------------- prompt text
def test_native_loader_backends_get_one_sentence_and_no_second_index(library):
skills = [library["cv3d-part-contact"], library["cv3d-bbox-contract"]]