From 1ed1bc731d73cb002f37955993287e4942f65dbf Mon Sep 17 00:00:00 2001 From: Sunil Kumar Vadlamani Date: Sun, 18 Oct 2026 12:41:38 -0700 Subject: [PATCH 1/4] fix(rescue evidence): allow legacy pre-flag baselines with explicit uncertainty annotation --- _llmrig/rescue_evidence.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/_llmrig/rescue_evidence.py b/_llmrig/rescue_evidence.py index ae060fd..0afc36a 100644 --- a/_llmrig/rescue_evidence.py +++ b/_llmrig/rescue_evidence.py @@ -66,9 +66,13 @@ def _normalize(report: Dict[str, Any]) -> Dict[str, Any]: raise ValueError("the fixture or task version differs from the fixed Rescue task") if result.get("agent_steps_limit") is not None: raise ValueError("step-limit experiments are not comparable in this analysis") - compaction_disabled = result.get("auto_compaction_disabled") + # Receipts predating the opt-in compaction switch had no such field. + # Accept them as *possible* default-compaction baselines only, and + # explicitly disclose that the setting was not recorded in the receipt. + legacy_policy_not_recorded = "auto_compaction_disabled" not in result + compaction_disabled = result.get("auto_compaction_disabled", False) if type(compaction_disabled) is not bool: - raise ValueError("receipt is missing an explicit compaction policy") + raise ValueError("receipt contains an invalid compaction policy") status = result.get("status") if status not in ("passed", "failed"): raise ValueError("receipt has an unsupported task status") @@ -98,6 +102,7 @@ def _normalize(report: Dict[str, Any]) -> Dict[str, Any]: "model": model, "declared_context": context, "auto_compaction_disabled": compaction_disabled, + "legacy_compaction_policy_not_recorded": legacy_policy_not_recorded, "strict_pass": strict_pass, "correction_evidence": correction_evidence, "process_exit": checks["process_exit_zero"], @@ -112,6 +117,9 @@ def _group(observations: List[Dict[str, Any]]) -> Dict[str, Any]: count = len(observations) return { "sessions": count, + "legacy_compaction_policy_not_recorded": sum( + x["legacy_compaction_policy_not_recorded"] for x in observations + ), "strict_task_passes": sum(x["strict_pass"] for x in observations), "provisional_correct_fixes": sum(x["correction_evidence"] for x in observations), "successful_process_exits": sum(x["process_exit"] for x in observations), @@ -138,7 +146,8 @@ def assess(baselines: Sequence[str], candidates: Sequence[str]) -> Dict[str, Any raise ValueError("all receipts must use the same model and declared context") if any(r["auto_compaction_disabled"] for r in original): raise ValueError("baseline receipts must have default automatic compaction") - if any(not r["auto_compaction_disabled"] for r in modified): + if any(not r["auto_compaction_disabled"] or r["legacy_compaction_policy_not_recorded"] + for r in modified): raise ValueError("candidate receipts must explicitly disable auto compaction") before = _group(original) @@ -160,7 +169,7 @@ def assess(baselines: Sequence[str], candidates: Sequence[str]) -> Dict[str, Any "model": model, "declared_context_tokens": context, "variable_compared": "opencode_compaction_auto", - "baseline_auto_compaction": "unspecified_default", + "baseline_auto_compaction": "default_or_legacy_policy_not_recorded", "candidate_auto_compaction": "explicitly_disabled", "baseline": before, "candidate": after, @@ -177,6 +186,8 @@ def assess(baselines: Sequence[str], candidates: Sequence[str]) -> Dict[str, Any "warnings": [ "Receipts are user-selected self-reported JSON, not independently signed execution evidence.", "The reported OpenCode configuration was constructed in a disposable workspace.", + "Older baseline receipts may lack an explicit auto-compaction field; " + "those are treated as possible defaults, not proof of the actual setting.", "The declared context is not verified as Ollama's effective per-request context.", "Uncontrolled differences in execution order, timeouts, machine load and runtime state remain.", "One tiny read-only task and few runs cannot establish causal or statistical reliability.", @@ -193,6 +204,8 @@ def format_terminal(report: Dict[str, Any]) -> str: "======================================================", "Model: " + report["model"], "Declared context: " + str(report["declared_context_tokens"]) + " tokens", + "Legacy baselines without recorded compaction policy: " + + str(baseline["legacy_compaction_policy_not_recorded"]), "Baseline: " + str(baseline["strict_task_passes"]) + "/" + str(baseline["sessions"]) + " strict passes; " + str(baseline["agent_timeouts_after_fix_evidence"]) + " timeouts with provisional fixes", From f47a905947395e95557e42aa0df824fc6b5cc3cf Mon Sep 17 00:00:00 2001 From: Sunil Kumar Vadlamani Date: Sun, 18 Oct 2026 12:41:54 -0700 Subject: [PATCH 2/4] test(rescue evidence): legacy baseline receipts accepted only with uncertainty markers --- tests/test_rescue_evidence.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_rescue_evidence.py b/tests/test_rescue_evidence.py index f028ace..e4b573f 100644 --- a/tests/test_rescue_evidence.py +++ b/tests/test_rescue_evidence.py @@ -80,6 +80,31 @@ def test_observed_repeated_mitigation_and_no_untrusted_private_values(self): self.assertIn("not a verified causal repair", rescue_evidence.format_terminal(result)) + def test_old_baseline_reports_before_compaction_flag_are_supported_cautiously(self): + old = receipt() + old["agent_evaluation"].pop("auto_compaction_disabled") + baseline = [ + self.save("legacy-90.json", old), + self.save("legacy-180.json", old), + ] + candidates = [ + self.save("candidate-a.json", receipt(disable=True, status="passed")), + self.save("candidate-b.json", receipt(disable=True, status="passed")), + self.save("candidate-c.json", receipt(disable=True, status="passed")), + ] + result = rescue_evidence.assess(baseline, candidates) + self.assertEqual(result["baseline"]["legacy_compaction_policy_not_recorded"], 2) + self.assertEqual(result["assessment"], + "repeated_mitigation_observed_not_causally_verified") + self.assertIn("not recorded", json.dumps(result)) + self.assertIn("Legacy baselines without recorded compaction policy: 2", + rescue_evidence.format_terminal(result)) + + with self.assertRaisesRegex(ValueError, "candidate receipts must explicitly"): + rescue_evidence.assess( + baseline, [self.save("invalid-candidate.json", old)] + ) + def test_one_baseline_is_inconclusive_by_defined_triage_threshold(self): baseline, candidate = self.representative() result = rescue_evidence.assess(baseline[:1], candidate) From d3f7a6ae1d09ba94423e8f726381c4155b827fe1 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Vadlamani Date: Sun, 18 Oct 2026 12:42:06 -0700 Subject: [PATCH 3/4] docs(rescue evidence): baseline receipts predate explicit policy field, uncertainty disclosed --- docs/RESCUE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/RESCUE.md b/docs/RESCUE.md index 764b8bb..3edea8d 100644 --- a/docs/RESCUE.md +++ b/docs/RESCUE.md @@ -258,6 +258,13 @@ execution budgets, Ollama's effective context and other possible confounds are not reconstructed. Automatic compaction is often needed for long agent tasks; turning it off can cause context-window exhaustion. +**Legacy receipts:** Earlier single-task reports were produced before +Rescue started recording an explicit `auto_compaction_disabled` boolean. +The offline assessor accepts those **only as baseline** receipts, +flags how many have an unrecorded compaction policy, and treats them +as *possibly default* compaction rather than independently verified. +Candidate receipts must explicitly record `auto_compaction_disabled: true`. + The report recommendation is always `no_automatic_or_global_compaction_change`, even if the exploratory criterion is met. To investigate causality, perform independent alternating From dd76cf3d96d2a657bcd3bc8ff5e77e350c06db47 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Vadlamani Date: Sun, 18 Oct 2026 12:43:11 -0700 Subject: [PATCH 4/4] test(rescue): assert actual caution text for unrecorded legacy policy --- tests/test_rescue_evidence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_rescue_evidence.py b/tests/test_rescue_evidence.py index e4b573f..5612f15 100644 --- a/tests/test_rescue_evidence.py +++ b/tests/test_rescue_evidence.py @@ -96,7 +96,7 @@ def test_old_baseline_reports_before_compaction_flag_are_supported_cautiously(se self.assertEqual(result["baseline"]["legacy_compaction_policy_not_recorded"], 2) self.assertEqual(result["assessment"], "repeated_mitigation_observed_not_causally_verified") - self.assertIn("not recorded", json.dumps(result)) + self.assertIn("possible defaults, not proof", json.dumps(result)) self.assertIn("Legacy baselines without recorded compaction policy: 2", rescue_evidence.format_terminal(result))