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
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ codexometer --codex /path/to/codex
| `w` | Cycle Cost, Balanced, and Speed benchmark ranking weights |
| `Up` / `Down` | Select a Benchmark row, or scroll its open detail |
| `Enter` / `Space` | Open a selected result, or toggle a Benchmark Scope checkbox |
| `c` | Copy the complete open Benchmark detail to the terminal clipboard |
| `c` | Copy the Benchmark result matrix as Markdown, or copy the complete open run detail |
| `Page Up` / `Page Down` | Scroll Monitor session rows or Benchmark result pages |
| `q` | Quit |
| `Esc` | Return from Benchmark detail or Scope; otherwise quit |
Expand Down Expand Up @@ -967,21 +967,26 @@ arrive, then changes in place to the final `PASS`, `FAIL`, or `STOPPED` result.
requested and actual model, effort, task, outcome, live duration, token classes,
API-equivalent cost, exact benchmark prompt, visible structured response
(including the submitted Starlark), policy events, and deterministic-verifier
result. `Esc` returns to the same selected matrix row. Page keys, arrow keys,
and the mouse wheel scroll a long detail. Press `c` or click **Copy** in the
detail title to copy the complete unstyled detail, including interactions below
the visible scroll window. Copy uses the terminal's OSC 52 clipboard support,
which is not available in every terminal.
result. In the matrix, press `c` or click **Copy** at the lower right to export
a clean Markdown table containing only the eight column headings and every data
row. The export includes filtered and off-screen rows, retains the current sort
and rank weighting, and excludes the Show and Rank controls.

`Esc` returns to the same selected matrix row. Page keys, arrow keys, and the
mouse wheel scroll a long detail. With a detail open, press `c` or click
**Copy** at the lower right to copy the complete unstyled detail, including
interactions below the visible scroll window. Both copy actions use the
terminal's OSC 52 clipboard support, which is not available in every terminal.

This transcript is deliberately benchmark-only. It is populated directly by
the ephemeral thread that Codexometer created for that trial, bounded to 4,096
entries of at most 64 KiB each and 1 MiB total, retained only in process
memory, and discarded when a new suite starts or Codexometer exits. It does not
subscribe to or read ordinary Codex conversations, and it excludes reasoning
events, credentials, request headers, and internal app-server IDs.
Codexometer sends that bounded transcript to the system clipboard only when you
explicitly press `c` or click **Copy**; the clipboard then falls under your
operating system and terminal's normal retention behavior.
Codexometer sends result data or that bounded transcript to the system clipboard
only when you explicitly press `c` or click **Copy**; the clipboard then falls
under your operating system and terminal's normal retention behavior.

#### Challenges and difficulty

Expand Down
79 changes: 78 additions & 1 deletion internal/ui/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,24 @@ func (m Model) renderBenchmarkTable(width, height int, colors palette) string {
lines = lines[:bodyHeight]
}
title := "RESULT MATRIX // STANDARD API-EQUIVALENT USD"
return frameSized(width, max(height-2, 1), ansi.Truncate(title, max(innerWidth-4, 1), ""), strings.Join(lines, "\n"), colors.primary, colors)
copyControl := m.renderBenchmarkTableCopyControl(colors)
return frameSizedWithActions(
width,
max(height-2, 1),
ansi.Truncate(title, max(innerWidth-4, 1), ""),
"",
copyControl,
strings.Join(lines, "\n"),
colors.primary,
colors,
)
}

func (m Model) renderBenchmarkTableCopyControl(colors palette) string {
if !m.benchmarkResultsCopyAvailable() {
return lipgloss.NewStyle().Foreground(colors.dim).Background(colors.background).Render(benchmarkDetailCopyLabel)
}
return m.renderBenchmarkDetailControl(benchmarkDetailCopyLabel, footerButtonBenchmarkCopy, colors)
}

