deterministically execute create_skill from create_category, execute skill after creation

This commit is contained in:
Denton Social
2026-09-24 02:31:12 -05:00
parent 5bdfa1d91d
commit 300c20714b
5 changed files with 90 additions and 21 deletions
+29 -1
View File
@@ -206,4 +206,32 @@ def test_create_skill_empty_category_does_not_wedge(tmp_path):
status, detail = scheduler.submit("tell me if my package was delivered")
print(f"[{status}] {detail}")
assert scheduler.current is None
assert scheduler.current is None
def test_create_category_chain_runs_new_skill(tmp_path):
"""A request that needs a brand-new category must end with a skill run.
Deterministic chain: create_category -> create_skill in the new category ->
run that skill (the leaf answers the request, not the category stub). Slow:
uses real codegen (~7 min). Run in the background.
"""
config = load_config()
require_real(config)
config["log"] = str(tmp_path / "decisions.jsonl")
config["trace"] = str(tmp_path / "runs.jsonl")
config["category_registry"] = str(tmp_path / "categories.json")
config["skill_bodies"] = str(tmp_path / "skills")
scheduler, config = build_scheduler(config)
scheduler.tree = {}
status, detail = scheduler.submit("track my drone delivery in real time")
print(f"[{status}] {detail}")
rows = scheduler.trace.read()
kinds = [e["kind"] for e in rows]
assert "category_created" in kinds, "category stub must be authored first"
created = next(e for e in rows if e["kind"] == "skill_created")
assert created["written"] is True, "codegen must produce a runnable body"
assessed = next(e for e in rows if e["kind"] == "assessed")
assert assessed["skill"] == created["skill"], "the created skill must run"