nexu-io/open-design · error · SystemExit

running-left mirror job must derive from running-right

Error message

running-left mirror job must derive from running-right

What it means

For a deterministic-mirror running-left job, derived_from must equal the literal "running-right". Any other value (or a missing derived_from) means the mirror lineage is broken and finalize will not trust the output.

Source

Thrown at skills/hatch-pet/scripts/finalize_pet_run.py:85

        raise SystemExit(f"job {job_id} source image no longer exists: {source}")
    if not output.is_file():
        raise SystemExit(f"job {job_id} decoded output is missing: {output}")
    source_hash = file_sha256(source)
    output_hash = file_sha256(output)
    if source_hash != expected_hash:
        raise SystemExit(f"job {job_id} source image hash does not match imagegen-jobs.json")
    if output_hash != expected_hash:
        raise SystemExit(
            f"job {job_id} decoded output does not match its recorded source image; "
            "do not rewrite decoded visual outputs locally"
        )


def validate_mirror_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:
    if job_id != "running-left":
        raise SystemExit(f"job {job_id} may not use deterministic mirror provenance")
    if job.get("derived_from") != "running-right":
        raise SystemExit("running-left mirror job must derive from running-right")
    decision = job.get("mirror_decision")
    if not isinstance(decision, dict) or decision.get("approved") is not True:
        raise SystemExit(
            "running-left mirror job is missing an approved mirror_decision; "
            "use derive_running_left_from_running_right.py after visual review"
        )

    expected_source_hash = job.get("source_sha256")
    expected_output_hash = job.get("output_sha256")
    if not isinstance(expected_source_hash, str) or not expected_source_hash:
        raise SystemExit("running-left mirror job is missing source_sha256")
    if not isinstance(expected_output_hash, str) or not expected_output_hash:
        raise SystemExit("running-left mirror job is missing output_sha256")
    if not source.is_file():
        raise SystemExit(f"running-left mirror source image no longer exists: {source}")
    if not output.is_file():
        raise SystemExit(f"running-left mirrored output is missing: {output}")
    if source.name != "running-right.png" or source.parent.name != "decoded":

View on GitHub (pinned to 5be4028344)

Solutions

  1. Re-run derive_running_left_from_running_right.py, which sets derived_from = "running-right" along with the hashes and mirror_decision.
  2. If editing manually, set "derived_from": "running-right" on the running-left job.
  3. Re-run finalize_pet_run.py.

Example fix

// before
{ "id": "running-left", "source_provenance": "deterministic-mirror" }
// after
{ "id": "running-left", "source_provenance": "deterministic-mirror", "derived_from": "running-right" }
Defensive patterns

Strategy: type-guard

Validate before calling

import json
from pathlib import Path

manifest = json.loads(Path("<run_dir>/imagegen-jobs.json").read_text())
left = next(j for j in manifest["jobs"] if j.get("id") == "running-left")
if left.get("source_provenance") == "deterministic-mirror":
    assert left.get("derived_from") == "running-right", "running-left derived_from must be 'running-right'"

Type guard

def mirror_lineage_ok(left_job: dict) -> bool:
    if left_job.get("source_provenance") != "deterministic-mirror":
        return True
    return left_job.get("derived_from") == "running-right"

Prevention

When it happens

Trigger: running-left has source_provenance deterministic-mirror but derived_from is missing, null, or set to something other than "running-right".

Common situations: Hand-editing the manifest; an interrupted or older derive script that failed to set derived_from; a botched merge.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/a0ee3d34fc83a53d. Report an issue: GitHub.