{"record":{"id":"182db2df46475073","repo":"abhigyanpatwari/GitNexus","slug":"evidence-bundle-exceeds-the-total-byte-limit","errorCode":null,"errorMessage":"evidence bundle exceeds the total byte limit","messagePattern":"evidence bundle exceeds the total byte limit","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":236,"sourceCode":"    \"\"\"Write a redacted owner-only evidence bundle with hard byte caps.\"\"\"\n\n    destination = destination.resolve()\n    if destination.exists():\n        raise SandboxError(f\"evidence destination already exists: {destination}\")\n    destination.mkdir(parents=True, mode=0o700)\n    destination.chmod(0o700)\n    total = 0\n    try:\n        for name, value in entries.items():\n            relative = PurePosixPath(name)\n            if len(relative.parts) != 1 or relative.name in {\"\", \".\", \"..\"}:\n                raise SandboxError(f\"evidence names must be simple relative files: {name!r}\")\n            payload = _evidence_bytes(value, secrets)\n            if len(payload) > MAX_EVIDENCE_FILE_BYTES:\n                raise SandboxError(f\"evidence exceeds the per-file limit: {name}\")\n            total += len(payload)\n            if total > MAX_BUNDLE_BYTES:\n                raise SandboxError(\"evidence bundle exceeds the total byte limit\")\n            path = destination / relative.name\n            path.write_bytes(payload)\n            path.chmod(0o600)\n    except BaseException:\n        shutil.rmtree(destination, ignore_errors=True)\n        raise\n    return destination\n\n\ndef _validated_base_url(base_url: str) -> str:\n    value = base_url.strip()\n    parsed = urlsplit(value)\n    if (\n        parsed.scheme not in {\"http\", \"https\"}\n        or not parsed.hostname\n        or parsed.username is not None\n        or parsed.password is not None\n        or parsed.query","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L218-L254","documentation":"Raised by stage_evidence_bundle when the running total of staged (redacted) payload bytes exceeds MAX_BUNDLE_BYTES (2 MiB). Each entry's payload length is added to a cumulative total and the check fires after the per-file cap, so the whole bundle is bounded at 2 MiB regardless of how many entries.","triggerScenarios":"Summing many <=256 KiB entries, or a few large ones, pushes the cumulative redacted byte count past 2097152.","commonSituations":"Staging every artifact greedily instead of a curated set; many test output files each near the per-file cap; a directory walk staged dozens of files; a retry that appended to a previously sized set without resetting.","solutions":["Stage only the evidence the grader actually needs; drop redundant or duplicate artifacts.","Drop the largest/lowest-value entries first until under 2 MiB.","If the full set is required, run multiple bundles and reference them separately.","Compress text-heavy content (gzip) before staging and note the encoding in the name."],"exampleFix":"// before\nstage_evidence_bundle(dest, {p.name: p for p in workspace.glob('**/*')})\n// after\nkeep = [p for p in workspace.glob('**/*') if p.suffix in {'.log','.txt'}][:10]\nstage_evidence_bundle(dest, {p.name: p for p in keep})","handlingStrategy":"validation","validationCode":"from eval.workflow_bench.proposer_sandbox import MAX_BUNDLE_BYTES, MAX_EVIDENCE_FILE_BYTES\n\ndef total_size(entries) -> int:\n    total = 0\n    for v in entries.values():\n        if isinstance(v, (bytes, bytearray)): total += len(v)\n        elif isinstance(v, str): total += len(v)\n        else: total += MAX_EVIDENCE_FILE_BYTES  # conservative estimate\n    return total\n\nif total_size(entries) > MAX_BUNDLE_BYTES:\n    prune_to_fit(entries, MAX_BUNDLE_BYTES)","typeGuard":"null","tryCatchPattern":"try:\n    stage_evidence_bundle(dest, entries, secrets=secrets)\nexcept SandboxError as exc:\n    if 'total byte limit' in str(exc):\n        drop_largest_until_fits(entries, MAX_BUNDLE_BYTES)\n        stage_evidence_bundle(dest, entries, secrets=secrets)\n    raise","preventionTips":["Curate evidence; stage only what the grader needs.","Sum projected sizes before staging and prune the largest.","Avoid staging whole directory walks unfiltered.","Split very large capture across multiple bundles."],"tags":["evidence","size-limit","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}