type benchmarkTableRow struct {
Expand All @@ -1161,6 +1178,59 @@ func (m Model) orderedBenchmarkResults() []codex.BenchmarkResult {
return ordered
}

func (m Model) orderedBenchmarkClipboardResults() []codex.BenchmarkResult {
rankings := benchmarkRankings(m.benchmarkResults, m.benchmarkRankMode)
ordered := sortedBenchmarkResults(m.benchmarkResults, m.benchmarkSort, m.benchmarkSortDescending, rankings)
if active := m.currentBenchmarkActive(); active != nil {
ordered = append(ordered, *active)
}
return ordered
}

func (m Model) benchmarkResultsCopyAvailable() bool {
return len(m.benchmarkResults) > 0 || m.benchmarkActive != nil
}

func (m Model) benchmarkResultsClipboardText() string {
results := m.orderedBenchmarkClipboardResults()
if len(results) == 0 {
return ""
}

headings := []string{"RANK", "MODEL", "EFFORT", "TASK", "RESULT", "TIME", "TOKENS", "API EQ"}
var output strings.Builder
writeMarkdownBenchmarkRow(&output, headings)
writeMarkdownBenchmarkRow(&output, []string{"---", "---", "---", "---", "---", "---", "---", "---"})

rankings := benchmarkRankings(m.benchmarkResults, m.benchmarkRankMode)
activeKey := m.activeBenchmarkKey()
for _, result := range results {
active := activeKey != "" && benchmarkRunKey(result) == activeKey
writeMarkdownBenchmarkRow(&output, benchmarkResultValues(result, rankings, active))
}
return output.String()
}

func writeMarkdownBenchmarkRow(output *strings.Builder, values []string) {
output.WriteString("|")
for _, value := range values {
output.WriteString(" ")
output.WriteString(markdownBenchmarkCell(value))
output.WriteString(" |")
}
output.WriteString("\n")
}

func markdownBenchmarkCell(value string) string {
value = ansi.Strip(value)
value = strings.ReplaceAll(value, "\r\n", "\n")
value = strings.ReplaceAll(value, "\r", "\n")
value = strings.ReplaceAll(value, "\\", "\\\\")
value = strings.ReplaceAll(value, "|", "\\|")
value = strings.ReplaceAll(value, "\n", "<br>")
return strings.TrimSpace(value)
}

func (m Model) benchmarkTableResults() []codex.BenchmarkResult {
results := slices.Clone(m.benchmarkResults)
if active := m.currentBenchmarkActive(); active != nil {
Expand Down Expand Up @@ -1803,6 +1873,13 @@ func (m Model) benchmarkButtonAt(x, y int) footerButtonID {
if layout.tableHeight >= 3 && localX < layout.width && localY == layout.topHeight+1 {
return benchmarkSegmentButtonAt(localX, m.benchmarkFilterLine(max(layout.width-4, 1)))
}
if layout.tableHeight >= 3 && m.benchmarkResultsCopyAvailable() && localY == layout.topHeight+layout.tableHeight-1 {
copyWidth := lipgloss.Width(benchmarkDetailCopyLabel)
copyStart := layout.width - copyWidth - 2
if layout.width >= copyWidth+4 && localX >= copyStart && localX < copyStart+copyWidth {
return footerButtonBenchmarkCopy
}
}
return footerButtonNone
}

Expand Down
88 changes: 88 additions & 0 deletions internal/ui/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,94 @@ func TestBenchmarkViewRendersResponsiveResultsTable(t *testing.T) {
}
}

func TestBenchmarkResultsCopyControlExportsMarkdownTable(t *testing.T) {
results := []codex.BenchmarkResult{
{
TaskName: "PIPE | TASK", Model: "alpha", DisplayName: "Alpha", Effort: "high", Correct: true,
Duration: time.Second, Usage: codex.BenchmarkUsage{TotalTokens: 1234}, UsageKnown: true, CostKnown: true, CostUSD: 0.0123,
},
{
TaskName: "FAILED TASK", Model: "zulu", DisplayName: "Zulu", Effort: "low",
Duration: 2 * time.Second, Usage: codex.BenchmarkUsage{TotalTokens: 99}, UsageKnown: true, Failure: "wrong result",
},
}
active := codex.BenchmarkResult{
Provider: "digbench", TaskName: "DIGBENCH P-1", Model: "live", DisplayName: "Live", Effort: "medium",
CurrentLevel: 4, Duration: 3 * time.Second,
}
model := Model{
snapshot: codex.DemoSnapshot(), width: 100, height: 30, meterView: viewBenchmark,
benchmarkState: benchmarkRunning, benchmarkResults: results, benchmarkActive: &active,
benchmarkFilter: benchmarkFilterPass, benchmarkSort: benchmarkSortModel,
}

clipboard := model.benchmarkResultsClipboardText()
lines := strings.Split(strings.TrimSuffix(clipboard, "\n"), "\n")
if len(lines) != 5 {
t.Fatalf("Markdown export lines = %d, want headings, separator, and 3 data rows:\n%s", len(lines), clipboard)
}
if lines[0] != "| RANK | MODEL | EFFORT | TASK | RESULT | TIME | TOKENS | API EQ |" {
t.Fatalf("Markdown headings = %q", lines[0])
}
if lines[1] != "| --- | --- | --- | --- | --- | --- | --- | --- |" {
t.Fatalf("Markdown separator = %q", lines[1])
}
for _, want := range []string{"PIPE \\| TASK", "FAILED TASK", "IN PROGRESS (P-1, 4)", "~$0.0123"} {
if !strings.Contains(clipboard, want) {
t.Fatalf("Markdown export missing %q:\n%s", want, clipboard)
}
}
for _, unwanted := range []string{"SHOW //", "[ COST ]", "[ BAL ]", "[ SPEED ]"} {
if strings.Contains(clipboard, unwanted) {
t.Fatalf("Markdown export contains control text %q:\n%s", unwanted, clipboard)
}
}
if strings.Index(clipboard, "Alpha") > strings.Index(clipboard, "Zulu") {
t.Fatalf("Markdown export did not retain the active model sort:\n%s", clipboard)
}
if !strings.Contains(clipboard, "Zulu") {
t.Fatalf("Markdown export obeyed the PASS display filter instead of including all data:\n%s", clipboard)
}
if got := markdownBenchmarkCell("first\nsecond"); got != "first<br>second" {
t.Fatalf("multiline Markdown cell = %q", got)
}

copyX, copyY := renderedTextStart(t, model, benchmarkDetailCopyLabel)
dashboard := model.dashboardLayout()
geometry := layoutBenchmarkArea(dashboard.contentWidth, dashboard.meterHeight)
if wantY := dashboard.meterY + geometry.topHeight + geometry.tableHeight - 1; copyY != wantY {
t.Fatalf("matrix Copy control y = %d, want bottom frame y = %d (meter y=%d height=%d, top=%d table=%d)", copyY, wantY, dashboard.meterY, dashboard.meterHeight, geometry.topHeight, geometry.tableHeight)
}
updated, command := model.Update(tea.MouseMotionMsg{X: copyX, Y: copyY})
model = updated.(Model)
if command != nil || model.hoveredButton != footerButtonBenchmarkCopy {
t.Fatal("result matrix Copy hover was not recorded")
}
updated, command = model.Update(tea.MouseClickMsg{X: copyX, Y: copyY, Button: tea.MouseLeft})
model = updated.(Model)
if command == nil || model.flashedButton != footerButtonBenchmarkCopy {
t.Fatal("result matrix Copy click did not issue a clipboard command")
}
updated, command = model.Update(tea.KeyPressMsg{Code: 'c', Text: "c"})
model = updated.(Model)
if command == nil || model.flashedButton != footerButtonBenchmarkCopy {
t.Fatal("c did not activate result matrix Copy")
}
}

func TestBenchmarkResultsCopyControlIsDisabledWithoutRows(t *testing.T) {
model := Model{snapshot: codex.DemoSnapshot(), width: 100, height: 30, meterView: viewBenchmark}
copyX, copyY := renderedTextStart(t, model, benchmarkDetailCopyLabel)
if got := model.benchmarkButtonAt(copyX, copyY); got != footerButtonNone {
t.Fatalf("empty result matrix Copy hit target = %d, want none", got)
}
updated, command := model.Update(tea.KeyPressMsg{Code: 'c', Text: "c"})
model = updated.(Model)
if command != nil || model.flashedButton == footerButtonBenchmarkCopy {
t.Fatal("empty result matrix accepted the Copy shortcut")
}
}

func TestBenchmarkRowClickOpensScrollableBenchmarkOnlyDetail(t *testing.T) {
result := codex.BenchmarkResult{
TaskID: "merge-ranges", TaskName: "MERGE RANGES", Model: "detail-model", DisplayName: "Detail Model", Effort: "high",
Expand Down
11 changes: 8 additions & 3 deletions internal/ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {
return m.pressFooterButton(footerButtonBenchmarkSelected)
}
case "c":
if m.meterView == viewBenchmark && m.benchmarkDetail != nil {
if m.meterView == viewBenchmark && !m.benchmarkScopeOpen && (m.benchmarkDetail != nil || m.benchmarkResultsCopyAvailable()) {
return m.pressFooterButton(footerButtonBenchmarkCopy)
}
case "a":
Expand Down Expand Up @@ -985,8 +985,13 @@ func (m Model) activateFooterButton(button footerButtonID) (Model, tea.Cmd) {
case footerButtonBenchmarkRankSpeed:
m.setBenchmarkRankMode(benchmarkRankSpeed)
case footerButtonBenchmarkCopy:
if m.meterView == viewBenchmark && m.benchmarkDetail != nil {
return m, tea.SetClipboard(m.benchmarkDetailClipboardText())
if m.meterView == viewBenchmark {
if m.benchmarkDetail != nil {
return m, tea.SetClipboard(m.benchmarkDetailClipboardText())
}
if !m.benchmarkScopeOpen && m.benchmarkResultsCopyAvailable() {
return m, tea.SetClipboard(m.benchmarkResultsClipboardText())
}
}
case footerButtonBenchmarkClose:
if m.meterView == viewBenchmark {
Expand Down
2 changes: 1 addition & 1 deletion intro-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Each trial appears in the result matrix as soon as it starts and remains clickab
- move and state transitions for interactive games; and
- a complete copy-to-clipboard action for sharing or further analysis.

You can enter and leave a live detail view without interrupting the run, navigate long transcripts with the keyboard, and stop an active suite while retaining completed work and the captured incomplete result.
The result matrix itself can also be copied as a clean Markdown table containing its headings and every result row, without the interactive controls. You can enter and leave a live detail view without interrupting the run, navigate long transcripts with the keyboard, and stop an active suite while retaining completed work and the captured incomplete result.

Deterministic suites can be ranked with cost-, speed-, or balanced weighting. DigBench uses the same controls for a separate observed-run ranking, with the clear caveat that its server-assigned random seeds make individual attempts exploratory rather than controlled model comparisons.

Expand Down
Loading