Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 94 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ codexometer --codex /path/to/codex
| `s` | Start recording (Monitor view only) |
| `p` | Stop and take a final up-to-date reading (Monitor view only) |
| `b` | Run the selected challenge (Benchmark view only) |
| `u` | Switch between the Core and Extended benchmark suites |
| `a` | Arm, then confirm, Run Suite (Benchmark view only) |
| `[` / `]`, `Left` / `Right` | Select the previous or next challenge in the active suite |
| `a` | Arm, then confirm, Run All (Benchmark view only) |
| `[` / `]`, `Left` / `Right` | Select the previous or next challenge |
| `f` | Show all, passed, or failed benchmark results |
| `w` | Cycle Cost, Balanced, and Speed benchmark ranking weights |
| `Page Up` / `Page Down` | Scroll Monitor session rows or Benchmark result pages |
| `q` | Quit |
| `Esc` | Quit |
Expand Down Expand Up @@ -221,10 +221,10 @@ Select a tab with the mouse, `Tab`, or `Shift+Tab`:
and whose dark segment shows consumed capacity, labelled from Empty to Full;
one full-width tank appears per row. Its reset-cycle comparison also drains
backward and aligns exactly with the tank's first and last inner cells.
6. **Benchmark** — runs a selected hermetic coding challenge, or the active
Core or Extended suite, against every visible model and each reasoning effort
that model advertises. Results arrive sequentially in a table with task,
pass/fail, wall time, tokens, and estimated standard API-equivalent cost.
6. **Benchmark** — runs a selected hermetic coding challenge, or the complete
challenge catalog, against every visible model and each reasoning effort
that model advertises. Results arrive sequentially in a ranked table with
task, pass/fail, wall time, tokens, and estimated standard API-equivalent cost.
Filter the table to all, passed, or failed trials. Scroll a long result matrix
with Page Up, Page Down, or the mouse wheel. Click any column-heading button
to sort by that field; click it again to reverse the order.
Expand Down Expand Up @@ -311,18 +311,16 @@ uncertainty.
### Deterministic benchmark

The Benchmark tab discovers the current account's visible models and their
supported reasoning efforts through `model/list`. Press `u` or click the suite
button to switch between **Core** and **Extended**, then select a challenge with
the arrow buttons. Press `b` or click **Run Selected** to run it against every
model/effort combination. **Run Suite** runs all challenges in the active suite
against every combination. Because that means
`suite challenge count × model/effort count` model turns, Codexometer displays
the exact total and requires a second confirmation within five seconds. Keeping
the suites separate prevents the three expensive reasoning challenges from
silently increasing the cost of the default Core run. A fresh, ephemeral,
read-only app-server thread is used for each trial, so benchmark history does
not clutter normal Codex sessions. The turns still consume the same account
quota shown by Codexometer.
supported reasoning efforts through `model/list`. Select any challenge with the
arrow buttons; the selector reserves a stable responsive track for the longest
name, so its controls do not move as the selection changes. Press `b` or click
**Run Selected** to run that challenge against every model/effort combination.
**Run All** runs the complete catalog against every combination. Because that
means `challenge count × model/effort count` model turns, Codexometer displays
the exact total and requires a second confirmation within five seconds. A fresh,
ephemeral, read-only app-server thread is used for each trial, so benchmark
history does not clutter normal Codex sessions. The turns still consume the
same account quota shown by Codexometer.

Each model/effort trial has a five-minute deadline. If an in-flight turn reaches
that deadline, Codexometer requests `turn/interrupt`, waits for the matching
Expand All @@ -331,28 +329,81 @@ the remaining combinations. Explicit user cancellation, app-server transport
failure, or failure to confirm interruption still stops the suite because the
server's state is then unsafe or unknown.

#### Core challenges
#### Challenges and difficulty

Every trial asks the model to return one named Starlark function:

| Challenge | Required behavior | Verification set |
| --- | --- | --- |
| **Merge Ranges (Easy)** | Sort inclusive integer ranges and merge every overlapping or adjacent pair into a canonical union. It must handle empty input, duplicates, nesting, negatives, and arbitrary order. | 8 hand-written edge cases + 48 reproducibly generated cases |
| **LRU Cache (Moderate)** | Process integer `put` and `get` operations, update recency, evict the least-recently-used entry, and return both get results and final entries in most-recently-used order. Capacity zero is valid. | 5 hand-written edge cases + 40 reproducibly generated cases |
| **Expression (Moderate)** | Evaluate tokenized non-negative integers with `+`, `-`, `*`, parentheses, normal precedence, and left associativity—without `eval`. | 8 hand-written edge cases + 40 reproducibly generated expressions |
| **Shortest Path (Moderate)** | Return the minimum four-direction move count through a rectangular blocked/open grid, or `-1` when no route exists. | 5 hand-written edge cases + 40 reproducibly generated mazes |

