{"record":{"id":"db2e2afeaa05fd75","repo":"abhigyanpatwari/GitNexus","slug":"results-directory-must-be-a-real-non-symlink-direc","errorCode":null,"errorMessage":"results directory must be a real non-symlink directory: {root}","messagePattern":"results directory must be a real non-symlink directory: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/evolve.py","lineNumber":295,"sourceCode":"\ndef _bounded_regular_text(path: Path, limit: int = MAX_EVIDENCE_FILE_BYTES) -> str:\n    mode = path.lstat().st_mode\n    if path.is_symlink() or not stat.S_ISREG(mode):\n        raise SandboxError(f\"evidence source must be a regular non-symlink file: {path}\")\n    with path.open(\"rb\") as handle:\n        if path.stat().st_size > limit:\n            handle.seek(-limit, os.SEEK_END)\n        return handle.read(limit).decode(errors=\"replace\")\n\n\ndef _real_results_root(results_dir: Path) -> Path:\n    root = results_dir.expanduser().absolute()\n    try:\n        metadata = root.lstat()\n    except OSError as exc:\n        raise SandboxError(f\"results directory is unavailable: {root}: {exc}\") from exc\n    if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n        raise SandboxError(f\"results directory must be a real non-symlink directory: {root}\")\n    if root.resolve(strict=True) != root:\n        raise SandboxError(f\"results directory must not traverse symlinks: {root}\")\n    return root\n\n\ndef _results_artifact_path(root: Path, relative_value: str, *, transcript: bool) -> Path:\n    relative = PurePosixPath(relative_value)\n    expected_parts = 2 if transcript else 1\n    if (\n        relative.is_absolute()\n        or len(relative.parts) != expected_parts\n        or any(part in {\"\", \".\", \"..\"} for part in relative.parts)\n        or (transcript and relative.parts[0] != \"transcripts\")\n    ):\n        raise SandboxError(f\"unsafe results artifact path: {relative_value!r}\")\n    current = root\n    for part in relative.parts[:-1]:\n        current /= part","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/evolve.py#L277-L313","documentation":"After lstat succeeds, _real_results_root checks the mode: if it is a symlink (stat.S_ISLNK) or not a directory (not stat.S_ISDIR) the path is rejected. lstat is used intentionally so a symlink-to-a-directory is still treated as a symlink and refused — the harness must bind a real directory inode, not an indirectable link.","triggerScenarios":"results_dir is a regular file (e.g. a results.jsonl passed by mistake instead of its parent dir), a symlink to a directory, or a block/char device.","commonSituations":"User passes the results file instead of the dir; a convenience symlink (`ln -s /mnt/nfs/results ~/results`) used as the argument; a packaging artifact written over the dir.","solutions":["Check the inode type: `ls -ldH <results_dir>` (note the `-H` follows the argument symlink; you want to see a real dir with no arrow).","Pass the real directory, not a symlink to it.","If a file was created in its place, remove it and recreate the directory."],"exampleFix":"# before: ~/results is a symlink\nln -s /mnt/nfs/results ~/results\nproposer_evidence_entries(results_dir=Path(\"~/results\").expanduser(), ...)\n\n# after: bind the real directory\nproposer_evidence_entries(results_dir=Path(\"/mnt/nfs/results\"), ...)","handlingStrategy":"validation","validationCode":"import stat\nfrom pathlib import Path\n\ndef is_real_results_dir(path: Path) -> bool:\n    try:\n        m = path.expanduser().absolute().lstat().st_mode\n    except OSError:\n        return False\n    return stat.S_ISDIR(m) and not stat.S_ISLNK(m)","typeGuard":"import stat\nfrom pathlib import Path\n\ndef is_non_symlink_directory(path: Path) -> bool:\n    m = path.lstat().st_mode\n    return stat.S_ISDIR(m) and not stat.S_ISLNK(m)","tryCatchPattern":null,"preventionTips":["Pass the results directory, not the results.jsonl file.","Do not symlink the results root; bind a real directory inode.","Resolve the path before passing: realpath must equal the given path."],"tags":["workflow-bench","sandbox","filesystem","results-dir","symlink"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}