Record P24 approved repair and normal OS evidence; preserve P18 review gaps
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Owner-requested model-only adapter; ordinary Runner CLI and gates unchanged."""
|
||||
"""Owner coordinator routing, recorded direction and bounded review context."""
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
@@ -55,7 +55,15 @@ Runner.provider_argv = owner_model_argv
|
||||
original_packet = Runner.packet
|
||||
|
||||
def packet_with_actual_evidence(self, task_id, role, sha=None):
|
||||
packet = original_packet(self, task_id, role, sha)
|
||||
if role == "reviewer" and self.config["project"] == "the-tree-p18-01-model" and task_id == "P18-01-CODE":
|
||||
import importlib.util
|
||||
context_path = Path(__file__).with_name("p18_review_context.py")
|
||||
spec = importlib.util.spec_from_file_location("p18_owner_review_context", context_path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
packet = module.packet(self, task_id, sha or self.task(task_id)["submitted"], original_packet)
|
||||
else:
|
||||
packet = original_packet(self, task_id, role, sha)
|
||||
extra = os.environ.get('OWNER_REVIEW_SUPPLEMENT')
|
||||
if role == 'reviewer' and extra:
|
||||
prefix, data = packet.split('\nDATA:\n', 1)
|
||||
@@ -66,5 +74,53 @@ def packet_with_actual_evidence(self, task_id, role, sha=None):
|
||||
return packet
|
||||
|
||||
Runner.packet = packet_with_actual_evidence
|
||||
# Exact owner coordinator correction: allocation placeholder and infrastructure retry.
|
||||
from runner.core import GateError, require, git, read_json
|
||||
import uuid
|
||||
_original_process = Runner.process
|
||||
|
||||
def p18_process(self, task_id, role, service, argv, cwd, *args, **kwargs):
|
||||
if self.config["project"] == "the-tree-p18-01-model" and task_id == "P18-01-CODE" and role == "validation" and service is None:
|
||||
c = json.loads(self.task(task_id)["contract"])
|
||||
require(c["base_commit"] == "d2a1f80a613e7c77b02b941026bc49c2d85db863" and c["spec_sha256"] == "04e9ae701b6ee1e399542564add695ca7fce54499e52dd2e907b1dbdc23a366d", "exact P18 allocation guard")
|
||||
expected = [sys.executable, "-B", "tools/run_p18_relationship_tests.py", "--output", "{build_dir}/p18-relationship-evidence"]
|
||||
require(len(argv) == len(expected) and Path(argv[0]).resolve() == Path(expected[0]).resolve() and argv[1:] == expected[1:], "fixed registered P18 validation argv")
|
||||
declared = list(argv)
|
||||
output = Path(self.allocation(task_id)["build_dir"]) / "p18-relationship-evidence"
|
||||
require(output.resolve().is_relative_to(self.runtime(task_id).resolve()), "allocated output containment")
|
||||
argv = list(argv)
|
||||
argv[-1] = str(output)
|
||||
self.event(task_id, "validation_argument_resolution", {"declared_argv": declared, "resolved_argv": argv, "policy_changed": False})
|
||||
return _original_process(self, task_id, role, service, argv, cwd, *args, **kwargs)
|
||||
|
||||
Runner.process = p18_process
|
||||
_original_validate = Runner.validate
|
||||
|
||||
def p18_validate(self, task_id):
|
||||
task = self.task(task_id)
|
||||
if not (self.config["project"] == "the-tree-p18-01-model" and task_id == "P18-01-CODE" and task["state"] == "repair_pending" and task["submitted"] == "0084760ee05a97adfcbd783a71161491f3629918"):
|
||||
return _original_validate(self, task_id)
|
||||
previous = self.db.execute("SELECT artifact FROM evidence WHERE task_id=? AND kind='validation' AND commit_sha=? AND passed=0 ORDER BY id DESC LIMIT 1", (task_id, task["submitted"])).fetchone()
|
||||
require(previous is not None, "actual failed validation required for infrastructure retry")
|
||||
report = read_json(previous[0])
|
||||
require(len(report["checks"]) == 1 and report["checks"][0]["id"] == "p18-model", "exact one validator")
|
||||
artifact = Path(report["checks"][0]["artifact"])
|
||||
command = read_json(artifact / "command.json")
|
||||
require(command["argv"][-1] == "{build_dir}/p18-relationship-evidence" and (artifact / "stderr.log").read_text().strip() == "AssertionError: regular final receipt required", "known owner allocation error only")
|
||||
require((Path(self.allocation(task_id)["build_dir"]) / "p18-relationship-evidence/receipt.json").is_file(), "actual precollected receipt required")
|
||||
self.event(task_id, "owner_infrastructure_validation_retry", {"failed_report": previous[0], "submitted_commit": task["submitted"], "source_changes": False, "repair_counter_unchanged": task["repairs"], "reason": "Correct the owner-declared allocation placeholder and rerun the actual unchanged validator. No acceptance evidence is manufactured."})
|
||||
self.state(task_id, "validating", "Owner allocation correction; same source and receipt; no new code repair")
|
||||
wt = self.detached(task_id + "-validation-" + uuid.uuid4().hex[:8], task["submitted"])
|
||||
try:
|
||||
self.check_scope(task_id, wt, task["submitted"])
|
||||
self.verify(task_id, wt, task["submitted"], "validation")
|
||||
self.has_evidence(task_id, "validation", task["submitted"])
|
||||
self.state(task_id, "review_pending")
|
||||
except (GateError, OSError) as exc:
|
||||
self.state(task_id, "repair_pending", str(exc))
|
||||
raise
|
||||
|
||||
Runner.validate = p18_validate
|
||||
|
||||
from runner.cli import main
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user