assessment: make assess/fidelity SemIf decisions, drop LLM from decision path

Assessment was an LLM generation step emitting prose. Move it to SemIf:
- assess:outcome (success/failure @ tau) and assess:requeue (complete/retry,
  updated_request = request.text bounded by max_reentries) are logged decisions.
- Run summary is deterministic (category.skill + ok/failed + action_log/new_state).
- Fidelity gate is a real authoring:fidelity accept/reconsider decision plus
  static integration findings; it only triggers a rewrite, never a diagnosis.
- Corrective regens receive the raw evidence bundle as-is (render_evidence),
  never an LLM paraphrase.
- Every EngineUnavailable is fatal app-wide: Scheduler.fatal is recorded, the
  worker stops, and the CLI prints 'decision engine not available' and exits
  non-zero. Remove llm.assess/review_skill_body (keep _parse_json).
- Tests: ScriptedEngine double in tests/conftest.py for scheduling mechanics;
  replace the review_skill_body integration test with a SemIf fidelity test;
  add deterministic-summary and evidence-renderer unit tests.
This commit is contained in:
Denton Social committed 2026-09-28 17:49:26 -05:00
1 parent ddc5cb66c8
commit 3d0cff325c
16 files changed
+610 -463

No files matched your search

+11 -6
View File
@@ -20,11 +20,13 @@ from semif_agent.scheduler import PendingQuestion, RepairOffer, Scheduler
from semif_agent.skills import ActionResult, Prediction, Skill
from semif_agent.trace import TraceLog
from tests.conftest import ScriptedEngine
def build_scheduler(tmp_path):
def build_scheduler(tmp_path, engine=None):
log = DecisionLog(str(tmp_path / "decisions.jsonl"))
trace = TraceLog(str(tmp_path / "runs.jsonl"))
engine = SemIfEngine(EngineConfig())
engine = engine if engine is not None else ScriptedEngine(default="success")
llm = LLMClient(base_url="http://localhost:1/v1", model="test")
scheduler = Scheduler(
engine=engine,
@@ -142,14 +144,17 @@ def test_trace_endpoint_empty(tmp_path):
server.close()
def test_submit_without_engine_returns_error_json(tmp_path):
scheduler = build_scheduler(tmp_path)
def test_submit_without_engine_returns_fatal_json(tmp_path):
"""The decision engine is always real; if it is unavailable the app is
fatal, and the dashboard reports it instead of a soft error."""
scheduler = build_scheduler(tmp_path, engine=SemIfEngine(EngineConfig()))
server = Server(scheduler)
try:
status, payload = server.post("/api/submit", {"text": "do something"})
assert status == 200
assert payload["status"] == "error"
assert "engine" in payload["detail"]
assert payload["status"] == "fatal"
assert "not available" in payload["detail"]
assert scheduler.fatal is not None
finally:
server.close()