abhigyanpatwari/GitNexus · error · ValueError
oracle sanitization left clone references recoverable
Error message
oracle sanitization left clone references recoverable
What it means
Post-condition: after deleting every ref via `update-ref --no-deref -d`, a follow-up `for-each-ref` must return nothing. If any ref survives, the deletion was incomplete (packed refs, concurrent ref creation, or silent update-ref failure) and the clone is not fully sanitized.
Source
Thrown at eval/workflow_bench/oracle_assets.py:417
continue
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):
raise ValueError(f"unsafe Git metadata blocks oracle sanitization: {pseudo_ref}")
path.unlink()
logs = git_dir / "logs"
if logs.exists() or logs.is_symlink():
logs_metadata = logs.lstat()
if stat.S_ISLNK(logs_metadata.st_mode) or not stat.S_ISDIR(logs_metadata.st_mode):
raise ValueError("unsafe Git reflog metadata blocks oracle sanitization")
shutil.rmtree(logs)
_git_checked(root, ["repack", "-A", "-d"], timeout=600)
_git_checked(root, ["prune", "--expire=now"], timeout=600)
_git_checked(root, ["prune-packed"], timeout=600)
remaining_refs = _git_checked(root, ["for-each-ref", "--format=%(refname)"], timeout=60)
if remaining_refs:
raise ValueError("oracle sanitization left clone references recoverable")
fsck = run_checked(
["git", "-C", str(root), "fsck", "--full", "--no-progress", "--no-reflogs", "--unreachable"],
timeout=600,
tail_bytes=MAX_CLONE_REF_BYTES,
)
if fsck.stdout_tail.strip() or fsck.stderr_tail.strip():
raise ValueError("oracle sanitization left unreachable Git objects recoverable")
forbidden_objects: list[tuple[str, str]] = []
if original_head != sanitized_head:
forbidden_objects.append((original_head, "original commit"))
if hidden_tree:
forbidden_objects.append((hidden_tree, "hidden harness tree"))
for forbidden_object, label in forbidden_objects:
probe = run_managed(
["git", "-C", str(root), "cat-file", "-e", forbidden_object],
timeout=60,
)View on GitHub (pinned to d540b00184)
Solutions
- Run `git -C <clone> pack-refs --all --prune` then re-run for-each-ref to see survivors.
- Manually delete surviving refs: `git -C <clone> update-ref -d <survivor>` (quote the name).
- If packed-refs persists, edit or remove .git/packed-refs and run `git -C <clone> reflog expire --all && git -C <clone> gc --prune=now`.
- Re-clone and sanitize with no other git process touching the clone.
Defensive patterns
Strategy: try-catch
Type guard
def is_refs_recoverable(exc: BaseException) -> bool:
return isinstance(exc, ValueError) and "left clone references recoverable" in str(exc)
Try / catch
try:
oracle_assets.sanitize_clone_for_hidden_oracles(clone)
except ValueError as exc:
# Surviving refs imply oracle bytes may be reachable; discard the clone.
quarantine(clone)
raise AbortTask(str(exc)) from exc
Prevention
- Run sanitization on an isolated, single-process clone.
- Pre-emptively `git pack-refs --all --prune` so update-ref deletions cover packed refs.
When it happens
Trigger: Triggered when refs remain after the deletion loop — typically packed-refs entries that update-ref -d did not remove, or a concurrent git process creating refs.
Common situations: A clone whose refs are stored in .git/packed-refs and update-ref left the packed entries; another process (IDE git daemon, concurrent task) writing refs during sanitization; git version quirk in update-ref packed handling.
Related errors
- clone has more than {MAX_CLONE_REFS} references; refusing in
- clone contains an unsafe reference name
- oracle sanitization left unreachable Git objects recoverable
- oracle sanitization left the {label} recoverable
- oracle sanitization could not verify removal of the {label}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/84c51b09fe1fb373.
Report an issue: GitHub.