{"record":{"id":"45532d18bbf01a6a","repo":"abhigyanpatwari/GitNexus","slug":"sanitized-graph-source-exceeds-the-scrub-entry-lim","errorCode":null,"errorMessage":"sanitized graph source exceeds the scrub entry limit","messagePattern":"sanitized graph source exceeds the scrub entry limit","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":175,"sourceCode":"\n    marker_bytes = tuple(marker.encode() for marker in GRAPH_MARKERS)\n    pending: list[tuple[Path, PurePosixPath]] = [(root, PurePosixPath())]\n    removed: list[str] = []\n    entries = 0\n    scanned_bytes = 0\n    while pending:\n        directory, relative_directory = pending.pop()\n        try:\n            children = sorted(os.scandir(directory), key=lambda item: item.name, reverse=True)\n        except OSError as exc:\n            raise SandboxError(f\"cannot scan sanitized graph source: {directory}: {exc}\") from exc\n        for entry in children:\n            relative = relative_directory / entry.name\n            if relative.parts[0] in {\".git\", \".gitnexus\"}:\n                continue\n            entries += 1\n            if entries > MAX_GRAPH_SCRUB_ENTRIES:\n                raise SandboxError(\"sanitized graph source exceeds the scrub entry limit\")\n            relative_text = relative.as_posix()\n            metadata = entry.stat(follow_symlinks=False)\n            path_matches = any(marker in relative_text for marker in GRAPH_MARKERS)\n            if path_matches:\n                path = Path(entry.path)\n                if stat.S_ISDIR(metadata.st_mode) and not stat.S_ISLNK(metadata.st_mode):\n                    shutil.rmtree(path)\n                else:\n                    path.unlink()\n                removed.append(relative_text)\n                continue\n            if stat.S_ISDIR(metadata.st_mode):\n                pending.append((Path(entry.path), relative))\n                continue\n            if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):\n                continue\n            if metadata.st_size > MAX_GRAPH_SCRUB_FILE_BYTES:\n                continue","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L157-L193","documentation":"Raised when the cumulative count of visited entries in the seed tree exceeds MAX_GRAPH_SCRUB_ENTRIES (250_000). Each non-.git/.gitnexus entry increments the counter; breaching the cap means the seed is too large to scrub within a bounded time/memory budget, so the harness fails closed rather than scan only part of the tree.","triggerScenarios":"A task whose history-pruned snapshot still contains more than 250_000 non-.git/.gitnexus entries (huge node_modules, generated sources, vendored trees) is passed to prepare_sanitized_graph.","commonSituations":"Task declaration does not exclude node_modules/build outputs; a monorepo snapshot is too broad; scrubbing runs before indexing, so .gitnexusignore neutralization does not reduce file count.","solutions":["Trim the task snapshot so the non-.git/.gitnexus entry count is well under 250_000 (exclude node_modules, dist, build artifacts).","Move bulky read-only subtrees into a sandbox_dependencies mount instead of sandbox_copy so they are not part of the scrubbed seed.","If the limit is genuinely too low for a legitimate task, raise MAX_GRAPH_SCRUB_ENTRIES only after confirming scrub wall-clock stays bounded."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\nfrom workflow_bench.sanitized_graph import MAX_GRAPH_SCRUB_ENTRIES\n\ndef estimate_scrub_entries(root):\n    count = 0\n    for dirpath, dirnames, files in os.walk(root):\n        parts = os.path.relpath(dirpath, root).split(os.sep)\n        if parts and parts[0] in {\".git\", \".gitnexus\"}:\n            dirnames[:] = []\n            continue\n        count += len(dirnames) + len(files)\n        if count > MAX_GRAPH_SCRUB_ENTRIES:\n            raise RuntimeError(f\"seed has ~{count} entries; exceeds scrub limit {MAX_GRAPH_SCRUB_ENTRIES}\")\n    return count","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Exclude node_modules, dist, and build artifacts from the task snapshot.","Prefer sandbox_dependencies for bulky read-only trees over sandbox_copy.","Validate entry count against MAX_GRAPH_SCRUB_ENTRIES before invoking prepare_sanitized_graph."],"tags":["sandbox","limits","workflow-bench","sanitization"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}