scheduler: new-skill creation is a tri-state allow/deny/ask mode

Replace the boolean creation_approval and the per-category boolean
locks.new_skill with a single tri-state new_skill_creation mode: a global
default (allow | deny | ask) with a per-category override in the category
config. allow authors immediately, deny blocks creation, ask gates on human
approval (the old approval path). housekeeping/response stay denied in code.

Surfaces updated: config.example.json, REPL /mode, dashboard
/api/new-skill-modes + /api/new-skill-mode, static UI. The retired booleans
creation_approval (true->ask) and locks.new_skill (true->deny) are still read
as fallbacks so an existing deployment keeps its behaviour.

Docs (AGENTS.md, docs/flow.md) and tests updated.
This commit is contained in:
gabby committed 2026-10-10 01:38:16 +00:00
1 parent 88700898be
commit c5ee87875f
11 files changed
+350 -160

No files matched your search

+10 -10
View File
@@ -155,7 +155,7 @@ def test_restart_without_codegen_returns_error_json(tmp_path):
server.close()
def test_tree_endpoint_carries_origin_and_locks(tmp_path):
def test_tree_endpoint_carries_origin_and_modes(tmp_path):
scheduler = build_scheduler(tmp_path)
_generated_skill(scheduler, "tracking", "track_live")
server = Server(scheduler)
@@ -168,9 +168,9 @@ def test_tree_endpoint_carries_origin_and_locks(tmp_path):
s["origin"] == "builtin"
for s in payload["categories"]["housekeeping"]
)
assert payload["locks"]["housekeeping"] is True
assert payload["locks"]["response"] is True
assert payload["locks"]["tracking"] is False
assert payload["new_skill_modes"]["housekeeping"] == "deny"
assert payload["new_skill_modes"]["response"] == "deny"
assert payload["new_skill_modes"]["tracking"] == "allow"
finally:
server.close()
@@ -239,25 +239,25 @@ def test_regen_endpoint_without_codegen_errors(tmp_path):
server.close()
def test_lock_endpoint_roundtrip(tmp_path):
def test_new_skill_mode_endpoint_roundtrip(tmp_path):
scheduler = build_scheduler(tmp_path)
scheduler.tree["tracking"] = []
server = Server(scheduler)
try:
status, payload = server.get("/api/locks")
status, payload = server.get("/api/new-skill-modes")
assert status == 200
assert payload["locks"]["tracking"] is False
assert payload["modes"]["tracking"] == "allow"
status, payload = server.post(
"/api/lock", {"category": "tracking", "locked": True}
"/api/new-skill-mode", {"category": "tracking", "mode": "ask"}
)
assert payload["status"] == "ok"
status, payload = server.get("/api/tree")
assert payload["locks"]["tracking"] is True
assert payload["new_skill_modes"]["tracking"] == "ask"
status, payload = server.post(
"/api/lock", {"category": "housekeeping", "locked": False}
"/api/new-skill-mode", {"category": "housekeeping", "mode": "allow"}
)
assert payload["status"] == "error"
finally: