abhigyanpatwari/GitNexus · critical · ValueError
oracle stage parent changed during verification: {item.targe
Error message
oracle stage parent changed during verification: {item.target} What it means
Same verification pass as error 360, but per-parent-directory: while walking the parents of each staged oracle file (relative.parts[:-1]), every intermediate directory must still be a real directory. A symlink or non-dir parent means the staged path was restructured mid-verification. The harness aborts rather than emit an untrusted result.
Source
Thrown at eval/workflow_bench/oracle_assets.py:501
view = view[written:]
os.fchmod(descriptor, 0o400)
os.fsync(descriptor)
finally:
os.close(descriptor)
def _verify_staged_oracle(stage_root: Path, snapshot: TaskOracleSnapshot) -> None:
root_metadata = stage_root.lstat()
if stat.S_ISLNK(root_metadata.st_mode) or not stat.S_ISDIR(root_metadata.st_mode):
raise ValueError("oracle stage root changed during verification")
for item in snapshot.files:
relative = PurePosixPath(item.target)
current = stage_root
for part in relative.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 changed during verification: {item.target}")
observed = _read_oracle_file(stage_root, relative)
if observed != item.payload:
raise ValueError(f"oracle file changed during verification: {item.target}")
@contextmanager
def staged_task_oracle(worktree: Path, snapshot: TaskOracleSnapshot) -> Iterator[Path]:
"""Materialize a private random oracle root only after the model exits."""
root = worktree.expanduser().absolute()
metadata = root.lstat()
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode) or root.resolve(strict=True) != root:
raise ValueError(f"oracle worktree must be a real non-symlink directory: {root}")
stage_root = root / f".wfbench-oracle-{secrets.token_hex(16)}"
stage_root.mkdir(mode=0o700)
stage_root.chmod(0o700)
primary: BaseException | None = None
try:View on GitHub (pinned to d540b00184)
Solutions
- Use the {item.target} in the message to identify the affected oracle file, then inspect each parent segment under stage_root with `ls -la` / `readlink`.
- Ensure the worktree is on a real local directory and no other process is mutating it during the run.
- Audit the agent under test for symlink creation or directory replacement inside the oracle stage path.
- Re-stage from a fresh clone and re-run.
Defensive patterns
Strategy: validation
Validate before calling
# Verify every parent of every oracle target is a real dir before staging.
import stat
from pathlib import Path, PurePosixPath
def precheck_parents(stage_root: Path, targets: list[str]) -> None:
for t in targets:
cur = stage_root
for part in PurePosixPath(t).parts[:-1]:
cur /= part
# Parents don't have to exist yet (the harness mkdir's them), but if
# they DO exist they must be real directories.
try:
st = cur.lstat()
except FileNotFoundError:
continue
assert stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode), \
f'{cur} is not a real directory' Try / catch
try:
with staged_task_oracle(worktree, snapshot) as stage:
...
except ValueError as exc:
if 'stage parent changed' in str(exc):
log.security('oracle parent replaced mid-run: %s', exc)
invalidate_run()
raise Prevention
- Ensure no concurrent process can create symlinks inside the worktree during the run.
- Run on local disk; avoid overlay/sync filesystems.
- Audit the agent under test for any symlink creation under the worktree.
When it happens
Trigger: Triggered inside _verify_staged_oracle's parent walk when any intermediate `current /= part` resolves to a symlink or non-directory. Common when a deep oracle path like `a/b/c/d.txt` has had `a` or `b` replaced after staging.
Common situations: An agent under test replaces a directory with a symlink to escape the sandbox; a symlink-based mirror of the worktree; concurrent git operations (checkout/clone) inside the worktree; running on a filesystem with case-folding collisions.
Related errors
- oracle source changed while being captured: {relative}
- oracle stage root changed during verification
- oracle file changed during verification: {item.target}
- oracle root must be a real non-symlink directory: {lexical}
- oracle parents must be real directories: {relative}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/feaebba202e2017a.
Report an issue: GitHub.