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 meter-proxy test assertions and header handling
Steven Enamakel6d4f6ef5f832
diff --git a/bench/harnesses/meter-proxy/capture.test.mjs b/bench/harnesses/meter-proxy/capture.test.mjsindex fd096ed848..25303f76ec 100644--- a/bench/harnesses/meter-proxy/capture.test.mjs+++ b/bench/harnesses/meter-proxy/capture.test.mjs@@ -86,7 +86,7 @@ test("proxy writes a capture file with the system prompt as sent", async () => {import zlib from "node:zlib";import { forwardHeaders } from "./headers.mjs";-test("forwardHeaders keeps every header verbatim, swapping only host/length/credentials/hop-by-hop", () => {+test("forwardHeaders keeps every header verbatim, replacing only host/length, dropping the dummy credential and hop-by-hop", () => {const raw = ["Host", "meter-proxy:8080", "Authorization", "Bearer dummy", "X-Api-Key", "dummy","X-Session-Affinity", "abc", "HTTP-Referer", "https://x", "anthropic-beta", "a,b",diff --git a/bench/harnesses/meter-proxy/headers.mjs b/bench/harnesses/meter-proxy/headers.mjsindex 1c199d0098..d0b67b581f 100644--- a/bench/harnesses/meter-proxy/headers.mjs+++ b/bench/harnesses/meter-proxy/headers.mjs@@ -9,7 +9,9 @@// host -> the upstream host// content-length -> the (possibly rewritten) body length// hop-by-hop -> per RFC 9110 they describe one connection, not the request-// credentials -> swapped for the real key (harnesses only carry a dummy)+// credentials -> the proxy is the credentialled party: harnesses carry a dummy+// key (so their own startup checks pass), which is not forwarded;+// the proxy authenticates the request itselfconst HOP_BY_HOP = new Set(["connection", "keep-alive", "proxy-connection", "transfer-encoding", "te",diff --git a/bench/harnesses/meter-proxy/proxy.test.mjs b/bench/harnesses/meter-proxy/proxy.test.mjsindex 9c5a166ecc..cebe011822 100644--- a/bench/harnesses/meter-proxy/proxy.test.mjs+++ b/bench/harnesses/meter-proxy/proxy.test.mjs@@ -12,7 +12,7 @@ function listen(server) {);}-test("proxy pins model/reasoning, swaps the credential, tags and logs usage", async () => {+test("proxy pins model/reasoning, authenticates itself, tags and logs usage", async () => {let seen = null;const fake = http.createServer((req, res) => {const chunks = [];diff --git a/bench/harnesses/orchestrate.mjs b/bench/harnesses/orchestrate.mjsindex 8bcf7bb685..e0aa2491d5 100644--- a/bench/harnesses/orchestrate.mjs+++ b/bench/harnesses/orchestrate.mjs@@ -88,11 +88,24 @@ async function waitForQuietHost() {}async function tagProxy(port, tag) {- const res = await fetch(`http://127.0.0.1:${port}/__bench/run`, {- method: "POST",- body: JSON.stringify(tag),- });- if (!res.ok) throw new Error(`tagging proxy failed: HTTP ${res.status}`);+ // A fresh connection per call, and a retry: Docker Desktop's port forwarder closes idle+ // keep-alive sockets, and fetch reusing one fails with "fetch failed" between tasks.+ let lastError;+ for (let attempt = 0; attempt < 5; attempt += 1) {+ try {+ const res = await fetch(`http://127.0.0.1:${port}/__bench/run`, {+ method: "POST",+ headers: { connection: "close" },+ body: JSON.stringify(tag),+ });+ if (!res.ok) throw new Error(`tagging proxy failed: HTTP ${res.status}`);+ return;+ } catch (error) {+ lastError = error;+ await new Promise((r) => setTimeout(r, 500 * (attempt + 1)));+ }+ }+ throw lastError;}async function main() {