{"record":{"id":"26d5ae52e05f9960","repo":"abhigyanpatwari/GitNexus","slug":"oracle-sanitization-retained-a-repository-remote","errorCode":null,"errorMessage":"oracle sanitization retained a repository remote","messagePattern":"oracle sanitization retained a repository remote","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":456,"sourceCode":"        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(\n        destination,\n        os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, \"O_NOFOLLOW\", 0),","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L438-L474","documentation":"Post-condition: `git remote` must return nothing after the remote-removal loop. Any output means a remote survived `git remote remove`, leaving remote metadata (and possibly fetch refspecs) that could pull oracle-bearing objects back into the clone.","triggerScenarios":"Triggered when `git remote remove <name>` did not fully clear all remotes — typically because .git/config was edited concurrently, a remote name contained characters the porcelain could not match, or a second remote was added between the list and the removal loop.","commonSituations":"A clone whose .git/config holds remotes with unusual names; concurrent git config edit; a remote re-added by a hook or IDE between enumeration and removal.","solutions":["Inspect: `git -C <clone> remote -v` for survivors.","Remove survivors: `git -C <clone> remote remove <name>`; if that fails, edit .git/config's [remote] sections directly.","Ensure no process re-adds remotes during sanitization; re-clone if needed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from pathlib import Path\nfrom eval.workflow_bench.process_control import run_checked\n\ndef no_remotes(clone: Path) -> bool:\n    return not run_checked([\"git\",\"-C\",str(clone),\"remote\"], timeout=60).stdout_tail.strip()\n","typeGuard":"def is_remote_retained(exc: BaseException) -> bool:\n    return isinstance(exc, ValueError) and \"retained a repository remote\" 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":["Benchmark clones should have all remotes removed before the model runs.","Do not let IDEs or hooks re-add remotes during sanitization."],"tags":["git","remote","config","oracle","sanitization","postcondition","invariant"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}