Back to the coding-agent index

Other run of this benchmark: VPS run, 2026-11-20

Benchmark: Fix a newest-first story sort

Run of 2026-11-20 on WSL2. One workload on WSL2 (2 vCPUs, 4 GB memory), three attempts per setup, scored as submitted by nine hidden tests.

On WSL2, Claude Code and Codex CLI each passed all nine tests in all three attempts. Median elapsed time was 33.7 seconds for Claude Code and 49.3 seconds for Codex CLI on this fixture.

Median elapsed: Claude Code 33.7 s; Codex CLI 49.3 s.

Setups: Claude Code 2.1.329 with claude-opus-5-5; Codex CLI 0.171.0 with gpt-6.1-sol. Time limit 600 seconds per attempt; each attempt started from a fresh copy of the broken fixture.

Baseline: the untouched broken fixture scores 3/9 (failing C01, C02, C03, C04, C05, C09). An attempt that produces no patch gets exactly this score. Open the baseline scorer output (JSON)

All 6 attempts: 0 failures, 0 timeouts
SetupModelAttemptScoreElapsedCompletionDollar figureEvidence
Claude Codeclaude-opus-5-519/924.4 sCompleted$0.21 (CLI estimate)Patch · Scorer output
Claude Codeclaude-opus-5-529/936.2 sCompleted$0.28 (CLI estimate)Patch · Scorer output
Claude Codeclaude-opus-5-539/933.7 sCompleted$0.25 (CLI estimate)Patch · Scorer output
Codex CLIgpt-6.1-sol19/945.5 sCompletednot reportedPatch · Scorer output
Codex CLIgpt-6.1-sol29/953.1 sCompletednot reportedPatch · Scorer output
Codex CLIgpt-6.1-sol39/949.3 sCompletednot reportedPatch · Scorer output

Claude Code's dollar figures are the CLI's own estimates at list prices; the run used included subscription usage, not a billed API. Codex CLI reports no cost.

Verdict (this workload only)

Both setups solved the task in all three attempts: 9/9 each, with no timeouts. On this fixture they were equally correct.

The median times describe these three attempts per setup on one WSL2 machine. Elapsed time is wall-clock time for the whole CLI session, including model and network latency. It is not a general speed ranking of the tools or models.

The VPS run of the same task, prompt and scorer used a different host and an earlier Codex CLI version, so its times cannot be compared with these.

Patches and scorer output

Each patch and scorer output below is the saved file from this run, shown and linked exactly as saved. Scores come from each attempt's scorer output.

Claude Code attempt 1: claude-code/attempt-1.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..35b617a 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,47 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
+
+// YYYY-MM-DDTHH:MM[:SS[.fff…]](Z|±HH:MM). The UTC offset is required.
+const ISO_WITH_OFFSET =
+  /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:[.,](\d+))?)?(?:([Zz])|([+-])(\d{2}):?(\d{2}))$/;
+
+// Returns epoch milliseconds for a valid published_at, or null if missing/invalid.
+// Date.parse is not used directly: it accepts impossible dates (e.g. Feb 30),
+// offset-less strings (interpreted as local time) and non-ISO formats.
+function parseInstant(value) {
+  if (typeof value !== "string") return null;
+  const m = ISO_WITH_OFFSET.exec(value.trim());
+  if (!m) return null;
+  const [, y, mo, d, h, mi, s = "0", frac = "", z, sign, oh, om] = m;
+  const year = +y, month = +mo, day = +d, hour = +h, minute = +mi, second = +s;
+  if (month < 1 || month > 12) return null;
+  const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();
+  if (day < 1 || day > daysInMonth) return null;
+  if (hour > 23 || minute > 59 || second > 59) return null;
+  let offsetMinutes = 0;
+  if (!z) {
+    if (+oh > 23 || +om > 59) return null;
+    offsetMinutes = (sign === "-" ? -1 : 1) * (+oh * 60 + +om);
+  }
+  const ms = Number((frac + "000").slice(0, 3));
+  const local = Date.UTC(year, month - 1, day, hour, minute, second, ms);
+  // Date.UTC maps years 0–99 to 1900–1999; correct for that.
+  const utc = new Date(local);
+  if (year < 100) utc.setUTCFullYear(year);
+  const t = utc.getTime() - offsetMinutes * 60_000;
+  return Number.isFinite(t) ? t : null;
+}
+
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
-  });
+  return stories
+    .map((story, index) => ({ story, index, time: parseInstant(story?.published_at) }))
+    .sort((a, b) => {
+      if (a.time === null || b.time === null) {
+        if (a.time !== b.time) return a.time === null ? 1 : -1;
+      } else if (a.time !== b.time) {
+        return b.time - a.time;
+      }
+      return a.index - b.index;
+    })
+    .map((entry) => entry.story);
 }

