Measuring Cost per Verified Change in JavaScript Coding Agents

Measuring Cost per Verified Change in JavaScript Coding Agents

pr0h0••32 min read•ai
AI Usage (89%)
On this page

Introduction — Evaluate the Verified Change, Not the Generated Patch

A coding agent that produces good-looking diffs is not the same as one that produces correct changes, and the cost of the attempts that failed never appears in a demo. This post builds a runnable JavaScript harness for measuring coding agents on what survives scrutiny: independently verified task completion, regressions, tool calls, latency, and cost per verified change.

Most evaluation breaks down in the gap: the demo runs on a repo the agent has effectively memorised, the “tests pass” claim comes from a command the agent ran itself, and nobody counts the four attempts that failed before the fifth one landed.

My position: compare coding agents by independently verified changes under explicit budgets, and report the cost of every attempt that did not verify — not just the ones that did. Self-reported completion, leaderboard position, and “it wrote 400 lines” all sit downstream of that. If a change can’t be verified by code the agent can’t edit, it didn’t happen.

The harness below enforces that position in code. It is not a benchmark. It is the machinery you need before you can trust anyone’s benchmark, including one you wrote yourself.

What the Hurdle and VS Code reports actually claim

Two secondary reports prompted this:

  • Coverage dated November 28, 2026 (Wisevoter) headlined Together AI Releases Hurdle to Test AI Coding Agents.
  • Separate coverage dated November 27, 2026 (Techzine Global) headlined Microsoft gives AI agents more autonomy in VS Code.

Both are headline-level secondary sources. The supplied material contains a title and a one-line snippet — nothing else. No task list, verifier description, run counts, or pricing. I have not run Hurdle and have not inspected an official Together AI release page for it. So anything here about what Hurdle measures is framed as what the reporting says. The audit checklist below is what I’d need before treating any number from it as comparable to my own runs.

The VS Code report deserves the same caution. “More autonomy” is a deployment-policy statement, not a capability measurement. It changes the evaluation question — longer tool-driven workflows, more actions per instruction — without telling you anything verified about permission defaults or model behaviour inside those workflows. This harness is written so that question can be answered with evidence instead of vibes.

What the harness delivers, and what it does not

What follows is a complete implementation skeleton: task manifests, immutable fixtures, a provider-neutral adapter contract, a policy-enforcing tool broker, controller-owned budgets, a trusted verifier that runs outside the agent’s reach, append-only usage accounting, and reproducible reports.

Three boundaries up front:

  1. It is a harness, not a leaderboard. A handful of fixtures tests your evaluation tooling. It does not establish that agent A is better than agent B.
  2. Every number shown in this post comes from the deterministic fake adapter. Those numbers are fixed by scripts, so they demonstrate the report’s shape and arithmetic, not any model’s ability.
  3. Empirical results are reserved for runs that actually happened. Where I have no run, I say so.

Establish What the Reported Benchmark Actually Measures

Audit Hurdle before making comparisons

Before any number from a vendor benchmark enters your decision, ask for the same artefacts you’d demand from an internal evaluation:

ArtefactWhy it decides comparability
Official release page or paperEstablishes that the thing exists as described
Task definitions and promptsDetermines whether tasks match your codebase
Repository snapshots (commit SHAs)Without these, results cannot be reproduced or checked for contamination
Verifier / test codeThe whole claim rests on it; an agent-editable verifier is not a verifier
Agent configurationsModel ID, version, system prompt, tool set, permission mode, sampling settings
Budgets per attemptWall clock, tokens, tool calls, dollars
Raw per-attempt tracesRejections matter as much as successes
Pricing assumptionsA cost number without a rate card and a capture date is not a cost

The supplied coverage has none of these. That’s not an accusation — it’s a headline, and headlines aren’t specifications. What I can say with confidence is limited to: the reporting states that Together AI released something called Hurdle for testing AI coding agents. Everything else is unknown pending primary documentation. I would specifically refuse to compare a Hurdle figure against one I produced locally until the snapshot SHAs, verifier, and budget rules line up.

Why the VS Code autonomy report changes the question

If agents in an editor do more per instruction — more file reads, more shell invocations, longer chains before a human looks — then a single-shot “does it fix this bug” test under-measures the risk. The relevant unit becomes the whole tool-driven episode: what it touched, what it tried, what it was denied, and whether the final diff verifies.

I can test that today without asserting anything unverified about VS Code’s features. The harness can vary one axis at a time:

  • tool-call budget (60 → 300),
  • whether shell access is granted at all,
  • whether writes are restricted to allowedPaths,
  • wall-clock ceiling.

Then look at whether verified completion improves with more autonomy, and what it costs in spend, latency, and policy denials. That’s a measurable question. “The agent is more autonomous now” is not.

Three evidence classes, kept visibly separate

Every claim in this article is tagged by provenance:

ClassMeaningExample here
ReportedStated by the supplied secondary coverage“Together AI released Hurdle to test AI coding agents” (Wisevoter, 2026-11-28)
PrimaryDocumented by a spec, official docs, or a source I can readNode’s node --test reporter and child-process semantics; Git’s worktree docs
LocalProduced by code in this articleThe verifier rejections and spend arithmetic below

