Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(ci): report scratch disk usage per lane on ex63

Steven Enamakel73a2196bc568
diff --git a/scripts/ci/self-hosted/lanes.mjs b/scripts/ci/self-hosted/lanes.mjs
index c11243bf4d..db2076d51e 100644
--- a/scripts/ci/self-hosted/lanes.mjs
+++ b/scripts/ci/self-hosted/lanes.mjs
@@ -190,6 +190,39 @@ function du(path) {
return Number.isFinite(bytes) ? bytes : null;
}
+/**
+ * Where the scratch disk's space goes, for the ex63 profile only: `df -h` of
+ * the scratch mount, then `du -sh` of every top-level entry under `target/` and
+ * of the scratch dir's own top level (the Tinymold store, the checkout). A lane
+ * that fills the disk (EX63 run 39292268284 ran it to 16 MB free) then shows
+ * which directory grew, lane by lane. Returns null off ex63 or without a
+ * scratch dir. `run` is injectable for tests.
+ */
+export function diskUsageReport({
+ profile,
+ scratch = process.env.CI_SCRATCH_DIR,
+ root = ROOT,
+ run = (cmd) =>
+ spawnSync("sh", ["-c", cmd], { encoding: "utf8", cwd: root }).stdout ?? "",
+} = {}) {
+ if (profile !== "ex63" || !scratch) return null;
+ const q = (v) => `'${String(v).replace(/'/g, `'\\''`)}'`;
+ const df = run(`df -h ${q(scratch)} 2>&1`).trim();
+ // `du` exits non-zero on an unreadable entry but still prints the rest.
+ const target = run(`du -sh target/* 2>/dev/null | sort -h -r; true`).trim();
+ const top = run(
+ `du -xsh ${q(scratch)}/* 2>/dev/null | sort -h -r | head -15; true`,
+ ).trim();
+ return [
+ `[ci][lanes][disk] df -h ${scratch}`,
+ df,
+ "[ci][lanes][disk] du -sh target/*",
+ target || "(no target dir)",
+ `[ci][lanes][disk] du -sh ${scratch}/* (top 15)`,
+ top || "(nothing readable)",
+ ].join("\n");
+}
+
/**
* Counting semaphore with priorities (lower first, then FIFO). Heavy lanes
* each compile the whole core crate, several GB of rustc apiece, so the VM
@@ -488,6 +521,8 @@ export class Runner {
);
this.finish(id, record.status);
}
+ const disk = diskUsageReport({ profile: this.plan.profile });
+ if (disk) logStream.write(`\n[ci][lanes] lane ${lane.name} end\n${disk}\n`);
await new Promise((res) => logStream.end(res));
// Dump the whole lane log once, folded, so parallel lanes never interleave.
const failed = results.some((r) => r.status === "failure" && !r.reportOnly);