abhigyanpatwari/GitNexus · error · ValueError
oracle sanitization snapshot unexpectedly retained parent hi
Error message
oracle sanitization snapshot unexpectedly retained parent history
What it means
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.
Source
Thrown at eval/workflow_bench/oracle_assets.py:454
if probe.ok:
raise ValueError(f"oracle sanitization left the {label} recoverable")
if probe.state != "exited" or probe.returncode not in {1, 128}:
raise ValueError(f"oracle sanitization could not verify removal of the {label}")
hidden_listing = _git_checked(
root,
["ls-tree", "-r", "--name-only", "HEAD", "--", HIDDEN_HARNESS_PATH.as_posix()],
timeout=60,
)
if hidden_listing or current.exists() or current.is_symlink():
raise ValueError("oracle sanitization left the benchmark harness visible")
if _git_checked(root, ["status", "--porcelain=v1", "--untracked-files=all"], timeout=60):
raise ValueError("oracle sanitization did not produce a clean task snapshot")
if _git_checked(root, ["rev-parse", "--verify", "HEAD^{commit}"], timeout=60) != sanitized_head:
raise ValueError("oracle sanitization did not retain its parentless task snapshot")
parents = _git_checked(root, ["show", "-s", "--format=%P", "HEAD"], timeout=60)
if parents:
raise ValueError("oracle sanitization snapshot unexpectedly retained parent history")
if _git_checked(root, ["remote"], timeout=60):
raise ValueError("oracle sanitization retained a repository remote")
if logs.exists() or logs.is_symlink():
raise ValueError("oracle sanitization retained reflog metadata")
return sanitized_head
def _write_stage_file(stage_root: Path, item: OracleFileSnapshot) -> None:
destination = stage_root.joinpath(*PurePosixPath(item.target).parts)
destination.parent.mkdir(parents=True, mode=0o700, exist_ok=True)
current = stage_root
for part in PurePosixPath(item.target).parts[:-1]:
current /= part
metadata = current.lstat()
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):
raise ValueError(f"oracle stage parent must be a real directory: {item.target}")
current.chmod(0o700)
descriptor = os.open(View on GitHub (pinned to d540b00184)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
from eval.workflow_bench.process_control import run_checked
def is_parentless(clone: Path) -> bool:
parents = run_checked(["git","-C",str(clone),"show","-s","--format=%P","HEAD"], timeout=60).stdout_tail.strip()
return not parents
Type guard
def is_parent_history_retained(exc: BaseException) -> bool:
return isinstance(exc, ValueError) and "unexpectedly retained parent history" in str(exc)
Try / catch
try:
oracle_assets.sanitize_clone_for_hidden_oracles(clone)
except ValueError as exc:
quarantine(clone)
raise AbortTask(str(exc)) from exc
Prevention
- Run sanitization in the deterministic git env the harness already constructs (no extra GIT_* vars).
- Disable hooks so nothing rewrites the freshly created commit.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- oracle sanitization left clone references recoverable
- oracle sanitization left unreachable Git objects recoverable
- oracle sanitization left the {label} recoverable
- oracle sanitization could not verify removal of the {label}
- oracle sanitization left the benchmark harness visible
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/87aa7125fb8e770c.
Report an issue: GitHub.