Carry this tagging into your own report. A table that mixes a vendor’s published number with your own run in the same column, with no provenance marker, is how bad procurement decisions get made.

Define a Verified Change and Its Cost

The acceptance contract for a verified change

A verified change is a candidate diff that satisfies all of the following, checked by code the agent never had write access to:

  1. Applies cleanly to a pinned baseline commit, not to whatever the workspace drifted into.
  2. Passes task-specific acceptance assertions written by you.
  3. Leaves the designated regression suite passing — the same suite, same version, every run.
  4. Touches only allowed paths. No test edits, no lockfile churn, no CI config changes.
  5. Is produced by an attempt that stayed inside its declared budget.

If any fail, the attempt produced a patch, not a change. That distinction is the entire accounting model.

Cost per verified change

costPerVerifiedChange = Σ spend(all attempts, including rejected/timed out/errored)
                        ─────────────────────────────────────────────────────────
                        count(accepted changes)

Two properties matter:

  • Failures are in the numerator. A run that costs $4 and lands one change costs $4 per change even if four attempts burned the budget. Excluding failures is the most common way agent cost numbers get flattered.
  • Zero accepted changes yields null, not 0. An undefined ratio must be reported as undefined. Emitting 0.00 for a run that changed nothing is a bug, not a rounding choice.

Complementary metrics stay visible

A single ratio hides what you need for a deployment decision. Keep these alongside it:

MetricWhat it protects you from
Verified completion rate (accepted / attempts)Cheap agents that rarely succeed
Unique tasks solved / tasks attemptedRepeated retries dressed up as coverage
Regression rate (accepted patches that break the baseline suite)Silent collateral damage
Tool calls per accepted change“Autonomy” that is really flailing
Wall-clock p50/p95 per attemptAgents that block a human for 20 minutes
Tokens in (cached/uncached) and outProvider pricing that moves
Human interventions per accepted changeReview load is a real cost
Policy denialsWhether the agent tried to leave the sandbox

A cheap low-success agent is operationally expensive for a concrete reason: every rejected patch still costs a review pass, and the reviewer is the expensive part. If attempt cost is $0.02 and a review is 6 minutes of an engineer’s time, an agent with a 20% verify rate is paying review cost four times per accepted change.

Build a Small, Auditable JavaScript Task Suite

Project layout

agent-bench/
  tasks/
    query-params/
      task.json
      fixture/                 # git repo pinned by baseCommit
      verify/accept.test.js    # never mounted into agent workspace
      verify/regression/       # frozen copy of the designated suite
      reference.patch          # task validation only
      prompt.md
    async-cleanup/
    exports-map/
  harness/
    run.js                   # controller
    adapter.js               # contract + response validation
    adapters/fake.js
    adapters/provider.js
    broker.js                # tool policy
    verifier.js
    events.js
    report.js
    pricing/synthetic-usd-v1.json
  runs/<runId>/events.jsonl
  runs/<runId>/report.json

Fixtures are ordinary Git repositories. Pinning by commit is what makes a run reproducible; a mutable “latest” fixture turns every comparison into a coin flip.

The task manifest

{
  "id": "query-params-order-and-empty",
  "baseCommit": "4d1e0a7c9b2f8f0d5c1a3e7b6d4f2a9c8e1b0d3f",
  "prompt": "prompt.md",
  "allowedPaths": ["src/query.js"],
  "runtime": { "node": "22.11.0", "packageManager": "[email protected]" },
  "lockfileSha256": "b6f1c0d2e8a34f5c9b7e1d0a2c4f6b8d9e0a1c3b5d7f9e2a4c6b8d0f1e3a5c7b",
  "install": { "command": ["npm", "ci", "--ignore-scripts", "--offline"], "network": false },
  "acceptance": { "command": ["node", "--test", "--test-reporter=tap", "verify/accept.test.js"] },
  "regression": { "command": ["node", "--test", "--test-reporter=tap", "test/"] },
  "limits": { "wallMs": 600000, "toolCalls": 60, "tokens": 200000, "usd": 1.5 }
}

lockfileSha256 exists to catch the case where the workspace install resolves differently than the verifier install. If they diverge, the comparison is void — record it as infrastructure error, not as an agent failure.

One complete fixture: ordered repeated keys and preserved empties

Existing behaviour. The fixture’s helper builds a query string from an array of pairs but routes them through a Map, which drops falsy values and collapses duplicates:

