Name-preserving 1:1 port of the 22 functions the audit named missing against the src/rune/local_tool_runtime.py oracle: _find_capability_executor, _extract_context_length, context_length, reset_context_length_cache, supports_tools, supports_thinking, _positive_int, _model_capabilities, resume, approve, reject, _expose_tools, _deduplicate, _tool_message, _event_to_state, _event_from_state, _request_to_state, _request_from_state, _with_fallback_prompt (plus _post/_model_capabilities-side context caching and the tool-protocol validation/spans core the loop needs). IO sits behind injectable seams (PostFunc, LoopTransport, ToolExecutor, cloud/local transport constructors, RecordFailure, ResetDiscoveredWindows, ParamOrder). Frozen truth: scripts/gen_local_tool_runtime_truth.py exercises every branch against the LIVE oracle with deep-copied inputs; truth.json (embedded, byte-deterministic) replays 96 rows in Go — full envelopes, chat payloads, executor calls, pending states. Documented divergences: Python bool-sub-int quirk in _extract_context_length (Go rejects bools), uuid call_ids in text-fallback envelopes (wildcard-matched), exception TYPE names (message parity only). Audit: local_tool_runtime 8/30 PARTIAL -> 30/30 FULL. Go: build/gofmt/vet/ -race green. Python oracle tests: 23 passed (delegation live and RUNE_LOCAL_TOOL_RUNTIME_CORE=python pinned). Contract BUILDER-2026-10-13T00:04:53Z-0b0047-factory-gap-ltr.
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Open the #2479 dichotomy-wave construction contract for local_tool_runtime (GO gap-close).
|
|
Full lifecycle walk 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-ltr")
|
|
|
|
r = iface.submit_need(
|
|
"Close the PARTIAL gaps in src/go/local-tool-runtime against the "
|
|
"src/rune/local_tool_runtime.py oracle (dichotomy wave, issue #2479 "
|
|
"tranche): name-preserving 1:1 port of the 22 unmatched functions "
|
|
"(_find_capability_executor, _extract_context_length, context_length, "
|
|
"reset_context_length_cache, supports_tools, supports_thinking, "
|
|
"_positive_int, _model_capabilities, resume, approve, reject, "
|
|
"_expose_tools, _deduplicate, _tool_message, _event_to_state, "
|
|
"_event_from_state, _request_to_state, _request_from_state, "
|
|
"_with_fallback_prompt and companions), IO behind injectable seams, "
|
|
"frozen-truth battery generated against the live Python oracle "
|
|
"(RUNE core pinned to python, deep-copied inputs), existing tests "
|
|
"green + gofmt/vet clean, live parity 100% on the new functions.",
|
|
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("CONTRACT", cid, "IN VERIFYING (close happens at delivery with SHAs)")
|