Skip to content

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

chore(bench): remove unused rename-harness files

Steven Enamakel70f9f1aa2735
diff --git a/bench/harnesses/rename-harness.mjs b/bench/harnesses/rename-harness.mjs
new file mode 100644
index 0000000000..88c9848631
--- /dev/null
+++ b/bench/harnesses/rename-harness.mjs
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+// rename-harness.mjs — rename a harness inside one finished run: its result
+// directory, its runs.jsonl rows and its meter.jsonl records.
+// node rename-harness.mjs <run-id> <from> <to>
+// Used when a variant is promoted (openhuman-native -> openhuman) and the old
+// default is archived under another name (openhuman -> openhuman-python). Do the
+// archive rename first. Do not run it while that run is still executing.
+
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+
+export function renameInJsonl(file, runId, from, to) {
+ if (!fs.existsSync(file)) return 0;
+ let changed = 0;
+ const out = fs
+ .readFileSync(file, "utf8")
+ .split("\n")
+ .map((line) => {
+ if (!line) return line;
+ const row = JSON.parse(line);
+ if (row.run_id === runId && row.harness === from) {
+ row.harness = to;
+ changed += 1;
+ return JSON.stringify(row);
+ }
+ return line;
+ })
+ .join("\n");
+ fs.writeFileSync(file, out);
+ return changed;
+}
+
+function main() {
+ const [runId, from, to] = process.argv.slice(2);
+ if (!runId || !from || !to) throw new Error("usage: rename-harness.mjs <run-id> <from> <to>");
+ const runDir = path.join(here, "results", runId);
+ const src = path.join(runDir, from);
+ const dst = path.join(runDir, to);
+ if (!fs.existsSync(src)) throw new Error(`no results for ${from} in ${runId}`);
+ if (fs.existsSync(dst)) throw new Error(`${dst} already exists; archive it first`);
+ fs.renameSync(src, dst);
+ const idx = renameInJsonl(path.join(runDir, "runs.jsonl"), runId, from, to);
+ const meter = renameInJsonl(path.join(here, "results", "meter.jsonl"), runId, from, to);
+ process.stdout.write(`${runId}: ${from} -> ${to} (${idx} index rows, ${meter} proxy records)\n`);
+}
+
+if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) main();
diff --git a/bench/harnesses/rename-harness.test.mjs b/bench/harnesses/rename-harness.test.mjs
new file mode 100644
index 0000000000..9120c067d1
--- /dev/null
+++ b/bench/harnesses/rename-harness.test.mjs
@@ -0,0 +1,20 @@
+import assert from "node:assert/strict";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import test from "node:test";
+import { renameInJsonl } from "./rename-harness.mjs";
+
+test("renameInJsonl rewrites only the matching run and harness", () => {
+ const file = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "rn-")), "m.jsonl");
+ const rows = [
+ { run_id: "r1", harness: "a", x: 1 },
+ { run_id: "r1", harness: "b", x: 2 },
+ { run_id: "r2", harness: "a", x: 3 },
+ ];
+ fs.writeFileSync(file, rows.map((r) => JSON.stringify(r)).join("\n") + "\n");
+ assert.equal(renameInJsonl(file, "r1", "a", "z"), 1);
+ const got = fs.readFileSync(file, "utf8").trim().split("\n").map((l) => JSON.parse(l));
+ assert.deepEqual(got.map((r) => r.harness), ["z", "b", "a"]);
+ assert.equal(got[0].x, 1);
+});
diff --git a/bench/harnesses/report.mjs b/bench/harnesses/report.mjs
index e49b84b725..c2281565aa 100644
--- a/bench/harnesses/report.mjs
+++ b/bench/harnesses/report.mjs
@@ -9,6 +9,9 @@ import { fileURLToPath } from "node:url";
const here = path.dirname(fileURLToPath(import.meta.url));
+/** Retired variants stay on disk for the record but are left out of the tables and charts. */
+export const ARCHIVED = ["openhuman-python"];
+
export function percentile(values, p) {
const v = values.filter((x) => typeof x === "number").sort((a, b) => a - b);
if (!v.length) return null;
@@ -177,9 +180,10 @@ function main() {
const runId = args[args.indexOf("--run-id") + 1];
if (!runId) throw new Error("--run-id is required");
const runDir = path.join(here, "results", runId);
+ const keep = (r) => args.includes("--include-archived") || !ARCHIVED.includes(r.harness);
const { index, meter } = latestAttempts(
- readJsonl(path.join(runDir, "runs.jsonl")),
- readJsonl(path.join(here, "results", "meter.jsonl")).filter((r) => r.run_id === runId),
+ readJsonl(path.join(runDir, "runs.jsonl")).filter(keep),
+ readJsonl(path.join(here, "results", "meter.jsonl")).filter((r) => r.run_id === runId && keep(r)),
);
const tasks = index.map((row) => {
diff --git a/bench/harnesses/run-swe-extra.sh b/bench/harnesses/run-swe-extra.sh
index 09b4afd142..45866c6f7c 100755
--- a/bench/harnesses/run-swe-extra.sh
+++ b/bench/harnesses/run-swe-extra.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Add a harness variant to an existing SWE run, and/or re-run single tasks
# (e.g. after fixing a driver bug) under the same run id. Newest attempt wins in report.mjs.
-# ./run-swe-extra.sh swe-1 openhuman-native
+# ./run-swe-extra.sh swe-1 deepseek-harness
# ./run-swe-extra.sh swe-1 openhuman sympy__sympy-13031
set -uo pipefail
cd "$(dirname "$0")"