Allow idempotent reconfirmation of resolved investigation questions

This commit is contained in:
Nico committed 2026-10-16 15:55:20 +02:00
1 parent 089ac3ac5b
commit 02a7364c58
3 files changed
+54 -2

No files matched your search

@@ -420,8 +420,11 @@ class Investigator:
if next_action["kind"]=="reject" and update["confidence"] in {"supported","strongly_supported"}:
raise InvestigationError("INVESTIGATION_CONTRADICTORY_UPDATE")
questions={q["id"]:q for q in h["questions"]}
if (any(q not in questions or questions[q]["resolved"] for q in update["resolve_questions"])
or (update["resolve_questions"] and not update["evidence_refs"])):raise InvestigationError("INVESTIGATION_QUESTION")
# Reconfirming an already resolved question is an idempotent no-op.
# Only a new resolution needs evidence; unknown IDs remain invalid.
if (any(q not in questions for q in update["resolve_questions"])
or (any(not questions[q]["resolved"] for q in update["resolve_questions"])
and not update["evidence_refs"])):raise InvestigationError("INVESTIGATION_QUESTION")
if len(h["questions"])+len(update["add_questions"])>state["policy"]["max_questions_per_hypothesis"]:
raise InvestigationError("INVESTIGATION_QUESTION_LIMIT")
if any(text.casefold().strip() in {q["text"].casefold().strip() for q in h["questions"]} for text in update["add_questions"]):