{"record":{"id":"e3a6776a41001722","repo":"nexu-io/open-design","slug":"job-job-id-may-not-use-deterministic-mirror-prov","errorCode":null,"errorMessage":"job {job_id} may not use deterministic mirror provenance","messagePattern":"job (.+?) may not use deterministic mirror provenance","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/finalize_pet_run.py","lineNumber":83,"sourceCode":"        )\n    if not source.is_file():\n        raise SystemExit(f\"job {job_id} source image no longer exists: {source}\")\n    if not output.is_file():\n        raise SystemExit(f\"job {job_id} decoded output is missing: {output}\")\n    source_hash = file_sha256(source)\n    output_hash = file_sha256(output)\n    if source_hash != expected_hash:\n        raise SystemExit(f\"job {job_id} source image hash does not match imagegen-jobs.json\")\n    if output_hash != expected_hash:\n        raise SystemExit(\n            f\"job {job_id} decoded output does not match its recorded source image; \"\n            \"do not rewrite decoded visual outputs locally\"\n        )\n\n\ndef validate_mirror_hash(job: dict[str, object], *, source: Path, output: Path, job_id: str) -> None:\n    if job_id != \"running-left\":\n        raise SystemExit(f\"job {job_id} may not use deterministic mirror provenance\")\n    if job.get(\"derived_from\") != \"running-right\":\n        raise SystemExit(\"running-left mirror job must derive from running-right\")\n    decision = job.get(\"mirror_decision\")\n    if not isinstance(decision, dict) or decision.get(\"approved\") is not True:\n        raise SystemExit(\n            \"running-left mirror job is missing an approved mirror_decision; \"\n            \"use derive_running_left_from_running_right.py after visual review\"\n        )\n\n    expected_source_hash = job.get(\"source_sha256\")\n    expected_output_hash = job.get(\"output_sha256\")\n    if not isinstance(expected_source_hash, str) or not expected_source_hash:\n        raise SystemExit(\"running-left mirror job is missing source_sha256\")\n    if not isinstance(expected_output_hash, str) or not expected_output_hash:\n        raise SystemExit(\"running-left mirror job is missing output_sha256\")\n    if not source.is_file():\n        raise SystemExit(f\"running-left mirror source image no longer exists: {source}\")\n    if not output.is_file():","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/finalize_pet_run.py#L65-L101","documentation":"validate_mirror_hash is only valid for the running-left job. Any other job whose source_provenance is deterministic-mirror triggers this: only the left sprite may be a deterministic mirror of running-right; all other states must be real $imagegen outputs.","triggerScenarios":"A non-running-left job (e.g. idle, waving, jumping) carries source_provenance: \"deterministic-mirror\" in the manifest, dispatching it to the mirror validator.","commonSituations":"Copy-pasting provenance across jobs when hand-editing the manifest; a buggy job-recording script that tags the wrong job.","solutions":["For non-left jobs, set source_provenance to \"built-in-imagegen\" and ingest the real source via record_imagegen_result.py.","Only the running-left job may carry source_provenance: deterministic-mirror.","Re-run finalize_pet_run.py."],"exampleFix":"// before (idle job)\n{ \"id\": \"idle\", \"source_provenance\": \"deterministic-mirror\" }\n// after\n{ \"id\": \"idle\", \"source_provenance\": \"built-in-imagegen\", \"source_path\": \"<generated_images>/ig_xxx.png\" }","handlingStrategy":"type-guard","validationCode":"import json\nfrom pathlib import Path\n\nmanifest = json.loads(Path(\"<run_dir>/imagegen-jobs.json\").read_text())\nfor job in manifest[\"jobs\"]:\n    prov = job.get(\"source_provenance\")\n    if prov == \"deterministic-mirror\":\n        assert job.get(\"id\") == \"running-left\", f\"{job.get('id')} may not use deterministic-mirror provenance\"","typeGuard":"def provenance_allowed(job: dict) -> bool:\n    if job.get(\"source_provenance\") == \"deterministic-mirror\":\n        return job.get(\"id\") == \"running-left\"\n    return True","tryCatchPattern":null,"preventionTips":["Only running-left may be a deterministic mirror; every other state needs a real $imagegen source.","Avoid copy-pasting provenance fields between jobs when editing the manifest.","Run record_imagegen_result.py for non-mirror jobs so provenance is set correctly."],"tags":["hatch-pet","provenance","manifest","mirror"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}