Set up daily WSJF closure gates

This commit is contained in:
2026-06-07 11:00:03 +02:00
parent 418eb4ffda
commit 4e8ccbb344
9 changed files with 431 additions and 4 deletions

View File

@@ -52,6 +52,18 @@ class _BadLLM:
return "not valid json {"
class _FailingLLM:
"""Raises like a missing or unreachable llm-connect endpoint."""
def complete(
self,
prompt: str,
model: str = "",
config: dict | None = None,
) -> str:
raise RuntimeError("LLM_CONNECT_URL is not configured")
class _CountingLLM:
"""Tracks how many times complete() is called; returns bad JSON then good JSON."""
@@ -429,6 +441,30 @@ def test_execute_instruction_with_audit_preserves_invalid_report_with_sinks(
assert llm.call_count == 2
def test_execute_instruction_with_audit_preserves_execution_failure_with_sinks():
instr = _instr(
id="daily-triage-report",
prompt="Report.",
trusted_fields=[],
report_sinks=[{"type": "working-memory", "path": "/tmp"}],
)
result = execute_instruction_with_audit(instr, _Event(), {}, _FailingLLM())
assert result.tasks == []
assert result.output_validated is False
assert result.review_required is True
assert result.validation_error == "LLM_CONNECT_URL is not configured"
assert result.report == {
"summary": (
"Instruction daily-triage-report could not run; "
"operator review is required."
),
"status": "execution_failed",
"validation_error": "LLM_CONNECT_URL is not configured",
}
def test_execute_instruction_with_audit_accepts_report_and_tasks_envelope():
envelope = {
"report": {"summary": "Review needed."},