#### Extended challenges

Extended challenges deliberately combine more rules or require bounded search,
which should create more separation between models and reasoning efforts than
simply making the Core inputs larger.

| Challenge | Required behavior | Verification set |
| --- | --- | --- |
| **Dependency Scheduler (Hard)** | Find the minimum makespan for a small dependency DAG with job durations and a limited number of identical workers. Correct solutions must reason about precedence, concurrency, and cases where immediately starting every available job is not optimal. | 6 hand-written edge cases + 8 reproducibly generated DAGs |
| **Version Resolver (Hard)** | Select one version per package while satisfying inclusive dependency ranges and exact conflicts, then return the lexicographically greatest valid solution. | 5 hand-written edge cases + 12 reproducibly generated catalogs |
| **Event Processor (Hard)** | Reorder ledger events by sequence and apply idempotency, transfers, freezes, reversals, failure precedence, and a canonical audit result. | 5 hand-written edge cases + 10 reproducibly generated event streams |
| Challenge | Difficulty | Required behavior | Verification set |
| --- | --- | --- | --- |
| **Merge Ranges** | Easy | Sort inclusive integer ranges and merge every overlapping or adjacent pair into a canonical union. It must handle empty input, duplicates, nesting, negatives, and arbitrary order. | 8 hand-written edge cases + 48 reproducibly generated cases |
| **LRU Cache** | Moderate | Process integer `put` and `get` operations, update recency, evict the least-recently-used entry, and return both get results and final entries in most-recently-used order. Capacity zero is valid. | 5 hand-written edge cases + 40 reproducibly generated cases |
| **Expression** | Moderate | Evaluate tokenized non-negative integers with `+`, `-`, `*`, parentheses, normal precedence, and left associativity—without `eval`. | 8 hand-written edge cases + 40 reproducibly generated expressions |
| **Shortest Path** | Moderate | Return the minimum four-direction move count through a rectangular blocked/open grid, or `-1` when no route exists. | 5 hand-written edge cases + 40 reproducibly generated mazes |
| **Dependency Scheduler** | Hard | Find the minimum makespan for a small dependency DAG with job durations and a limited number of identical workers. Correct solutions must reason about precedence, concurrency, and cases where immediately starting every available job is not optimal. | 6 hand-written edge cases + 8 reproducibly generated DAGs |
| **Version Resolver** | Hard | Select one version per package while satisfying inclusive dependency ranges and exact conflicts, then return the lexicographically greatest valid solution. | 5 hand-written edge cases + 12 reproducibly generated catalogs |
| **Event Processor** | Hard | Reorder ledger events by sequence and apply idempotency, transfers, freezes, reversals, failure precedence, and a canonical audit result. | 5 hand-written edge cases + 10 reproducibly generated event streams |

The difficulty labels are documentation rather than part of the terminal names.
Hard challenges deliberately combine more rules or require bounded search, which
should create more separation between models and reasoning efforts than simply
making the easier inputs larger.

#### Ranking

The `RANK` column is an overall ranking for each model/reasoning-effort
combination across every completed row currently in the result matrix. It uses
ordinal cost and time positions—not raw dollars and seconds—so the distance
between first and second place on either axis is always one rank position,
regardless of the difference in the underlying measurements.

The algorithm is:

1. Group completed rows by requested model ID and reasoning effort. A reported
model reroute remains part of the requested combination that produced it.
2. For each combination, count passes and failures, sum non-negative wall time,
and sum API-equivalent cost. Cost is complete only when every row in that
combination has a finite, non-negative cost measurement.
3. Partition combinations into correctness tiers with identical pass and
failure counts. Within each tier, rank combinations independently by
ascending total cost and ascending total wall time. Equal measurements share
a competition rank: for example, `1, 2, 2, 4`. Every incomplete-cost
combination ties on the cost axis after every cost-complete peer in its tier.
4. Calculate a lower-is-better weighted score from cost rank `C` and time rank
`T` according to the selected mode:

