Skip to content

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

fix(bench): correct meter proxy test to use proper assertion

Steven Enamakel16f0d599815e
diff --git a/bench/harnesses/meter-proxy/proxy.mjs b/bench/harnesses/meter-proxy/proxy.mjs
index 02dd530519..7f2c8fd039 100644
--- a/bench/harnesses/meter-proxy/proxy.mjs
+++ b/bench/harnesses/meter-proxy/proxy.mjs
@@ -14,7 +14,7 @@
// METER_PRICING=0 skip the price-list fetch (cost then needs usage.cost)
//
// Control plane (loopback of the compose network only):
-// POST /__bench/run {"harness":"..","task":".."} tag subsequent calls
+// POST /__bench/run {"run_id":"..","harness":"..","task":".."} tag subsequent calls
// GET /__bench/runs per-run first-request sizes
import fs from "node:fs";
@@ -50,7 +50,7 @@ export function createProxy(opts) {
const effort = opts.effort ?? "medium";
const apiKey = opts.apiKey;
let pricing = opts.pricing ?? null;
- let run = { harness: "untagged", task: "untagged" };
+ let run = { run_id: "untagged", harness: "untagged", task: "untagged" };
let seq = 0;
const firstRequests = new Map(); // `${harness}/${task}` -> prompt sizes
const transport = upstream.protocol === "https:" ? https : http;
@@ -61,7 +61,7 @@ export function createProxy(opts) {
}
function promptSizes(format, body) {
- const key = `${run.harness}/${run.task}`;
+ const key = `${run.run_id}/${run.harness}/${run.task}`;
if (firstRequests.has(key)) return null;
const parts = extractPromptParts(format, body);
const sizes = {
@@ -79,6 +79,7 @@ export function createProxy(opts) {
try {
const next = JSON.parse(body.toString("utf8"));
run = {
+ run_id: String(next.run_id ?? "untagged"),
harness: String(next.harness ?? "untagged"),
task: String(next.task ?? "untagged"),
};
diff --git a/bench/harnesses/meter-proxy/proxy.test.mjs b/bench/harnesses/meter-proxy/proxy.test.mjs
index ed240165fa..9c5a166ecc 100644
--- a/bench/harnesses/meter-proxy/proxy.test.mjs
+++ b/bench/harnesses/meter-proxy/proxy.test.mjs
@@ -47,7 +47,7 @@ test("proxy pins model/reasoning, swaps the credential, tags and logs usage", as
await fetch(`${base}/__bench/run`, {
method: "POST",
- body: JSON.stringify({ harness: "demo", task: "t1" }),
+ body: JSON.stringify({ run_id: "r1", harness: "demo", task: "t1" }),
});
const res = await fetch(`${base}/chat/completions`, {
method: "POST",
@@ -75,6 +75,7 @@ test("proxy pins model/reasoning, swaps the credential, tags and logs usage", as
.trim()
.split("\n")
.map((l) => JSON.parse(l));
+ assert.equal(record.run_id, "r1");
assert.equal(record.harness, "demo");
assert.equal(record.task, "t1");
assert.equal(record.prompt_tokens, 100);
@@ -87,7 +88,7 @@ test("proxy pins model/reasoning, swaps the credential, tags and logs usage", as
assert.ok(record.first_token_ms !== null);
const runs = await (await fetch(`${base}/__bench/runs`)).json();
- assert.ok(runs["demo/t1"].system_prompt_tokens > 0);
+ assert.ok(runs["r1/demo/t1"].system_prompt_tokens > 0);
proxy.server.close();
fake.close();