{"record":{"id":"aadb6fcb04784901","repo":"abhigyanpatwari/GitNexus","slug":"sanitized-graph-source-exceeds-the-scrub-byte-limi","errorCode":null,"errorMessage":"sanitized graph source exceeds the scrub byte limit","messagePattern":"sanitized graph source exceeds the scrub byte limit","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":196,"sourceCode":"            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\n            scanned_bytes += metadata.st_size\n            if scanned_bytes > MAX_GRAPH_SCRUB_TOTAL_BYTES:\n                raise SandboxError(\"sanitized graph source exceeds the scrub byte limit\")\n            descriptor = os.open(entry.path, os.O_RDONLY | getattr(os, \"O_NOFOLLOW\", 0))\n            try:\n                opened = os.fstat(descriptor)\n                if not stat.S_ISREG(opened.st_mode) or (opened.st_dev, opened.st_ino, opened.st_size) != (\n                    metadata.st_dev,\n                    metadata.st_ino,\n                    metadata.st_size,\n                ):\n                    raise SandboxError(f\"sanitized graph source changed while opening: {relative}\")\n                chunks: list[bytes] = []\n                remaining = MAX_GRAPH_SCRUB_FILE_BYTES + 1\n                while remaining > 0:\n                    chunk = os.read(descriptor, min(64 * 1024, remaining))\n                    if not chunk:\n                        break\n                    chunks.append(chunk)\n                    remaining -= len(chunk)\n                payload = b\"\".join(chunks)","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L178-L214","documentation":"Raised when the running total of scanned file bytes exceeds MAX_GRAPH_SCRUB_TOTAL_BYTES (2 GiB). Only files no larger than MAX_GRAPH_SCRUB_FILE_BYTES (512 KiB) each are read for marker matching; if their cumulative size tops 2 GiB the harness aborts rather than read unbounded data.","triggerScenarios":"A seed containing many small files (each <= 512 KiB) whose sizes sum past 2 GiB is fed to the scrubber: e.g. huge docs corpora, thousands of small generated source files, vendored test fixtures.","commonSituations":"Vendored docs or test corpora in the snapshot; a task repo bundling many subprojects; generated/minified trees that survived history pruning.","solutions":["Exclude large corpora (docs, fixtures, generated code) from the task snapshot before graph preparation.","Declare bulky read-only data as sandbox_dependencies instead of sandbox_copy so it bypasses the scrubbed seed.","Raise MAX_GRAPH_SCRUB_TOTAL_BYTES only if the scan budget is genuinely too small and the marker set is still fully checked."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\nfrom workflow_bench.sanitized_graph import MAX_GRAPH_SCRUB_FILE_BYTES, MAX_GRAPH_SCRUB_TOTAL_BYTES\n\ndef estimate_scrub_bytes(root):\n    total = 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        for name in files:\n            try:\n                size = os.stat(os.path.join(dirpath, name)).st_size\n            except OSError:\n                continue\n            if size <= MAX_GRAPH_SCRUB_FILE_BYTES:\n                total += size\n            if total > MAX_GRAPH_SCRUB_TOTAL_BYTES:\n                raise RuntimeError(f\"scrub byte budget exceeded: ~{total} bytes\")\n    return total","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Exclude large docs/fixture corpora from the snapshot.","Declare bulky read-only data as sandbox_dependencies so it bypasses the scrubbed seed.","Pre-sum small-file sizes against MAX_GRAPH_SCRUB_TOTAL_BYTES before building the 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"}