authoring UX: sequential elicitation questions + optional creation approval

Elicitation now asks one question at a time: only one PendingQuestion is
live, and the next is posted only after the current is answered (an empty
answer is accepted) or skipped. Each question gets a fresh
codegen.elicitation.answer_timeout (default 30s) that resets on every answer
submit; a timeout stops the sequence. questions_timeout is now traced only on
a real timeout. Front ends need no change — they read pending_questions().

Add opt-in creation_approval: the single-slot llm draft worker blocks after
authoring a proposal and before anything is registered; approve/deny via the
REPL, dashboard (/api/approvals + UI), or a gateway chat reply (yes/no). One
prompt per creation request (a category approval covers its chained skill);
denial or timeout aborts creation. Off by default.

Tests updated for both; full stdlib suite passes (337).
This commit is contained in:
gabby committed 2026-10-01 23:57:03 +00:00
1 parent 25ade160df
commit 215c22afb8
10 files changed
+684 -67

No files matched your search

+33 -1
View File
@@ -16,7 +16,7 @@ from semif_agent.decisions import DecisionRequest, DecisionResult, Option, Reque
from semif_agent.engine import EngineConfig, SemIfEngine
from semif_agent.llm import LLMClient
from semif_agent.log import DecisionLog
from semif_agent.scheduler import PendingQuestion, RepairOffer, Scheduler
from semif_agent.scheduler import PendingApproval, PendingQuestion, RepairOffer, Scheduler
from semif_agent.skills import ActionResult, Skill
from semif_agent.trace import TraceLog
@@ -356,11 +356,43 @@ def test_status_carries_questions_and_repairs(tmp_path):
selected="retry", reason="boom", request_text="track", failure="boom",
)
)
scheduler.approvals.append(
PendingApproval(
id="a1", run_id="run-1", kind="skill", category="tracking",
skill="track_live", description="Follow a package.",
)
)
server = Server(scheduler)
try:
status, payload = server.get("/api/status")
assert payload["questions"][0]["id"] == "q1"
assert payload["repairs"][0]["id"] == "r1"
assert payload["approvals"][0]["id"] == "a1"
finally:
server.close()
def test_approvals_endpoint_roundtrip(tmp_path):
scheduler = build_scheduler(tmp_path)
scheduler.approvals.append(
PendingApproval(
id="a1", run_id="run-1", kind="category", category="travel",
skill="", description="Trips.",
)
)
server = Server(scheduler)
try:
status, payload = server.get("/api/approvals")
assert status == 200
assert payload["approvals"][0]["id"] == "a1"
assert payload["approvals"][0]["kind"] == "category"
status, payload = server.post("/api/approvals", {"id": "a1", "approve": True})
assert payload["status"] == "ok"
assert scheduler.pending_approvals() == []
status, payload = server.post("/api/approvals", {"id": "missing", "approve": False})
assert payload["status"] == "error"
finally:
server.close()