Open the saved patch file

Claude Code attempt 1: claude-code/attempt-1.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)

Claude Code attempt 2: claude-code/attempt-2.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..0919bb6 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,49 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
+
+// YYYY-MM-DDTHH:MM[:SS[.fraction]] followed by Z or ±HH:MM (offset required).
+const ISO_WITH_OFFSET =
+  /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):(\d{2}))$/;
+
+// Returns epoch milliseconds for a valid timestamp, or null for missing/invalid input.
+function parseInstant(value) {
+  if (typeof value !== "string") return null;
+  const m = ISO_WITH_OFFSET.exec(value);
+  if (!m) return null;
+
+  const [, y, mo, d, h, mi, s = "0", frac = "", z, sign, oh, om] = m;
+  const year = Number(y), month = Number(mo), day = Number(d);
+  const hour = Number(h), minute = Number(mi), second = Number(s);
+
+  if (month < 1 || month > 12) return null;
+  const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();
+  if (day < 1 || day > daysInMonth) return null;
+  if (hour > 23 || minute > 59 || second > 59) return null;
+
+  let offsetMinutes = 0;
+  if (!z) {
+    const offH = Number(oh), offM = Number(om);
+    if (offH > 23 || offM > 59) return null;
+    offsetMinutes = (sign === "-" ? -1 : 1) * (offH * 60 + offM);
+  }
+
+  const ms = frac ? Number(frac.slice(0, 3).padEnd(3, "0")) : 0;
+  // Date.UTC maps years 0-99 to 1900-1999; setUTCFullYear avoids that.
+  const date = new Date(Date.UTC(2000, month - 1, day, hour, minute, second, ms));
+  date.setUTCFullYear(year);
+  return date.getTime() - offsetMinutes * 60_000;
+}
+
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
-  });
+  // Parse each timestamp once; Array.prototype.sort is stable, so ties keep input order.
+  return stories
+    .map((story, index) => ({ story, index, time: parseInstant(story?.published_at) }))
+    .sort((a, b) => {
+      if (a.time === null || b.time === null) {
+        if (a.time === null && b.time === null) return a.index - b.index;
+        return a.time === null ? 1 : -1;
+      }
+      return b.time - a.time || a.index - b.index;
+    })
+    .map((entry) => entry.story);
 }

Open the saved patch file

Claude Code attempt 2: claude-code/attempt-2.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)

Claude Code attempt 3: claude-code/attempt-3.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..abb905c 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,70 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
+
+// YYYY-MM-DDTHH:MM[:SS[.fraction]] followed by Z or ±HH:MM (RFC 3339 profile of ISO 8601).
+const ISO_WITH_OFFSET =
+  /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):(\d{2}))$/;
+
+function daysInMonth(year, month) {
+  return new Date(Date.UTC(year, month, 0)).getUTCDate();
+}
+
+// Returns { ms, subMs } for a valid timestamp, or null if missing/invalid.
+// Parsed strictly: Date.parse would silently roll over dates like Feb 30
+// and accept offset-less or non-ISO strings.
+function parseInstant(value) {
+  if (typeof value !== "string") return null;
+  const m = ISO_WITH_OFFSET.exec(value);
+  if (!m) return null;
+
+  const [, y, mo, d, h, mi, s = "0", frac = "", z, sign, oh, om] = m;
+  const year = Number(y);
+  const month = Number(mo);
+  const day = Number(d);
+  const hour = Number(h);
+  const minute = Number(mi);
+  const second = Number(s);
+
+  if (month < 1 || month > 12) return null;
+  if (day < 1 || day > daysInMonth(year, month)) return null;
+  if (hour > 23 || minute > 59 || second > 59) return null;
+
+  let offsetMinutes = 0;
+  if (!z) {
+    const offH = Number(oh);
+    const offM = Number(om);
+    if (offH > 23 || offM > 59) return null;
+    offsetMinutes = (sign === "+" ? 1 : -1) * (offH * 60 + offM);
+  }
+
+  const fracMs = Number(`0.${frac || "0"}`) * 1000;
+  const wholeMs = Math.floor(fracMs);
+
+  const utc = new Date(0);
+  utc.setUTCFullYear(year, month - 1, day); // avoids Date.UTC's 0–99 → 1900s mapping
+  utc.setUTCHours(hour, minute, second, wholeMs);
+  const ms = utc.getTime() - offsetMinutes * 60_000;
+  if (!Number.isFinite(ms)) return null;
+
+  return { ms, subMs: fracMs - wholeMs };
+}
+
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
+  const keyed = stories.map((story, index) => ({
+    story,
+    index,
+    instant: parseInstant(story?.published_at),
+  }));
+
+  keyed.sort((a, b) => {
+    if (a.instant && b.instant) {
+      const diff = b.instant.ms - a.instant.ms || b.instant.subMs - a.instant.subMs;
+      if (diff !== 0) return diff;
+    } else if (a.instant || b.instant) {
+      return a.instant ? -1 : 1; // valid dates before missing/invalid ones
+    }
+    return a.index - b.index; // same instant, or both invalid: keep input order
   });
