{"record":{"id":"f88a8a82cdcc6093","repo":"abhigyanpatwari/GitNexus","slug":"hidden-oracle-sandbox-does-not-bind-the-credited-w","errorCode":null,"errorMessage":"hidden oracle sandbox does not bind the credited worktree","messagePattern":"hidden oracle sandbox does not bind the credited worktree","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runner.py","lineNumber":283,"sourceCode":"                stdout_tail=\"\",\n                stderr_tail=\"\",\n                detail=result.process.detail or \"verifier infrastructure failed\",\n            )\n            raise ManagedProcessError(result.command, safe_process)\n        return result.passed, result.output\n    return result\n\n\ndef _run_hidden_oracle(\n    snapshot: TaskOracleSnapshot,\n    worktree: Path,\n    args: argparse.Namespace,\n    sandbox: SandboxSession,\n) -> tuple[bool, str]:\n    \"\"\"Stage a captured oracle after the model exits, execute it, then erase it.\"\"\"\n\n    if worktree.expanduser().absolute() != sandbox.clone.expanduser().absolute():\n        raise SandboxError(\"hidden oracle sandbox does not bind the credited worktree\")\n    mount_name = f\".wfbench-oracle-{secrets.token_hex(16)}\"\n    mount_point = worktree / mount_name\n    mount_point.mkdir(mode=0o700)\n    primary: BaseException | None = None\n    try:\n        with staged_task_oracle(sandbox.private_root, snapshot) as stage_root:\n            oracle_env = build_sandbox_environment()\n            # A private RO bind at a random workspace sibling preserves each\n            # oracle's ../gitnexus import as the candidate implementation. The\n            # empty mountpoint exists only post-model and is removed before the\n            # credited patch is captured.\n            oracle_mount = f\"{SANDBOX_WORKSPACE}/{mount_name}\"\n            oracle_env[ORACLE_ENV_VAR] = oracle_mount\n            passed, _output = _verification_outcome(\n                run_verify(\n                    snapshot.command,\n                    sandbox.clone,\n                    args.timeout,","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner.py#L265-L301","documentation":"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.","triggerScenarios":"_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.","commonSituations":"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.","solutions":["Ensure the SandboxSession passed to _run_hidden_oracle was built with clone=worktree (the same Path object / same expanded absolute path).","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 '~').","Do not reuse a sandbox across worktrees; build a fresh sandbox per worktree per arm.","If worktree roots are symlinked, resolve them consistently before building the sandbox and the worktree handle."],"exampleFix":"// before — sandbox built for a different/stale worktree\nsandbox = prepare_sandbox(clone=old_worktree, ...)\n_run_hidden_oracle(snapshot, worktree=new_worktree, args, sandbox)\n// after — bind the sandbox to the exact credited worktree\nsandbox = prepare_sandbox(clone=new_worktree, ...)\n_run_hidden_oracle(snapshot, worktree=new_worktree, args, sandbox)","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef sandbox_binds_worktree(sandbox_clone: Path, worktree: Path) -> bool:\n    return sandbox_clone.expanduser().absolute() == worktree.expanduser().absolute()\n\n# call before _run_hidden_oracle:\nassert sandbox_binds_worktree(sandbox.clone, worktree), (\n    f'sandbox.clone={sandbox.clone} != worktree={worktree}'\n)","typeGuard":null,"tryCatchPattern":"from .proposer_sandbox import SandboxError\n\ntry:\n    _run_hidden_oracle(snapshot, worktree, args, sandbox)\nexcept SandboxError as exc:\n    # sandbox not bound to credited worktree; rebuild sandbox for this worktree\n    raise","preventionTips":["Build the SandboxSession with clone=<the exact worktree> per arm; never reuse across worktrees.","Normalize both paths with expanduser().absolute() before comparing.","Avoid symlinked worktree roots, or resolve them consistently on both sides."],"tags":["sandbox","oracle","integrity","worktree","trust-boundary"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}