abhigyanpatwari/GitNexus · error · ValueError

oracle sanitization did not produce a clean task snapshot

Error message

oracle sanitization did not produce a clean task snapshot

What it means

Post-condition: `git status --porcelain=v1 --untracked-files=all` must be empty after building the parentless commit. Any output means the worktree has uncommitted or untracked changes, so the 'clean task snapshot' invariant fails.

Source

Thrown at eval/workflow_bench/oracle_assets.py:449

    for forbidden_object, label in forbidden_objects:
        probe = run_managed(
            ["git", "-C", str(root), "cat-file", "-e", forbidden_object],
            timeout=60,
        )
        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

View on GitHub (pinned to d540b00184)

Solutions

  1. Run `git -C <clone> status --porcelain=v1 --untracked-files=all` to see the offenders.
  2. Remove untracked files: `git -C <clone> clean -fdx`, then re-verify and rebuild the snapshot.
  3. Ensure no process writes to the clone during sanitization.
Defensive patterns

Strategy: try-catch

Validate before calling

from pathlib import Path
from eval.workflow_bench.process_control import run_checked

def worktree_is_clean(clone: Path) -> bool:
    out = run_checked(["git","-C",str(clone),"status","--porcelain=v1","--untracked-files=all"], timeout=60).stdout_tail.strip()
    return not out

Type guard

def is_dirty_snapshot(exc: BaseException) -> bool:
    return isinstance(exc, ValueError) and "did not produce a clean task snapshot" 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

When it happens

Trigger: Triggered when the worktree is dirty after sanitization — stray files, the harness dir recreated, index/worktree drift after write-tree, or a setup step that wrote into the clone.

Common situations: A leftover untracked file from a prior run; git rm modified the index but a parallel process wrote a new file; editor swap files; OS-index/Thumbs.db-style artifacts.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/feb6ebbc44eb2c40. Report an issue: GitHub.