Add durable bounded corrections for early LLM phases and validated review

This commit is contained in:
Nico committed 2026-10-14 17:37:08 +02:00
1 parent 5f3680b003
commit 0c750dbb74
16 files changed
+815 -24

No files matched your search

+14
View File
@@ -84,6 +84,20 @@ class CaseAssembler:
prior_refs = []
for _, checkpoint in reversed(chain):
details = checkpoint["details"]
if details.get("operation") == "early-correction":
ref = details.get("artifact_ref")
if not isinstance(ref, str) or not ref.startswith(("analysis/interpretations/", "analysis/hypotheses/")) or "/corrections/" not in ref:
raise CaseBuildError("PREVIOUS_CASE", "Invalid correction artifact checkpoint")
doc = load(ref, "early-correction")
from viano_bug_analysis.analysis.correction import base, digest, PHASES
phase = details.get("phase")
expected = base(phase, checkpoint["analysis_revision"]) + "/" + (
f"attempt-{doc.get('attempt', 0):04d}.json" if doc["kind"] == "attempt" else doc["kind"] + ".json") if phase in PHASES else None
if (ref != expected or digest(doc) != details.get("artifact_sha256") or doc["phase"] != phase
or doc["analysis_revision"] != checkpoint["analysis_revision"]
or any(doc[f] != manifest[f] for f in ("case_id", "package_id"))):
raise CaseBuildError("PREVIOUS_CASE", "Invalid correction artifact checkpoint")
excluded.add(ref)
if details.get("operation") in {"change-request-start", "change-request-complete", "change-request-rejected", "output-validated"}:
fields = ("context_ref", "decision_ref", "change_request_ref", "summary_ref", "failure_ref", "error_ref", "validation_ref")
for field in fields: