async skill-body authoring: single-slot codegen worker, restart, re-dispatch
create_skill now authors the stub synchronously and returns immediately; the runnable body is written by a single-slot background worker (the gate stays free for new input). On success the body is materialized and hot-merged, the leaf's writing flag clears, and the original request is re-queued at its scored weight and re-runs navigation onto the new leaf. On failure the leaf stays a restartable stub and the user is notified. - scheduler: _dispatch_skill launches the async write instead of blocking; _run_skill guards writing/stub leaves (no silent no-op); restart_skill re-kicks a write for an empty not-in-progress leaf (reuses the stored request_text); RLock guards tree/queue/current across worker and main thread; awaiting_skill_body meta guard stops a re-dispatched request from authoring a second skill. - skills: Skill.writing + status/is_noop via module-level no-op sentinels; registry entries persist the originating request_text. - engine: call/generate serialized with a Lock so the worker's degeneration checks never race main-thread navigation/scoring on one llama.cpp context. - cli: restart <category> <skill> command; REPL drains the queue after input. - dashboard: POST /api/restart; /api/tree carries per-skill status; tree rows + skill_write_failed flow nodes get restart buttons; reads snapshotted. - tests: async end-to-end (real CodegenClient vs fake SSE endpoint), restart, loop guard, status derivation, dashboard endpoint/status; integration chain test rewritten to poll for async completion + assessed.
This commit is contained in:
1 parent
db35cb66dc
commit
87438c881a
11 files changed
+818
-204
No files matched your search
+11
-1
@@ -142,7 +142,7 @@ def try_warm(scheduler: Scheduler) -> str:
|
||||
|
||||
def repl(scheduler: Scheduler, config: dict) -> None:
|
||||
print(try_warm(scheduler))
|
||||
print("type a request, or one of: busy <text> | idle | status | skills | dream | relabel <id> <outcome> | quit")
|
||||
print("type a request, or one of: busy <text> | idle | status | skills | dream | relabel <id> <outcome> | restart <category> <skill> | quit")
|
||||
while True:
|
||||
try:
|
||||
line = input("> ").strip()
|
||||
@@ -171,6 +171,14 @@ def repl(scheduler: Scheduler, config: dict) -> None:
|
||||
ok = scheduler.log.relabel(parts[1], parts[2])
|
||||
print("relabeled." if ok else f"no row with id {parts[1]}")
|
||||
continue
|
||||
if lower.startswith(("restart ", "/restart ")):
|
||||
parts = line.lstrip("/").split()
|
||||
if len(parts) != 3:
|
||||
print("usage: restart <category> <skill>")
|
||||
continue
|
||||
status, detail = scheduler.restart_skill(parts[1], parts[2])
|
||||
print(f"[{status}] {detail}")
|
||||
continue
|
||||
if lower == "idle":
|
||||
scheduler.idle()
|
||||
print("current process cleared.")
|
||||
@@ -185,6 +193,8 @@ def repl(scheduler: Scheduler, config: dict) -> None:
|
||||
answer = input(f"{scheduler.pending.question} ")
|
||||
status, detail = scheduler.answer(answer)
|
||||
print(f"[{status}] {detail}")
|
||||
for result_status, result_detail in scheduler.run_queue():
|
||||
print(f"[{result_status}] {result_detail}")
|
||||
|
||||
|
||||
def scripted(scheduler: Scheduler, path: str) -> None:
|
||||
|
||||
Reference in new issue
Block a user