abhigyanpatwari/GitNexus · error · SandboxError

hidden oracle sandbox does not bind the credited worktree

Error message

hidden oracle sandbox does not bind the credited worktree

What it means

Raised by _run_hidden_oracle when the sandbox session's clone path does not equal the credited worktree path (both expanduser().absolute()). The hidden oracle must execute inside the exact worktree whose patch will be credited, so that the behavioral test runs against the same tree the score is assigned to. Any mismatch is treated as a containment/credit integrity failure and aborts before the oracle is staged.

Source

Thrown at eval/workflow_bench/runner.py:283

                stdout_tail="",
                stderr_tail="",
                detail=result.process.detail or "verifier infrastructure failed",
            )
            raise ManagedProcessError(result.command, safe_process)
        return result.passed, result.output
    return result


def _run_hidden_oracle(
    snapshot: TaskOracleSnapshot,
    worktree: Path,
    args: argparse.Namespace,
    sandbox: SandboxSession,
) -> tuple[bool, str]:
    """Stage a captured oracle after the model exits, execute it, then erase it."""

    if worktree.expanduser().absolute() != sandbox.clone.expanduser().absolute():
        raise SandboxError("hidden oracle sandbox does not bind the credited worktree")
    mount_name = f".wfbench-oracle-{secrets.token_hex(16)}"
    mount_point = worktree / mount_name
    mount_point.mkdir(mode=0o700)
    primary: BaseException | None = None
    try:
        with staged_task_oracle(sandbox.private_root, snapshot) as stage_root:
            oracle_env = build_sandbox_environment()
            # A private RO bind at a random workspace sibling preserves each
            # oracle's ../gitnexus import as the candidate implementation. The
            # empty mountpoint exists only post-model and is removed before the
            # credited patch is captured.
            oracle_mount = f"{SANDBOX_WORKSPACE}/{mount_name}"
            oracle_env[ORACLE_ENV_VAR] = oracle_mount
            passed, _output = _verification_outcome(
                run_verify(
                    snapshot.command,
                    sandbox.clone,
                    args.timeout,

View on GitHub (pinned to d540b00184)

Solutions

  1. Ensure the SandboxSession passed to _run_hidden_oracle was built with clone=worktree (the same Path object / same expanded absolute path).
  2. Compare the two paths exactly as the code does — expanduser().absolute() on both — and reconcile the difference (a trailing symlink, a '..' segment, or a non-expanded '~').
  3. Do not reuse a sandbox across worktrees; build a fresh sandbox per worktree per arm.
  4. If worktree roots are symlinked, resolve them consistently before building the sandbox and the worktree handle.

Example fix

// before — sandbox built for a different/stale worktree
sandbox = prepare_sandbox(clone=old_worktree, ...)
_run_hidden_oracle(snapshot, worktree=new_worktree, args, sandbox)
// after — bind the sandbox to the exact credited worktree
sandbox = prepare_sandbox(clone=new_worktree, ...)
_run_hidden_oracle(snapshot, worktree=new_worktree, args, sandbox)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def sandbox_binds_worktree(sandbox_clone: Path, worktree: Path) -> bool:
    return sandbox_clone.expanduser().absolute() == worktree.expanduser().absolute()

# call before _run_hidden_oracle:
assert sandbox_binds_worktree(sandbox.clone, worktree), (
    f'sandbox.clone={sandbox.clone} != worktree={worktree}'
)

Try / catch

from .proposer_sandbox import SandboxError

try:
    _run_hidden_oracle(snapshot, worktree, args, sandbox)
except SandboxError as exc:
    # sandbox not bound to credited worktree; rebuild sandbox for this worktree
    raise

Prevention

When it happens

Trigger: _run_hidden_oracle(snapshot, worktree, args, sandbox) is called with a sandbox whose .clone is a different path than the passed-in worktree — e.g. the sandbox was prepared for a different worktree, or the worktree was moved/recreated after the sandbox was built.

Common situations: Refactoring that builds the SandboxSession once and reuses it across multiple worktrees; a worktree path that was absolute-but-not-expanded (~/...) so expanduser() yields a different string; symlinked worktree roots where one side resolves through a symlink and the other does not; concurrent run plumbing that pairs the wrong sandbox with the wrong worktree.

Related errors


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