+
+  return keyed.map((k) => k.story);
 }

Open the saved patch file

Claude Code attempt 3: claude-code/attempt-3.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)

Codex CLI attempt 1: codex-cli/attempt-1.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..830494d 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,18 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
-  });
+  return stories
+    .map((story) => ({
+      story,
+      timestamp: typeof story.published_at === 'string'
+        ? Date.parse(story.published_at)
+        : NaN,
+    }))
+    .sort((a, b) => {
+      if (Number.isNaN(a.timestamp)) return Number.isNaN(b.timestamp) ? 0 : 1;
+      if (Number.isNaN(b.timestamp)) return -1;
+      // Stable sorting preserves input order for equal instants and invalid dates.
+      return b.timestamp - a.timestamp;
+    })
+    .map(({ story }) => story);
 }

Open the saved patch file

Codex CLI attempt 1: codex-cli/attempt-1.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)

Codex CLI attempt 2: codex-cli/attempt-2.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..31903f3 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,18 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
-  });
+  return stories
+    .map((story) => {
+      const timestamp = typeof story.published_at === 'string'
+        ? Date.parse(story.published_at)
+        : NaN;
+      return { story, timestamp };
+    })
+    .sort((a, b) => {
+      if (Number.isNaN(a.timestamp)) return Number.isNaN(b.timestamp) ? 0 : 1;
+      if (Number.isNaN(b.timestamp)) return -1;
+      // Stable sorting preserves input order for equal instants and invalid dates.
+      return b.timestamp - a.timestamp;
+    })
+    .map(({ story }) => story);
 }

Open the saved patch file

Codex CLI attempt 2: codex-cli/attempt-2.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)

Codex CLI attempt 3: codex-cli/attempt-3.patch
diff --git a/sort-stories.js b/sort-stories.js
index d7e703e..830494d 100644
--- a/sort-stories.js
+++ b/sort-stories.js
@@ -1,9 +1,18 @@
 // Sort synthetic news stories newest first by their publication time.
 // A story is { id, title, published_at }, where published_at is an ISO 8601 timestamp with an explicit UTC offset.
 export function sortStoriesNewestFirst(stories) {
-  return stories.slice().sort((a, b) => {
-    if (a.published_at < b.published_at) return 1;
-    if (a.published_at > b.published_at) return -1;
-    return 0;
-  });
+  return stories
+    .map((story) => ({
+      story,
+      timestamp: typeof story.published_at === 'string'
+        ? Date.parse(story.published_at)
+        : NaN,
+    }))
+    .sort((a, b) => {
+      if (Number.isNaN(a.timestamp)) return Number.isNaN(b.timestamp) ? 0 : 1;
+      if (Number.isNaN(b.timestamp)) return -1;
+      // Stable sorting preserves input order for equal instants and invalid dates.
+      return b.timestamp - a.timestamp;
+    })
+    .map(({ story }) => story);
 }

Open the saved patch file

Codex CLI attempt 3: codex-cli/attempt-3.score.json (9/9)

All nine cases pass. Open the scorer output (JSON)