"""Keep the approved single-window helper; no live retry or condition changes."""
import json,pathlib,os
os.umask(0o077)
R=pathlib.Path(__file__).parent
v=json.loads((R/'image-verify.json').read_text())
assert v=={'loader':0,'sdk_copy':0}
# Adapt the legacy helper result schema without masking any failed verification.
(R/'image-gate.json').write_text(json.dumps(dict(errors=0,failures=0,sdk=0)))
prior=pathlib.Path('/tmp/codex/ltb1021/2026-09-12_contextra-rtp-anchor_r01/runtime-derived.py')
source=prior.read_text().replace("R/'image-verify.json'", "R/'image-gate.json'")
plan=json.loads((R/'plan.json').read_text())
plan['controls']='/workspace/contextra-runtime-config/metadata-active'
(R/'plan.json').write_text(json.dumps(plan,indent=2))
(R/'runtime-derived.py').write_text(source)
exec(compile(source,str(R/'runtime-derived.py'),'exec'),globals())