| Mode | Formula | Equivalent weighting |
| --- | --- | ---: |
| **Cost** | `3C + T` | 75% cost / 25% time |
| **Balanced** | `C + T` | 50% cost / 50% time |
| **Speed** | `C + 3T` | 25% cost / 75% time |

5. Produce the final order lexicographically: more passes first, then fewer
failures, then lower weighted score. Correctness therefore always dominates
efficiency; a cheap, fast failure cannot outrank a combination with more
passes. Combinations equal on all three comparisons share a competition rank.

Click **Cost**, **Bal**, or **Speed** in the Result Matrix control row, or press
`w` to cycle them. The ranking is recomputed immediately without rerunning any
trial. Token counts remain visible diagnostics but do not affect rank. The same
overall rank is repeated on each task row for that combination, and the rank
heading is clickable like the other sortable headings.

Missing cost is penalized on the cost axis, but it does not automatically force
the combination to the bottom of the final table. A sufficiently strong time
rank can still compensate in Balanced or Speed mode. If every combination lacks
cost, they all tie on the cost axis and the final efficiency order is determined
by time in every mode. If only part of a combination's cost ledger is missing,
its known costs are not used to infer a partial position: the whole combination
is treated as cost-incomplete.

Rankings update as results arrive, so they are provisional until a run finishes.
Cost and time axes are recalculated among peers in the same current correctness
tier. During a task-major Run All execution, one combination can temporarily
have one more completed row than the others, so an in-progress rank should not
be compared with the final result.
They inherit the API-equivalent caveats below; in particular, unknown prices
sort behind complete measurements on the cost axis and prompt-cache order can
affect that axis. Correctness remains the dominant criterion.

#### How PASS and FAIL are decided

Expand All @@ -367,8 +418,8 @@ A row is `PASS` only when all of the following are true:
- the turn completes and returns the required strict JSON object containing
Starlark source;
- the source loads, defines the correctly named callable, and stays within the
64 KiB source limit and the per-case execution budget: 250,000 steps for Core
or 2,000,000 steps for Extended;
64 KiB source limit and the difficulty-appropriate per-case execution budget:
250,000 steps for Easy/Moderate challenges or 2,000,000 steps for Hard challenges;
- every hand-written and generated case returns the exact reference answer with
the required type and bounded shape; and
- the turn does not emit a tool-use item; and
Expand Down Expand Up @@ -552,9 +603,9 @@ need Go or Codexometer's source dependencies.
## Versioning

Codexometer follows semantic versioning; the current source version is
`v0.4.0`. The Git tag is the release source of truth. Go automatically embeds
`v0.5.0`. The Git tag is the release source of truth. Go automatically embeds
that tag in binaries built with
`go install github.com/merefield/codexometer@v0.4.0`; direct source builds fall
`go install github.com/merefield/codexometer@v0.5.0`; direct source builds fall
back to the maintained value in `internal/version/version.go`.

Both forms report the embedded version and exit without starting the interface:
Expand All @@ -567,7 +618,7 @@ codexometer --version
Release automation can override the source-build fallback without editing code:

```sh
go build -ldflags="-s -w -X github.com/merefield/codexometer/internal/version.Fallback=0.4.0" .
go build -ldflags="-s -w -X github.com/merefield/codexometer/internal/version.Fallback=0.5.0" .
```

## How refresh works
Expand Down
10 changes: 5 additions & 5 deletions internal/codex/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
)

const (
benchmarkTurnTimeout = 5 * time.Minute
benchmarkInterruptTimeout = 15 * time.Second
benchmarkCodeLimit = 64 * 1024
benchmarkStepLimit = 250_000
benchmarkExtendedStepLimit = 2_000_000
benchmarkTurnTimeout = 5 * time.Minute
benchmarkInterruptTimeout = 15 * time.Second
benchmarkCodeLimit = 64 * 1024
benchmarkStepLimit = 250_000
benchmarkHardStepLimit = 2_000_000
)

