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

+26 -1
View File
@@ -19,7 +19,7 @@ from semif_agent.gateway.service import GatewayService
from semif_agent.gateway.simplex import SimplexAdapter
from semif_agent.llm import LLMClient
from semif_agent.log import DecisionLog
from semif_agent.scheduler import Scheduler
from semif_agent.scheduler import PendingApproval, Scheduler
from semif_agent.skills import ActionResult, Skill
from semif_agent.trace import TraceLog
@@ -251,3 +251,28 @@ def test_service_answered_question_routes_back(tmp_path):
service.handle_inbound(InboundMessage(text="work", chat_id="4", contact_id="4"))
assert not scheduler.pending_questions()
def test_service_surfaces_and_resolves_approval(tmp_path):
scheduler = build_scheduler(tmp_path)
service = build_service(scheduler)
scheduler.approvals.append(
PendingApproval(
id="a1",
run_id="r1",
kind="skill",
category="tracking",
skill="track_live",
description="Follow a package.",
)
)
service._owners["r1"] = "4"
service.surface()
assert any(
"Approve creating new skill tracking.track_live" in text
for text in drain_outbound(service)
)
service.handle_inbound(InboundMessage(text="yes", chat_id="4", contact_id="4"))
assert scheduler.pending_approvals() == []
assert any("approved" in text for text in drain_outbound(service))