{"record":{"id":"d4b7a965c2b54e62","repo":"abhigyanpatwari/GitNexus","slug":"sanitized-graph-metadata-is-not-bound-to-the-paren","errorCode":null,"errorMessage":"sanitized graph metadata is not bound to the parentless task commit","messagePattern":"sanitized graph metadata is not bound to the parentless task commit","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":327,"sourceCode":"        capture_stdout=True,\n    )\n    assert node_result is not None and relation_result is not None\n    _parse_empty_query(node_result, label=\"sanitized graph node proof\")\n    _parse_empty_query(relation_result, label=\"sanitized graph relation proof\")\n\n\ndef _validate_graph_metadata(root: Path, sanitized_head: str) -> None:\n    for name in (\"gitnexus.json\", \"meta.json\", \"lbug\"):\n        path = root / \".gitnexus\" / name\n        metadata = path.lstat()\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):\n            raise SandboxError(f\"sanitized graph asset must be regular and non-symlink: {path}\")\n    try:\n        metadata_payload = json.loads((root / \".gitnexus\" / \"gitnexus.json\").read_text())\n    except (OSError, json.JSONDecodeError) as exc:\n        raise SandboxError(\"sanitized graph metadata is malformed\") from exc\n    if metadata_payload.get(\"lastCommit\") != sanitized_head:\n        raise SandboxError(\"sanitized graph metadata is not bound to the parentless task commit\")\n    if not isinstance(metadata_payload.get(\"pdg\"), dict) or not metadata_payload[\"pdg\"]:\n        raise SandboxError(\"sanitized graph metadata does not prove a --pdg build\")\n\n\ndef prepare_sanitized_graph(\n    task: Mapping[str, Any],\n    *,\n    repo: Path,\n    resolved_sha: str,\n    parent: Path,\n    cache: TaskAssetCache,\n    claude_bin: Path | str,\n    bwrap_bin: Path | str,\n    runtime_mounts: Sequence[ReadOnlyMount],\n) -> SanitizedGraphSnapshot:\n    \"\"\"Sanitize, index offline once, scrub, and freeze graph assets for all arms.\"\"\"\n\n    validate_no_prebuilt_graph_assets(task)","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L309-L345","documentation":"gitnexus.json's lastCommit field must equal sanitized_head (the parentless commit produced by sanitize_clone_for_hidden_oracles). A mismatch means the graph was indexed from a different commit than the sanitized seed, breaking the integrity binding between the graph and the arm checkout.","triggerScenarios":"The graph metadata's lastCommit differs from sanitized_head: a stale/cached graph reused across different seeds, a worktree checked out at the wrong sha, or metadata rewritten by the target.","commonSituations":"resolved_sha mismatch between make_worktree and the sanitizer; an external process rewrote .gitnexus/gitnexus.json after analyze; the worktree was on a different branch/default-branch than expected.","solutions":["Confirm resolved_sha passed to prepare_sanitized_graph matches what make_worktree checks out and what the sanitizer returns as sanitized_head.","Ensure no step rewrites .gitnexus/gitnexus.json after analyze.","Rebuild the graph so lastCommit is freshly bound to the current sanitized_head."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import json, os\n\ndef assert_last_commit_matches(root, sanitized_head):\n    payload = json.loads(open(os.path.join(root, \".gitnexus\", \"gitnexus.json\")).read())\n    if payload.get(\"lastCommit\") != sanitized_head:\n        raise RuntimeError(f\"lastCommit {payload.get('lastCommit')!r} != sanitized_head {sanitized_head!r}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass the same resolved_sha to make_worktree and prepare_sanitized_graph.","Never rewrite .gitnexus/gitnexus.json after analyze.","Rebuild the graph whenever the sanitized_head changes."],"tags":["integrity","gitnexus","workflow-bench","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}