{"record":{"id":"87aa7125fb8e770c","repo":"abhigyanpatwari/GitNexus","slug":"oracle-sanitization-snapshot-unexpectedly-retained","errorCode":null,"errorMessage":"oracle sanitization snapshot unexpectedly retained parent history","messagePattern":"oracle sanitization snapshot unexpectedly retained parent history","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":454,"sourceCode":"        if probe.ok:\n            raise ValueError(f\"oracle sanitization left the {label} recoverable\")\n        if probe.state != \"exited\" or probe.returncode not in {1, 128}:\n            raise ValueError(f\"oracle sanitization could not verify removal of the {label}\")\n\n    hidden_listing = _git_checked(\n        root,\n        [\"ls-tree\", \"-r\", \"--name-only\", \"HEAD\", \"--\", HIDDEN_HARNESS_PATH.as_posix()],\n        timeout=60,\n    )\n    if hidden_listing or current.exists() or current.is_symlink():\n        raise ValueError(\"oracle sanitization left the benchmark harness visible\")\n    if _git_checked(root, [\"status\", \"--porcelain=v1\", \"--untracked-files=all\"], timeout=60):\n        raise ValueError(\"oracle sanitization did not produce a clean task snapshot\")\n    if _git_checked(root, [\"rev-parse\", \"--verify\", \"HEAD^{commit}\"], timeout=60) != sanitized_head:\n        raise ValueError(\"oracle sanitization did not retain its parentless task snapshot\")\n    parents = _git_checked(root, [\"show\", \"-s\", \"--format=%P\", \"HEAD\"], timeout=60)\n    if parents:\n        raise ValueError(\"oracle sanitization snapshot unexpectedly retained parent history\")\n    if _git_checked(root, [\"remote\"], timeout=60):\n        raise ValueError(\"oracle sanitization retained a repository remote\")\n    if logs.exists() or logs.is_symlink():\n        raise ValueError(\"oracle sanitization retained reflog metadata\")\n    return sanitized_head\n\n\ndef _write_stage_file(stage_root: Path, item: OracleFileSnapshot) -> None:\n    destination = stage_root.joinpath(*PurePosixPath(item.target).parts)\n    destination.parent.mkdir(parents=True, mode=0o700, exist_ok=True)\n    current = stage_root\n    for part in PurePosixPath(item.target).parts[:-1]:\n        current /= part\n        metadata = current.lstat()\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise ValueError(f\"oracle stage parent must be a real directory: {item.target}\")\n        current.chmod(0o700)\n    descriptor = os.open(","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L436-L472","documentation":"Post-condition: `git show -s --format=%P HEAD` must be empty — the sanitized commit must be a root (parentless) commit, because it was created with `commit-tree <tree>` and no parent arguments. Any parent line means HEAD is not the intended sanitized commit or commit-tree was given parents unexpectedly.","triggerScenarios":"Triggered when HEAD has parent lines after sanitization. Since the code passes no -p args to commit-tree, this fires when HEAD drifted to a different commit, or git config injected parent behavior (very unlikely), or the deterministic-git-env block was bypassed.","commonSituations":"HEAD moved to a non-sanitized commit between commit-tree and this check (see [354]); a git version/config that adds default parents; an externally set GIT_COMMIT_TREE_PARENT env var consumed by a custom hook.","solutions":["Inspect the commit: `git -C <clone> cat-file -p HEAD` and look for 'parent' lines.","Verify HEAD identity: `git -C <clone> rev-parse HEAD^{commit}` equals sanitized_head (see [354]).","Ensure no hooks or env vars inject parents into commit-tree; re-clone and sanitize cleanly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from pathlib import Path\nfrom eval.workflow_bench.process_control import run_checked\n\ndef is_parentless(clone: Path) -> bool:\n    parents = run_checked([\"git\",\"-C\",str(clone),\"show\",\"-s\",\"--format=%P\",\"HEAD\"], timeout=60).stdout_tail.strip()\n    return not parents\n","typeGuard":"def is_parent_history_retained(exc: BaseException) -> bool:\n    return isinstance(exc, ValueError) and \"unexpectedly retained parent history\" in str(exc)\n","tryCatchPattern":"try:\n    oracle_assets.sanitize_clone_for_hidden_oracles(clone)\nexcept ValueError as exc:\n    quarantine(clone)\n    raise AbortTask(str(exc)) from exc\n","preventionTips":["Run sanitization in the deterministic git env the harness already constructs (no extra GIT_* vars).","Disable hooks so nothing rewrites the freshly created commit."],"tags":["git","commit-tree","parent","oracle","sanitization","postcondition","invariant"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}