real integrations: implementation elicitation, INTEGRATION, fidelity + repair
Anchor the product premise at the top of AGENTS.md: semif-agent is an end-user app that does the user's task for real against their actual service, asking a few questions and learning when it doesn't know how. Elicitation now asks implementation questions (service/account, how to connect, credential source, expected result) and is on by default. The REPL asks inline; the dashboard defers via a question queue the worker waits on (/api/questions + panel). Answers ride every body attempt and persist in the registry so restart doesn't re-ask. SKILL.md requires real actions via stdlib transports with values from ctx.config and a module-level INTEGRATION declaration (service/transport/config_vars). TESTGEN.md scopes tests as hermetic mechanics checks (loopback http.server in-test, never fixture addresses in bodies) that never certify the live integration. After the body lands a fidelity review (small LLM + static declaration findings) regenerates a simulated body once, then accepts it traced and badged unverified. A failed real run logs a SemIf repair choice (retry/repair_skill/ask_user/no_repair), surfaced in REPL and dashboard, bounded by codegen.repair.max_attempts and user-confirmed. Dev unit suite: 191 passed. Jarvis integration run still pending.
This commit is contained in:
1 parent
06ccfb77c6
commit
dde034f1b4
16 files changed
+2263
-255
No files matched your search
@@ -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 Scheduler
|
||||
from semif_agent.scheduler import PendingQuestion, RepairOffer, Scheduler
|
||||
from semif_agent.skills import ActionResult, Prediction, Skill
|
||||
from semif_agent.trace import TraceLog
|
||||
|
||||
@@ -300,4 +300,71 @@ def test_answer_roundtrip_via_api(tmp_path):
|
||||
status, payload = server.get("/api/status")
|
||||
assert payload["pending"] is None
|
||||
finally:
|
||||
server.close()
|
||||
server.close()
|
||||
|
||||
def test_questions_endpoint_roundtrip(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
scheduler.questions.append(
|
||||
PendingQuestion(
|
||||
id="q1", run_id="run-1", category="tracking", skill="probe",
|
||||
question="Which service should it use?",
|
||||
)
|
||||
)
|
||||
server = Server(scheduler)
|
||||
try:
|
||||
status, payload = server.get("/api/questions")
|
||||
assert status == 200
|
||||
assert payload["questions"][0]["id"] == "q1"
|
||||
assert payload["questions"][0]["kind"] == "elicitation"
|
||||
|
||||
status, payload = server.post("/api/questions", {"id": "q1", "text": "Nextcloud"})
|
||||
assert payload["status"] == "ok"
|
||||
assert scheduler.pending_questions() == []
|
||||
|
||||
status, payload = server.post("/api/questions", {"id": "missing", "text": "x"})
|
||||
assert payload["status"] == "error"
|
||||
finally:
|
||||
server.close()
|
||||
|
||||
|
||||
def test_status_carries_questions_and_repairs(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
scheduler.questions.append(
|
||||
PendingQuestion(
|
||||
id="q1", run_id="run-1", category="tracking", skill="probe", question="Q?"
|
||||
)
|
||||
)
|
||||
scheduler.repairs.append(
|
||||
RepairOffer(
|
||||
id="r1", run_id="run-1", category="tracking", skill="tracking.check",
|
||||
selected="retry", reason="boom", request_text="track", failure="boom",
|
||||
)
|
||||
)
|
||||
server = Server(scheduler)
|
||||
try:
|
||||
status, payload = server.get("/api/status")
|
||||
assert payload["questions"][0]["id"] == "q1"
|
||||
assert payload["repairs"][0]["id"] == "r1"
|
||||
finally:
|
||||
server.close()
|
||||
|
||||
|
||||
def test_repairs_endpoint_declines(tmp_path):
|
||||
scheduler = build_scheduler(tmp_path)
|
||||
scheduler.repairs.append(
|
||||
RepairOffer(
|
||||
id="r1", run_id="run-1", category="tracking", skill="tracking.check",
|
||||
selected="repair_skill", reason="boom", request_text="track", failure="boom",
|
||||
)
|
||||
)
|
||||
server = Server(scheduler)
|
||||
try:
|
||||
status, payload = server.get("/api/repairs")
|
||||
assert status == 200
|
||||
assert payload["repairs"][0]["selected"] == "repair_skill"
|
||||
|
||||
status, payload = server.post("/api/repair", {"id": "r1", "action": "no_repair"})
|
||||
assert payload["status"] == "ok"
|
||||
assert scheduler.pending_repairs() == []
|
||||
finally:
|
||||
server.close()
|
||||
Reference in new issue
Block a user