// BenchmarkUsage is the app-server token breakdown for one isolated turn.
Expand Down
6 changes: 3 additions & 3 deletions internal/codex/benchmark_extended_tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func verifyDependencyScheduler(code string) error {
for index, test := range schedulerTestCases() {
jobs := schedulerJobsToStarlark(test.jobs)
before := jobs.String()
renewExtendedBenchmarkStepBudget(thread)
renewHardBenchmarkStepBudget(thread)
value, err := starlark.Call(thread, function, starlark.Tuple{starlark.MakeInt(test.workers), jobs}, nil)
if err != nil {
return fmt.Errorf("case %d raised an error: %w", index+1, err)
Expand Down Expand Up @@ -219,7 +219,7 @@ func verifyVersionResolver(code string) error {
for index, test := range versionTestCases() {
catalog := versionCatalogToStarlark(test.catalog)
before := catalog.String()
renewExtendedBenchmarkStepBudget(thread)
renewHardBenchmarkStepBudget(thread)
value, err := starlark.Call(thread, function, starlark.Tuple{catalog}, nil)
if err != nil {
return fmt.Errorf("case %d raised an error: %w", index+1, err)
Expand Down Expand Up @@ -415,7 +415,7 @@ func verifyEventProcessor(code string) error {
accounts := intervalsToStarlark(test.accounts)
events := ledgerEventsToStarlark(test.events)
before := accounts.String() + events.String()
renewExtendedBenchmarkStepBudget(thread)
renewHardBenchmarkStepBudget(thread)
value, err := starlark.Call(thread, function, starlark.Tuple{accounts, events}, nil)
if err != nil {
return fmt.Errorf("case %d raised an error: %w", index+1, err)
Expand Down
26 changes: 11 additions & 15 deletions internal/codex/benchmark_extended_tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def process_ledger(accounts, events):
return [final_balances, frozen_accounts, audit]
`

func TestExtendedBenchmarkVerifiersAcceptCorrectSubmissions(t *testing.T) {
func TestHardBenchmarkVerifiersAcceptCorrectSubmissions(t *testing.T) {
for _, test := range []struct {
name string
verify func(string) error
Expand All @@ -212,7 +212,7 @@ func TestExtendedBenchmarkVerifiersAcceptCorrectSubmissions(t *testing.T) {
}
}

func TestExtendedBenchmarkVerifiersRejectIncorrectSubmissions(t *testing.T) {
func TestHardBenchmarkVerifiersRejectIncorrectSubmissions(t *testing.T) {
for _, test := range []struct {
name string
verify func(string) error
Expand All @@ -230,7 +230,7 @@ func TestExtendedBenchmarkVerifiersRejectIncorrectSubmissions(t *testing.T) {
}
}

func TestExtendedBenchmarkVerifiersRejectMutation(t *testing.T) {
func TestHardBenchmarkVerifiersRejectMutation(t *testing.T) {
for _, test := range []struct {
verify func(string) error
code string
Expand All @@ -245,23 +245,19 @@ func TestExtendedBenchmarkVerifiersRejectMutation(t *testing.T) {
}
}

func TestBenchmarkSuitesAndDifficultyLabels(t *testing.T) {
core := BenchmarkTasksForSuite(BenchmarkSuiteCore)
extended := BenchmarkTasksForSuite(BenchmarkSuiteExtended)
if len(core) != 4 || len(extended) != 3 {
t.Fatalf("suite sizes = core %d, extended %d", len(core), len(extended))
func TestBenchmarkCatalogIsUnifiedAndNamesAreCompact(t *testing.T) {
tasks := BenchmarkTasks()
if len(tasks) != 7 || tasks[0].ID != BenchmarkMergeRanges || tasks[4].ID != BenchmarkDependencyScheduler || tasks[6].ID != BenchmarkEventProcessor {
t.Fatalf("unified task order = %#v", tasks)
}
if core[0].ID != BenchmarkMergeRanges || extended[0].ID != BenchmarkDependencyScheduler || extended[2].ID != BenchmarkEventProcessor {
t.Fatalf("suite order = core %#v, extended %#v", core, extended)
}
for _, task := range BenchmarkTasks() {
if !strings.HasSuffix(task.Name, ")") || (!strings.Contains(task.Name, "(EASY)") && !strings.Contains(task.Name, "(MODERATE)") && !strings.Contains(task.Name, "(HARD)")) {
t.Errorf("task %q has no difficulty suffix", task.Name)
for _, task := range tasks {
if strings.ContainsAny(task.Name, "()") {
t.Errorf("task %q still contains a difficulty suffix", task.Name)
}
}
}

func TestExtendedReferenceOraclesOnHandWrittenCases(t *testing.T) {
func TestHardReferenceOraclesOnHandWrittenCases(t *testing.T) {
wantSchedules := []int{0, 3, 4, 8, 6, 6}
for index, want := range wantSchedules {
if got := minimumScheduleTime(schedulerTestCases()[index]); got != want {
Expand Down
Loading
Loading