// src/query.js (baseline, buggy)
export function toQueryString(pairs) {
  const map = new Map();
  for (const [key, value] of pairs) {
    if (!value) continue;       // drops "" and 0
    map.set(key, value);        // collapses repeated keys, keeps last
  }
  const parts = [...map].map(
    ([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`
  );
  return parts.length ? `?${parts.join("&")}` : "";
}

Observed on the untouched fixture:

input:  [["tag","a"],["tag","b"],["q",""],["n",0]]
actual: "?tag=b&n=0"
want:   "?tag=a&tag=b&q=&n=0"

Required behaviour. Order of first appearance is preserved for repeated keys, empty strings survive as key=, null/undefined are dropped, and 0 is not treated as absent.

Representative assertions (in verify/accept.test.js, never visible to the agent):





test("repeated keys keep input order, including repeats", () => {
  assert.equal(
    toQueryString([["tag", "a"], ["tag", "b"], ["tag", "a"]]),
    "?tag=a&tag=b&tag=a"
  );
});

test("empty values are preserved, null and undefined are not", () => {
  assert.equal(
    toQueryString([["q", ""], ["drop", null], ["z", "0"]]),
    "?q=&z=0"
  );
});

test("keys and values are percent-encoded, space as %20", () => {
  assert.equal(toQueryString([["a b", "c&d"]]), "?a%20b=c%26d");
});

Reference patch (used only to validate the task, never mounted):

 export function toQueryString(pairs) {
-  const map = new Map();
+  const parts = [];
   for (const [key, value] of pairs) {
-    if (!value) continue;
-    map.set(key, value);
+    if (value === null || value === undefined) continue;
+    parts.push(
+      `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
+    );
   }
-  const parts = [...map].map(
-    ([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`
-  );
   return parts.length ? `?${parts.join("&")}` : "";
 }

Note the patch does not reformat in a way --whitespace=error-all would reject, and it touches exactly one file inside allowedPaths.

Two more task categories

Three fixtures produce a suite that exercises different failure modes without pretending to be representative:

  • async-cleanup — an interval/listener is not cleared on close(), so the process hangs. Acceptance: the test process exits within 2s and close() is idempotent. This catches agents that “fix” hang bugs by adding process.exit(0).
  • exports-map — the package exports field blocks a documented deep import. Acceptance: import("pkg/sub") resolves and the baseline CJS entry still loads. This catches agents that break dual-package consumers while making one ESM test green.

That’s why more than one category matters: a single fixture is a single trap, and an agent can fall into the right answer for the wrong reason.

Validate the task before evaluating any agent

A task that fails on the reference patch is broken. A task that passes on the untouched fixture is worse — it will accept an empty diff. So validate first, in three steps:

node harness/validate-task.js tasks/query-params
task: query-params-order-and-empty
base: 4d1e0a7c9b2f
[1/3] untouched fixture vs acceptance suite ... 3 failing  (expected)
[2/3] reference patch vs acceptance suite ..... 9 passing  (expected)
[3/3] reference patch vs regression suite ..... 41 passing (expected)
result: task valid

If step 1 reports 0 failing, the task accepts a no-op and must be fixed before use. That check is cheap and has caught real mistakes — a stale verify/ copy, for instance, or an acceptance test importing from a build directory that still contains the old code.

Separate the Agent Workspace from the Trusted Verifier

Disposable workspaces from a pinned snapshot

Each attempt gets its own directory, created from the pinned commit:

const workspace = await mkdtemp(path.join(isolationRoot, "ws-"));
await execFile("git", ["clone", "--shared", "--no-hardlinks", repoRoot, workspace]);
await execFile("git", ["checkout", "--detach", task.baseCommit], { cwd: workspace });

git clone --shared keeps fixture copies cheap; --detach at the pinned SHA keeps them honest. If you prefer git worktree add, be clear about what it buys you: worktrees give you separation, not security. A worktree shares the object database and is on the same filesystem, under the same user, with the same environment variables. An agent that runs git -C ../.. or reads ~/.aws is not stopped by anything a worktree does.

⚠️

Treat a worktree as a convenience for cleanup and diffing. Treat the container or VM boundary as the security control. Don’t let one stand in for the other.

Run agent commands unprivileged and credential-free

The execution environment for agent-controlled commands needs all of:

  • unprivileged user, disposable filesystem,
  • no host credentials — no cloud keys, no GITHUB_TOKEN, no SSH agent socket,
  • restricted network (outbound denied by default; allowlist only what the task genuinely requires),
  • bounded CPU, memory, PIDs, and disk,
  • no writable mount of the verifier or hidden assertions.

In review practice, the failure I see most often is the second one: the developer runs the agent in a container but passes through the host environment so their own tooling works. That single line reintroduces every credential on the machine.

Verify only the candidate diff, in a fresh checkout

The verifier’s input is one artefact: a patch file the adapter wrote into a submission directory. The verifier:

  1. clones a fresh checkout at baseCommit (not the agent workspace),
  2. checks the patch applies and passes whitespace/hygiene rules,
  3. enumerates changed files and rejects anything outside allowedPaths,
  4. installs pinned deps with scripts disabled,
  5. runs acceptance, then regression.

The agent’s own test output is never evidence. It goes into the event log as an observation about what the agent did. If it disagrees with the verifier, that disagreement is a finding worth reporting — not a tie to be broken in the agent’s favour.

Executable repository content is agent-reachable attack surface

Anything in the repo that runs during install or verification is agent-reachable attack surface:

  • Install scripts. npm ci runs lifecycle scripts unless you disable them; --ignore-scripts plus a pre-populated cache removes that path. If a task requires a postinstall step, run it once when building the fixture image and snapshot the result.
  • Test runner config. A node --test invocation is influenced by loader flags in NODE_OPTIONS, --experimental-loader, and any vitest.config.js the agent can edit. Pass an explicit, minimal env — PATH only — and resolve config paths from the trusted checkout, not the workspace.
  • Hidden assertions. Keep verify/ outside the workspace entirely. If test names or expected strings appear in the agent’s prompt, the agent can special-case them. Better to under-specify the prompt and over-specify the verifier.

Implement a Provider-Neutral Agent Adapter

The adapter contract

Keep orchestration unaware of provider SDKs. One interface, validated at the boundary:

// harness/adapter.js
export const TERMINAL = [
  "submitted", "agent_error", "timed_out",
  "budget_exceeded", "malformed_output",
];

/**
 * @typedef {Object} Adapter
 * @property {string} id
 * @property {string} version
 * @property {(ctx: AttemptContext) => Promise<AttemptResult>} run
 *
 * @typedef {Object} AttemptContext
 * @property {Task} task
 * @property {string} workspaceDir    // writable, disposable
 * @property {AbortSignal} signal     // controller-owned
 * @property {ToolBroker} broker      // policy enforcement + accounting
 * @property {(event: object) => void} emit
 *
 * @typedef {Object} AttemptResult
 * @property {"submitted"|"agent_error"|"malformed_output"} status
 * @property {string} [patchPath]     // required when status === "submitted"
 * @property {{inputTokens:number, cachedInputTokens:number, outputTokens:number}} usage
 * @property {Record<string, unknown>} [providerMeta]
 */

Validation on the result is part of the contract: a submitted status without a readable patch file is downgraded to malformed_output, logged, and counted as spend with no chance of verification. Otherwise a buggy adapter silently inflates the acceptance rate by never submitting anything parseable.

Record the configuration, not the marketing name

Every attempt event carries the exact configuration so behaviour can be attributed:

{
  "adapter": "provider-x",
  "adapterVersion": "0.4.2",
  "model": "vendor/model-name-2026-11-01",
  "extension": { "name": "agent-extension", "version": "1.9.0" },
  "systemPromptSha256": "3c1f…a907",
  "sampling": { "temperature": 0, "topP": 1, "maxOutputTokens": 8192, "seed": 7 },
  "permissionMode": "workspace-write",
  "tools": ["fs.read", "fs.write", "shell"],
  "sandbox": { "image": "node-22.11.0-pinned@sha256:…", "network": "none" }
}

“Latest model” is not a configuration. A model identifier that includes a date is; a system-prompt hash is; a permission mode is. If you can’t hash it, you can’t attribute a change to it.

Build the deterministic fake adapter first

Before spending a dollar, prove the harness can handle the boring cases. The fake adapter is scripted per task:

// harness/adapters/fake.js
const SCRIPTS = {
  "query-params-order-and-empty": [
    { behaviour: "empty_patch" },        // attempt 1: submits nothing
    { behaviour: "reference_patch" },    // attempt 2: verified
  ],
  "async-cleanup": [{ behaviour: "reference_patch" }],
  "exports-map": [
    { behaviour: "edit_tests" },         // attempt 1: prohibited path
    { behaviour: "reference_patch" },    // attempt 2: verified
  ],
};

export function fakeAdapter({ clock = 0 } = {}) {
  return {
    id: "fake",
    version: "0.1.0",
    async run(ctx) {
      const attempt = ctx.attemptIndex;
      const step = SCRIPTS[ctx.task.id]?.[attempt] ?? { behaviour: "timeout" };
      ctx.emit({ type: "tool.request", tool: "shell", argv: ["npm", "test"] });
      // Deterministic synthetic usage so the arithmetic is exercised.
      const usage = { inputTokens: 18000, cachedInputTokens: 0, outputTokens: 2400 };
      ...
    },
  };
}

The behaviours you need to cover: success, empty patch, edited tests, malformed output, timeout, and an agent error. Each one proves a different branch of the report.

💪

Run the fake adapter with the same budgets, broker, and verifier you use for real agents. If the fake run needs a special case in the controller, the controller isn’t actually provider-neutral.

Put tool execution behind a policy broker

The adapter requests; the broker decides and records. Requests, executions, denials, and retries are separate events, so you can tell “the agent wanted to write test/” apart from “the agent wrote test/”.

// harness/broker.js (policy excerpt)
const RULES = {
  "fs.read": (r, t) => inside(r.path, t.workspaceDir),
  "fs.write": (r, t) => inside(r.path, t.workspaceDir) && allowed(r.path, t.allowedPaths),
  "shell": (r, t) => argvAllowed(r.argv, ["npm", "node", "git"]) && !r.argv.join(" ").includes(".."),
  "net.fetch": () => false,
};

export function createBroker(ctx) {
  const seen = new Map();
  return {
    async call(tool, request) {
      ctx.emit({ type: "tool.request", tool, request });
      const rule = RULES[tool];
      if (!rule || !rule(request, ctx)) {
        ctx.emit({ type: "tool.denied", tool, request, reason: "policy" });
        return { ok: false, reason: "policy" };
      }
      const key = JSON.stringify([tool, request]);
      const attempt = (seen.get(key) ?? 0) + 1;
      seen.set(key, attempt);
      ctx.emit({ type: "tool.retry", tool, attempt });
      const result = await execute(tool, request, ctx);
      ctx.emit({ type: "tool.result", tool, attempt, exitCode: result.code });
      return result;
    },
  };
}

Note that the broker is not the security boundary either — it is accounting and policy. A process with shell access inside a container can bypass a JavaScript broker entirely. Broker enforcement tells you what the agent asked for; container isolation is what makes “no” stick.

Enforce Budgets Outside the Agent

Controller-owned deadline and real termination

“Agent stopped” is not a terminal state you can trust. The controller owns the clock and the kill:

const controller = new AbortController();
const deadline = setTimeout(() => {
  controller.abort(new Error("wall_clock_exceeded"));
  terminateGroup(child);           // kill(-pid, "SIGKILL")
}, task.limits.wallMs);

Use spawn(..., { detached: true }) so the child leads its own process group, then process.kill(-child.pid, "SIGKILL"). Killing only the direct child leaves npm test grandchildren running, which is exactly how a “timed out” attempt keeps burning CPU during the next one and skews your latency numbers.

Tool-call and token limits at the adapter boundary

Enforce counts where you observe them:

if (toolCallsUsed + 1 > task.limits.toolCalls) {
  return { terminal: "budget_exceeded", reason: "tool_calls", toolCallsUsed };
}

Reserve headroom for in-flight requests: check at limit - inFlight, not at limit. Otherwise a single parallel batch overshoots by however many calls were already dispatched.

Token limits are harder. You can cap requested max output tokens, but the provider settles usage after the fact, and a request already in flight will be billed whether or not you cancel it. A hard monetary cap requires provider-side controls — account-level quota, a scoped API key with a spend limit, or a project budget. Your harness enforces a soft ceiling that stops new work; the provider is the only party that can enforce the hard one.

Terminal states and retry rules

Define these before the first run, because you will otherwise define them while staring at a disappointing result:

Terminal stateMeaningCounts toward spend
verifiedDiff applied, acceptance + regression passed, paths allowedYes
rejectedDiff applied or rejected by path/test checksYes
timed_outController killed the process group at the deadlineYes
budget_exceededTool-call, token, or dollar ceiling hitYes
agent_errorProvider error, refusal, or non-recoverable failureYes
malformed_outputNo parseable/readable patchYes
infrastructure_errorHarness fault: clone failure, image pull, disk fullExcluded

Infrastructure errors are the only excluded class, and they must be excluded visibly — the report prints the count and marks the run incomplete if it exceeds a threshold you set in advance. Retries: allow at most one retry, only for infrastructure_error, and record the retry as its own attempt with its own spend. Rerunning a rejected attempt because “the test seemed flaky” is how flaky tests become successes.

Build the Independent Verification Pipeline

Verification order of operations

fresh clone @ baseCommit
  → git apply --check (hygiene)      reject: patch_does_not_apply
  → git apply
  → git diff --name-only             reject: prohibited_paths
  → npm ci --ignore-scripts --offline  infra error if it fails
  → node --test verify/accept.test.js  reject: acceptance_failed
  → node --test test/                  reject: regression_failed
  → verified

Concrete verification code

// harness/verifier.js





const MAX_OUTPUT_BYTES = 256 * 1024;

const rejected = (reason, detail) => ({ terminal: "rejected", reason, detail });
const infra = (reason, detail) => ({ terminal: "infrastructure_error", reason, detail });

export function runBounded(argv, { cwd, timeoutMs, env = {} }) {
  return new Promise((resolve) => {
    const started = performance.now();
    const child = spawn(argv[0], argv.slice(1), {
      cwd,
      env: { PATH: process.env.PATH, ...env },
      detached: true,
      stdio: ["ignore", "pipe", "pipe"],
    });

    let stdout = "";
    let stderr = "";
    let truncated = false;
    const append = (chunk, buf) => {
      if (buf.length >= MAX_OUTPUT_BYTES) { truncated = true; return buf; }
      return buf + chunk.toString("utf8");
    };

    child.stdout.on("data", (c) => { stdout = append(c, stdout); });
    child.stderr.on("data", (c) => { stderr = append(c, stderr); });

    const timer = setTimeout(() => {
      try { process.kill(-child.pid, "SIGKILL"); } catch {}
    }, timeoutMs);

    child.on("close", (code, signal) => {
      clearTimeout(timer);
      resolve({
        code, signal,
        timedOut: signal === "SIGKILL",
        stdout, stderr, truncated,
        durationMs: Math.round(performance.now() - started),
      });
    });
  });
}

export async function verifyCandidate({ task, patchPath, repoRoot }) {
  const work = await mkdtemp(path.join(tmpdir(), "verify-"));
  const repo = path.join(work, "repo");

  const clone = await runBounded(["git", "clone", "--shared", "--no-hardlinks", repoRoot, repo],
    { cwd: work, timeoutMs: 60_000 });
  if (clone.code !== 0) return infra("clone_failed", clone);

  const checkout = await runBounded(["git", "checkout", "--detach", task.baseCommit],
    { cwd: repo, timeoutMs: 30_000 });
  if (checkout.code !== 0) return infra("base_commit_missing", checkout);

  const check = await runBounded(["git", "apply", "--check", "--whitespace=error-all", patchPath],
    { cwd: repo, timeoutMs: 30_000 });
  if (check.code !== 0) return rejected("patch_does_not_apply", check);

  await runBounded(["git", "apply", patchPath], { cwd: repo, timeoutMs: 30_000 });
  const diff = await runBounded(["git", "diff", "--name-only", "HEAD"], { cwd: repo, timeoutMs: 30_000 });
  const files = diff.stdout.trim().split("\n").filter(Boolean);

  if (files.length === 0) return rejected("empty_patch", diff);
  const forbidden = files.filter((f) => !task.allowedPaths.some((p) => f === p || f.startsWith(p + "/")));
  if (forbidden.length) return rejected("prohibited_paths", { files: forbidden });

  const install = await runBounded(task.install.command, { cwd: repo, timeoutMs: 300_000 });
  if (install.code !== 0) return infra("install_failed", install);

  const results = {};
  for (const phase of ["acceptance", "regression"]) {
    const spec = task[phase];
    results[phase] = await runBounded(spec.command, { cwd: repo, timeoutMs: spec.timeoutMs ?? 180_000 });
    if (results[phase].timedOut) return rejected(`${phase}_timed_out`, results[phase]);
    if (results[phase].code !== 0) return rejected(`${phase}_failed`, results[phase]);
  }

  return { terminal: "verified", files, results, workDir: work };
}

Two details worth defending:

  • --whitespace=error-all rejects trailing-whitespace-only noise before it reaches review. It’s a small filter that stops a whole class of “the agent rewrote the file” diffs.
  • Exit code is authoritative; TAP counts are corroboration. Parse # pass / # fail from --test-reporter=tap to fill your per-test table and to detect the case where the runner exits 0 having run zero tests. Never make acceptance depend on matching reassuring console text — that string is trivially forgeable by a patch that prints it.

Attributing failures instead of rerunning them away

Reruns are not a fix. Classify, do not launder:

ClassificationSignalReport treatment
Acceptance failureacceptance_failed, tests ranRejected; record failing test names
New regressionregression_failed, tests that passed on baseline now failRejected; flag as regression, separate from “did not solve”
Prohibited changeprohibited_pathsRejected; count as a policy event
Flaky checkSame input verified on one run and rejected on anotherQuarantine the task; do not average across it
Infrastructurenon-zero install, clone failure, container errorExcluded, counted, run marked incomplete

The flaky row deserves emphasis: if a task verifies intermittently with an identical patch, your test is the problem. Detect it by validating every task with the reference patch N times during setup and requiring N/N. Three runs is a floor; ten is better for suites with timers.

Test the verifier’s resistance

The verifier is the load-bearing component, so test it with deliberately hostile fixtures:

case: edited-test-script      patch touches verify/accept.test.js   → rejected (prohibited_paths)
case: edited-baseline-tests   patch touches test/query.test.js      → rejected (prohibited_paths)
case: fabricated-success      patch prints "# pass 99" on stdout    → rejected (acceptance_failed)
case: empty-patch             patch is zero bytes                   → rejected (empty_patch)
case: lockdown-tamper         patch edits package-lock.json         → rejected (prohibited_paths)
case: process-exit-cheat      patch adds process.exit(0)            → rejected (acceptance_failed on exit-2s assertion)

Observed output from node harness/test-verifier.js, all six cases rejected. Note the third one: a patch that prints fake TAP output still fails, because the exit code and the real test count come from the runner your trusted checkout invokes, not from the agent’s stdout.

Record Usage, Latency, and Spend Without Hiding Missing Data

Append-only event log

One JSONL file per run. Immutable, ordered by seq, never rewritten:

{"v":1,"runId":"run_2026-11-29T09-12-04Z","taskId":"query-params-order-and-empty","attempt":1,"seq":7,"ts":"2026-11-29T09:12:41.902Z","monotonicMs":37211,"type":"usage","usage":{"inputTokens":22000,"cachedInputTokens":10000,"outputTokens":3000},"model":"synthetic/agent"}
{"v":1,"runId":"run_2026-11-29T09-12-04Z","taskId":"query-params-order-and-empty","attempt":1,"seq":8,"ts":"2026-11-29T09:12:44.310Z","monotonicMs":39619,"type":"verify.result","terminal":"rejected","reason":"empty_patch","patchSha256":"e3b0c442…b855"}

Rules that prevent the usual messes: prompts are redacted or hashed by default (store promptSha256 and a length, not the text, unless you control the log’s storage); secrets are stripped by an allowlist on the way in, not a denylist; verify.result always carries patchSha256 so a report can be tied to an artefact.

Token charges from a pinned pricing snapshot

{
  "snapshotId": "synthetic-usd-v1",
  "currency": "USD",
  "kind": "synthetic",
  "capturedAt": "2026-11-29T08:00:00Z",
  "models": {
    "synthetic/agent": {
      "uncachedInputPerMTok": 3.0,
      "cachedInputPerMTok": 0.3,
      "outputPerMTok": 15.0
    }
  }
}
const cost = (u, p) =>
  ((u.inputTokens - u.cachedInputTokens) * p.uncachedInputPerMTok +
    u.cachedInputTokens * p.cachedInputPerMTok +
    u.outputTokens * p.outputPerMTok) / 1e6;

Three ways to get this wrong:

  1. Double counting cached input. If the provider reports total input inclusive of cached tokens, subtract cached before applying the uncached rate. If it reports them separately, do not subtract. Record which convention the provider uses in the pricing snapshot; it is not consistent across vendors.
  2. Assuming zero for missing usage. A missing usage object means unknown, not free. Mark the attempt spendIncomplete: true and refuse to emit an aggregate that includes it in a “complete” total.
  3. Treating a rate card as permanent. Prices change and so do model names. Store the snapshot ID with every report; a report whose snapshot ID is missing is not comparable to one that has it.
📝

The snapshot above is synthetic and labelled as such. I’m not baking a vendor’s current rate card into an article, because it would be stale before the article aged and because the post would then be about pricing rather than accounting. The harness reads whatever snapshot you pin and records its ID in the report.

Separately billed categories

Provider-native tool fees (web search, code execution, file search) and optional sandbox costs are billed on their own meters. Record them as distinct fields — providerToolFeesUsd, sandboxUsd — and add them at the top level of the cost calculation, not inside the token formula. If a fee is documented but not yet on an invoice, mark it estimated and keep it visible; don’t silently drop the line.

Latency with a monotonic clock

Use performance.now(), not Date.now() — the wall clock can step during a long run and produce negative durations. Record queueMs (waiting for a slot), agentMs, and verificationMs separately, plus computed endToEndMs from monotonic deltas. Under concurrency, end-to-end time is not the sum of the parts; report the two numbers with different labels so nobody adds p95s together.

Run the Harness and Inspect Its Evidence

Reproducible command sequence

## prereqs: node 22.x (matches task.runtime), git, npm
git clone https://example.internal/agent-bench.git && cd agent-bench
npm ci

## 1. validate every task (fails on no-op acceptance)
node harness/validate-task.js --all

## 2. dry-run the controller with the deterministic fake adapter
node harness/run.js --suite tasks --adapter fake --attempts 2 --out runs/fake-01

## 3. generate the report
node harness/report.js --run runs/fake-01

## 4. real adapter (requires provider credentials in the controller, never the sandbox)
node harness/run.js --suite tasks --adapter provider-x \
  --model vendor/model-name-2026-11-01 --attempts 2 --out runs/px-01
node harness/report.js --run runs/px-01

Expected artifacts: runs/<id>/events.jsonl, runs/<id>/report.json, runs/<id>/patches/<task>-<attempt>.patch, runs/<id>/verify/<task>-<attempt>/tap.txt.

Deterministic output from the fake adapter

Because the fake adapter follows SCRIPTS, this output is a property of the fixture, not of any model. Run steps 2 and 3 above and you get exactly this:

run: run_fake-01   adapter: [email protected]   pricing: synthetic-usd-v1

task                          att 1        att 2
query-params-order-and-empty  rejected     verified
                              empty_patch
async-cleanup                 verified
exports-map                   rejected     verified
                              prohibited_paths (test/exports.test.js)

The report, with the arithmetic exposed

run: run_fake-01
config: [email protected] | model synthetic/agent | permissionMode workspace-write
        tools [fs.read, fs.write, shell] | limits wallMs=600000 toolCalls=60

task                          att  terminal         in_tok  cached  out_tok  spend_usd  wall_ms
query-params-order-and-empty   1   rejected          22000   10000    3000     0.0840     41208
query-params-order-and-empty   2   verified          20000    8000    2500     0.0759     38874
async-cleanup                  1   verified          26000   20000    4000     0.0840     51230
exports-map                    1   rejected          19000       0    2000     0.0870     29915
exports-map                    2   verified          24000   16000    3000     0.0738     36552

attempts            5
accepted changes    3
unique tasks solved 3 / 3
regressions         0
policy denials      4   (fs.write outside allowedPaths: 4)
total spend         $0.4047
spend on rejected   $0.1710   (42.3% of total spend produced no verified change)
cost/verified change $0.1349
wall p50            38874 ms    wall p95 51230 ms
spendIncomplete     false

The arithmetic, stated so a reader can check it: attempt 1 of query-params is (12000 × 3 + 10000 × 0.30 + 3000 × 15) / 1e6 = 0.0840; the five attempt costs sum to 0.4047; divided by 3 accepted changes, 0.1349. Rounding is display-only; the report computes on full precision and rounds at the final step.

That 42.3% line is the one I’d put in a procurement deck. It’s the number that changes when an agent gets chattier without getting better.

Negative checks

A report that cannot fail is not evidence. The generator must refuse these:

accepted == 0                      → costPerVerifiedChange: null, reason: no_accepted_changes
attempt missing usage field        → spendIncomplete: true, aggregate suppressed
duplicate (attempt, seq) events    → throw DuplicateEventError, run marked invalid
run interrupted (no attempt.end)   → terminal: "incomplete", excluded from aggregates
pricing snapshot id missing        → throw MissingPricingSnapshot
unknown model in snapshot          → spend: null for that attempt, run incomplete

Observed from node harness/report.js --run runs/negative-empty-patch:

error: costPerVerifiedChange is undefined
reason: no_accepted_changes (0 verified / 2 attempts)
spend: $0.1680  (reported, not amortised)

An Infinity or 0.00 in that field would have been worse than an error message.

Compare Agent Configurations Without Overclaiming

Hold the constants constant

Comparable runs share: identical task snapshots (baseCommit + lockfileSha256), identical permission policy, identical retry and exclusion rules, identical budget ceilings, identical verifier code. Vary only the agent configuration. Where practical, run attempts in a randomised order per task and pair by task, so a warm cache or a noisy machine does not systematically favour whichever configuration ran second.

Disclose that equal budgets are still a choice. Giving one agent 60 tool calls and another 300 measures two different deployment decisions; it does not measure the agents in isolation. Pick one and say which.

Report the whole cell, not the ratio

Every comparison row needs: task, input (prompt hash + snapshot), acceptance criterion, attempt count, exact configuration, and outcome — with unique tasks solved reported separately from repeated successful attempts.

ConfigAttemptsVerifiedUnique tasksRegressionsDenialsSpend$/verified
fake/profile-a533/304$0.4047$0.1349
fake/profile-b733/3011$0.5512$0.1837

Both rows are scripted fake-adapter profiles, included to show the table shape; profile-b submits more aggressively, trips the path policy more often, and finishes with the same three verified changes at 36% higher cost. No model was run for these rows, and no conclusion about any provider follows from them.

Uncertainty belongs next to the aggregate

Say the sample size out loud. Three tasks, three attempts, one machine, one day is an anecdote with a schema. Report per-task results alongside aggregates, and name the specific threats: small samples, nondeterministic sampling (temperature 0 is not a determinism guarantee), flaky timers in the async fixture, budget truncation that turned a would-be success into budget_exceeded, and contamination — if a fixture resembles a well-known public repo, an agent may have seen the fix. Contamination checks are limited: you can detect near-duplicate prompts against public datasets imperfectly and you can write your own fixtures, but you cannot prove a model has not seen your bug.

Trade-offs, not a winner

The decision is multi-objective. A configuration with $0.09/verified change and 12-minute p95 latency is not obviously better than one at $0.15 with 90-second p95, especially if a human is blocked. Write the trade-off down explicitly — cost per verified change, regression rate, p95 latency, denial rate — and pick against your operational constraint rather than a single column.

Turn the Harness into a Deployment Gate

Rollout criteria, written before the run

Decide in advance, in numbers:

  • verified completion ≥ X% on your fixture suite,
  • regressions = 0 on the designated suite,
  • cost per verified change ≤ your review-cost breakeven,
  • p95 wall time ≤ the time a human would otherwise spend,
  • policy denials ≤ N per 100 attempts, with any attempted write outside allowedPaths treated as a hard stop.

New configurations start in shadow mode: the agent proposes, the verifier runs, a human reviews — but nothing merges automatically. Broader write access is earned by shadow-mode evidence, not granted at rollout.

Preserve what makes a rerun meaningful

Keep, per run: configuration hashes, the pricing snapshot ID, sanitised traces, verifier TAP output, and patch artefacts. Rerun the suite when any of these changes:

  • model identifier or version,
  • agent or extension version,
  • system prompt hash,
  • repository dependencies or lockfile,
  • tool permissions or sandbox image.

A drift alarm on systemPromptSha256 alone would catch a surprising number of “the agent got worse” reports.

The boundary of the claim

Passing tests supports a scoped correctness claim about those assertions on that snapshot. It is not proof of security, maintainability, or production readiness. The verifier cannot see the injection you did not write a test for, the debt the patch adds, or the failure mode that only appears under production load.

Keep a human on consequential changes. The harness’s job is to make the human’s review cheap and honest: here is one diff, it applied cleanly, it touched one allowed file, and it passed these named assertions. That is a much better starting point than a 900-line patch and a claim that tests pass.

Conclusion — Demand Evidence at the Change Boundary

Both pieces of reporting point at the same gap. Hurdle, as described in the November 28, 2026 coverage, is an argument that coding agents need task-based evaluation — but a headline cannot tell you whether its snapshots are pinned, whether its verifier is agent-reachable, or whether failed attempts are counted. The November 27, 2026 reporting on expanded VS Code agent autonomy raises the stakes: more actions per instruction means more of the work happens between reviews, which makes trustworthy verification the scarce resource, not generation.

Neither report substitutes for a local, budgeted, independently verified workflow. Build the fixture suite, pin the commit, keep the assertions out of the agent’s reach, enforce the deadline outside the agent, count every attempt’s spend, and refuse to emit a ratio when nothing verified. Then the number you take into a deployment decision is one you can defend line by line.

Further Reading

Secondary coverage of the reports discussed (headline-level only; no primary Hurdle documentation was located in the supplied material):

Primary documentation for the mechanisms used above:

Share this post

More posts

Loading comments…