Files
rune/scripts/open_contract_elastic_cognition.py
T
Nick d4203f8559 feat(elastic_cognition): close PARTIAL gaps — dichotomy wave
Port the 11 audit-missing oracle fns name-preserving 1:1 (#2479, GO
verdict): ctxBudget (_ctx_budget), buildConstitution/getConstitution,
loadCloudConfig (ordered-JSONC parse, naive-comment-strip quirk
mirrored), executeAtTier, executeDeterministic, executeOllama,
executeCloud, executeWithEscalation, processMessage, and the embedded
smoke test testElasticCognition — audit 3/14 -> 14/14 FULL.

IO (identity prompt, mimocode.jsonc, HTTP) behind injectable seams.
Frozen truth: 21 oracle cases via the shared freeze_truth.py harness,
byte-identical on regen + --verify green; Go battery replays them
verbatim plus seam/payload/quirk pins; live parity 100% (constitution,
ctx_budget x6, dead-port x2, ollama success/context/escalation, cloud
config/success/empty) via scripts/check_elastic_cognition_parity.py;
gofmt/vet/build clean; Python oracle battery 21 passed both pins.
Evidence: verification/summary.md.
2026-10-13 18:20:02 +01:00

47 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Open + walk the #2479 gap-closing construction contract for
elastic_cognition to verifying. Full lifecycle in ONE process
(shared-store clobber hazard)."""
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from rune.construction_interface import ConstructionInterface
iface = ConstructionInterface(builder="factory-gap-ec")
r = iface.submit_need(
"Close the elastic_cognition dichotomy PARTIAL gaps (#2479 tranche, "
"GO verdict): the Go port at src/go/elastic-cognition covers 3/14 "
"oracle fns (classify_salience, calculate_budget, parse_response) — "
"port the 10 missing fns name-preserving, logic 1:1 "
"(_ctx_budget, _build_constitution, _get_constitution, "
"_load_cloud_config, execute_at_tier, _execute_deterministic, "
"_execute_ollama, _execute_cloud, execute_with_escalation, "
"process_message) with model-registry/context-budget, identity-prompt, "
"cloud-config-file, and Ollama/cloud HTTP IO behind injectable seams "
"(resolver/profile-table, prompt-provider, config-loader, HTTP-do "
"vars); freeze oracle truth via the shared scripts/freeze_truth.py "
"harness (every freezable public function and branch) and embed it "
"VERBATIM in the Go battery; live parity 100% on the new fns "
"(dead-port HTTP error parity + stub-transport scenario parity); "
"all existing tests green; gofmt + vet clean; Phase B "
"language-advantage pass.",
origin="builder",
)
print("submit_need:", json.dumps(r)[:400])
if not r.get("success"):
print("NEED FAILED — aborting"); sys.exit(1)
cid = r["ids"]["contract_id"]
print("contract_id:", cid)
for phase in ("approved", "building", "verifying"):
t = iface.transition(cid, phase)
print(f"transition->{phase}:", json.dumps(t)[:300])
if not t.get("success"):
sys.exit(1)
print("PENDING_CONTRACT", cid)