The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(bench): correct report generation for swe-extra harness
Steven Enamakel8fdf119e71f5
diff --git a/bench/harnesses/report.mjs b/bench/harnesses/report.mjsindex 6ebe9ec50f..e49b84b725 100644--- a/bench/harnesses/report.mjs+++ b/bench/harnesses/report.mjs@@ -147,6 +147,26 @@ export function toMarkdown(meta, summary) {].join("\n");}+/**+ * A task re-run under the same run id (after fixing a driver bug, say) appends a+ * second index row and a second set of proxy records. Keep only the newest+ * attempt per (harness, task) so nothing is double counted.+ */+export function latestAttempts(index, meter) {+ const newest = new Map();+ for (const row of index) {+ const key = `${row.harness}/${row.task_key}`;+ if (!newest.has(key) || row.started_epoch_ms > newest.get(key).started_epoch_ms) newest.set(key, row);+ }+ return {+ index: [...newest.values()],+ meter: meter.filter((r) => {+ const row = newest.get(`${r.harness}/${r.task}`);+ return !row || Date.parse(r.at) >= row.started_epoch_ms;+ }),+ };+}+function readJsonl(file) {if (!fs.existsSync(file)) return [];return fs.readFileSync(file, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l));@@ -157,8 +177,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 index = readJsonl(path.join(runDir, "runs.jsonl"));- const meter = readJsonl(path.join(here, "results", "meter.jsonl")).filter((r) => r.run_id === runId);+ const { index, meter } = latestAttempts(+ readJsonl(path.join(runDir, "runs.jsonl")),+ readJsonl(path.join(here, "results", "meter.jsonl")).filter((r) => r.run_id === runId),+ );const tasks = index.map((row) => {const dir = path.join(runDir, row.harness, row.task_key);diff --git a/bench/harnesses/report.test.mjs b/bench/harnesses/report.test.mjsindex f73750dbcc..fc9a5c5782 100644--- a/bench/harnesses/report.test.mjs+++ b/bench/harnesses/report.test.mjs@@ -1,6 +1,6 @@import assert from "node:assert/strict";import test from "node:test";-import { aggregate, percentile, toMarkdown } from "./report.mjs";+import { aggregate, latestAttempts, percentile, toMarkdown } from "./report.mjs";const call = (over) => ({harness: "h", task: "t1", status: 200, at: "2026-01-01T00:00:01.000Z",@@ -58,3 +58,18 @@ test("toMarkdown renders one column per harness", () => {);assert.match(md, /\| metric \| a \|/);});++test("latestAttempts keeps only the newest attempt's index row and proxy records", () => {+ const index = [+ { harness: "h", task_key: "t", started_epoch_ms: 1000 },+ { harness: "h", task_key: "t", started_epoch_ms: 5000 },+ ];+ const meter = [+ { harness: "h", task: "t", at: new Date(2000).toISOString() },+ { harness: "h", task: "t", at: new Date(6000).toISOString() },+ ];+ const out = latestAttempts(index, meter);+ assert.equal(out.index.length, 1);+ assert.equal(out.index[0].started_epoch_ms, 5000);+ assert.equal(out.meter.length, 1);+});diff --git a/bench/harnesses/run-swe-extra.sh b/bench/harnesses/run-swe-extra.shnew file mode 100755index 0000000000..09b4afd142--- /dev/null+++ b/bench/harnesses/run-swe-extra.sh@@ -0,0 +1,13 @@+#!/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 openhuman sympy__sympy-13031+set -uo pipefail+cd "$(dirname "$0")"+run_id="$1"; h="$2"; only="${3:-}"+export BENCH_UID="$(id -u)" BENCH_GID="$(id -g)" TASK_TIMEOUT_S="${TASK_TIMEOUT_S:-1200}"+args=(--harness "$h" --suite swe --tasks-dir tasks/generated/swe --run-id "$run_id")+[ -n "$only" ] && args+=(--only "$only")+node orchestrate.mjs "${args[@]}"+node swebench/grade.mjs --run-id "$run_id" --harness "$h" --workers 2