{"record":{"id":"f4653c41c9e8a64d","repo":"abhigyanpatwari/GitNexus","slug":"short-write-while-staging-oracle","errorCode":null,"errorMessage":"short write while staging oracle","messagePattern":"short write while staging oracle","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":482,"sourceCode":"    destination.parent.mkdir(parents=True, mode=0o700, exist_ok=True)\n    current = stage_root\n    for part in PurePosixPath(item.target).parts[:-1]:\n        current /= part\n        metadata = current.lstat()\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise ValueError(f\"oracle stage parent must be a real directory: {item.target}\")\n        current.chmod(0o700)\n    descriptor = os.open(\n        destination,\n        os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, \"O_NOFOLLOW\", 0),\n        0o400,\n    )\n    try:\n        view = memoryview(item.payload)\n        while view:\n            written = os.write(descriptor, view)\n            if written <= 0:\n                raise OSError(\"short write while staging oracle\")\n            view = view[written:]\n        os.fchmod(descriptor, 0o400)\n        os.fsync(descriptor)\n    finally:\n        os.close(descriptor)\n\n\ndef _verify_staged_oracle(stage_root: Path, snapshot: TaskOracleSnapshot) -> None:\n    root_metadata = stage_root.lstat()\n    if stat.S_ISLNK(root_metadata.st_mode) or not stat.S_ISDIR(root_metadata.st_mode):\n        raise ValueError(\"oracle stage root changed during verification\")\n    for item in snapshot.files:\n        relative = PurePosixPath(item.target)\n        current = stage_root\n        for part in relative.parts[:-1]:\n            current /= part\n            metadata = current.lstat()\n            if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L464-L500","documentation":"The only OSError in this set, raised inside _write_stage_file when os.write() returns <= 0 during the staged write loop. Writes to a regular file should never return 0; a non-positive return indicates a filesystem-level failure (ENOSPC, EIO, quota, or a full tmpfs/NFS write boundary).","triggerScenarios":"Triggered when os.write(descriptor, view) returns 0 or negative while staging oracle bytes into .wfbench-oracle-<hex>/<target> — disk full, quota exceeded, NFS/overlayfs write error, or the staging FS was a pipe/special file substituted via a race.","commonSituations":"Out-of-disk on the worktree volume; a small tmpfs used for staging; a quota limit hit mid-write; overlayfs ENOSPC; a model process racing to replace the file with a pipe.","solutions":["Check free space and quota: `df -h <worktree>` and `quota -s` (if applicable).","Point the worktree at a local filesystem with headroom >= MAX_ORACLE_TOTAL_BYTES.","Ensure the stage root is a real directory and the file is a regular file (see [358]) before writing.","Retry staging on a clean FS after freeing space; if it recurs, treat the FS as unhealthy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os, shutil\nfrom pathlib import Path\nfrom eval.workflow_bench.oracle_assets import MAX_ORACLE_TOTAL_BYTES\n\ndef stage_has_headroom(worktree: Path) -> bool:\n    usage = shutil.disk_usage(worktree)\n    return usage.free >= MAX_ORACLE_TOTAL_BYTES\n","typeGuard":"def is_oracle_short_write(exc: BaseException) -> bool:\n    return isinstance(exc, OSError) and \"short write\" in str(exc)\n","tryCatchPattern":"try:\n    with oracle_assets.staged_task_oracle(worktree, snapshot) as root:\n        run_command(root)\nexcept OSError as exc:\n    raise AbortTask(f\"oracle staging I/O failed: {exc}\") from exc\n","preventionTips":["Provision >= MAX_ORACLE_TOTAL_BYTES (2 MiB) plus margin on the staging volume.","Use a local non-special filesystem for the worktree, not a pipe/special device."],"tags":["io","filesystem","enospc","quota","staging","oracle","invariant"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}