Skip to content

feat(bench): a committed census for the tool share of wall clock, and what it says about the 75% - #6503

Merged
macanderson merged 2 commits into
mainfrom
fix/stella-p1-bench-and-plugins
Sep 11, 2026
Merged

feat(bench): a committed census for the tool share of wall clock, and what it says about the 75%#6503
macanderson merged 2 commits into
mainfrom
fix/stella-p1-bench-and-plugins

Conversation

@macanderson

@macanderson macanderson commented Sep 11, 2026

Copy link
Copy Markdown
Owner

What & why

#3753's remaining definition of done asks for the tool-execution share of wall
clock "on the same clean-basis method" as the 75% in its body. That method was an
uncommitted jq incantation. bench/trace_triage/census.py is the method written
down, so the next panel produces a figure a reader can hold against this one.

Wall clock is the first event to the last, per trial. Tool time is
tool_result.duration_ms over the join run_trace already performs. A share is a
ratio of two sums over one named trial set, never a mean of ratios.

Calibration

Run against the match #3753 cites, the committed module answers 52.0% over 12
trials. The figure already published on that issue from the same match, by a
separate hand-written join, is 51.8% (6,578s wall, 3,406s tool). The wall
clocks are identical and the tool totals differ by 13s. I did not establish what
that 13s is — the other join is not in the tree — so it is stated as an
unexplained residual rather than attributed.

$ python3 bench/trace_triage/census.py ~/.arenabench/matches/13f7f2bb533d
match 13f7f2bb533d: 12 trials with a wall clock
  over the 12 trials that carry a clock:
    wall clock     1.83h
    tool execution 0.95h  52.0% of wall clock
    model          0.46h  25.0% of wall clock
  over all 12 trials, which needs no clock:
    bash           0.95h  over 191 bash calls of 216 tool calls
      killed by the timeout    0.38h  40.4% of bash
      killed and tried again   0.18h  19.3% of bash
      ...of which run verbatim 0.00h

What it says about the 75%

Pointed at every ArenaBench match on this machine — 294 matches, 341 Stella trials
that carry a wall clock — the share is not 75% and not 52%:

trial set trials tool share model share
#3753's body, clean basis of 9 9 75% 31%
#3753's later comment, same match 12 51.8%
every match on this machine 341 15.5% 56.6%

Labelled as a measurement, not a panel. These are the matches that happen to be
on disk, run against many configurations over months, not a controlled panel. What
it establishes is narrow and worth having: the 75% is a property of an
install-heavy task mix, not of the harness. On the corpus the model is the larger
consumer by a wide margin.

The practical consequence: a panel reporting a lower number than 75% has probably
changed task mix, and the census makes that visible because the trial count
travels with the share.

It does not discharge either remaining box on #3753. Both still need a funded
panel.

The second cost inside shell time

#6440 and #6501 are both aimed at blind waiting. The census names a larger
bucket beside it, over 24.48h of bash wall clock in 13,245 bash calls:

hours share of bash
killed by the tool timeout 5.70 23.3%
killed, and the command came back later 3.14 12.8%

The second row is time that bought nothing at all: the call was killed, and a later
call in the same trial re-ran it. That is the shape pytorch-model-cli died in —
pip install torch killed at 120s, the same install killed again at 300s, then a
third attempt that ran. 420s of its 984s went into the two attempts that were
thrown away, before the 490s blind wait #6501 declines.

No fix here. The remedy is backgrounding, which #6501 argues is a body of work
rather than a session, and which #3753 already tracks as its unbuilt direction
two. The number is here so whoever sizes that work has it.

Three trial kinds kept apart, and two bases kept apart

Each of these was a wrong number before it was a distinction:

  • A trace from before the event schema carried ts has tool durations and no
    wall clock. It stays out of the numerator as well as the denominator, instead of
    entering as a zero that deflates the share. 180 of the traces here are this.
  • A trial that recorded nothing is counted separately. A credential that never
    authenticated writes empty traces, and folding them in reports a broken run as an
    old one — the separation postmortem puts first, for the same reason.
  • A task directory with no stella-events.jsonl is the other contestant's
    seat. Walking on the agent/ directory alone read 16 opposing trials on
    13f7f2bb533d as trials of ours that died.

The render also prints the shell figures under their own heading. A share needs a
clock and is held to the trials that carry one; a duration does not, so a trace on
the older schema still contributes its shell time. Printed as one block, the
smaller tool figure read as though it contained the larger shell one. 1aabe7c76
is that fix, and it followed me publishing the misreading on #3753 — the bash
hours were right and the call count beside them was every tool's.

The witness

  • This PR includes witness tests (fail on main, pass here).

bench/trace_triage/tests/test_census.py:

  • test_a_trial_without_a_timestamp_stays_out_of_every_share — the 600s an untimed
    trial spent is absent from the share and still visible in bash_ms.
  • test_a_killed_call_whose_command_comes_back_is_paid_for_twice — the commands
    pytorch-model-cli actually sent, verbatim.
  • test_a_run_that_never_timed_out_reports_no_waste — quiet on a healthy run.
  • test_the_rendered_census_names_the_basis_of_its_share and
    test_a_share_with_no_wall_clock_behind_it_is_absent_rather_than_zero.
  • test_a_trial_that_recorded_nothing_is_not_reported_as_an_old_schema.
  • test_the_other_contestants_seat_is_not_a_trial_that_recorded_nothing.

Offline by construction: every trace is written, never fetched.

The gate

  • pytest bench/trace_triage/tests/test_census.py — 7 passed
  • ruff check and ruff format --check on both new files
  • make prose, make line-citations, scripts/check-file-size.sh

bench.yml runs pytest bench/trace_triage/tests on every pull request and its
scope filter names bench/, so this suite is gated in CI rather than only here.
No workspace build was run locally, per SCR-001.

Conflict surface

Two new files, nothing shared touched. #6501 adds bench/trace_triage/waits.py
for blind waits and edits detectors.py and tests/test_postmortem.py; this
branch touches none of those, so the two can land in either order.

Refs #3753

#3753 reports tool execution at 75% of agent wall clock on one match, and
asks for that number again on a comparable panel "on the same clean-basis
method". The method was an uncommitted jq incantation, so the next panel
would have produced a figure nobody could hold against the last one.

census.py is that method. Wall clock is the first event to the last, per
trial; tool time is tool_result.duration_ms over the join run_trace already
performs; a share is a ratio of two sums over one named trial set. Run
against the match #3753 cites it answers 52.0% over 12 trials, reproducing
the 51.8% already published on the issue from the same match.

The basis rides on every result because this issue is the case for it. The
body says 75% over a clean basis of nine tasks and a later comment says 52%
over the twelve that carried events. Neither corrects the other and either
one quoted alone describes a population the reader cannot see.

Three trial kinds are separated rather than summed. A trace from before the
event schema carried ts has tool durations and no wall clock, so it stays
out of the numerator as well as the denominator instead of entering as a
zero that deflates the share. A trial that recorded nothing is counted
apart from that, because a credential that never authenticated writes empty
traces and folding them together reports a broken run as an old one. And a
task directory without stella-events.jsonl is the other contestant's seat,
skipped rather than counted as our failure — walking on the agent/
directory alone read 16 opposing trials as trials of ours that died.

Inside the tool time it names two costs the trace can establish with no rig
and no spend: a call bash killed at its timeout, and a killed call whose
command a later call repeats. The second is the shape pytorch-model-cli
died in — an install killed at 120s, the same install killed again at 300s,
then a third attempt that ran.

Refs #3753

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @macanderson, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a committed, offline census for tool execution’s share of wall clock, with explicit trial-basis accounting and diagnostics for timeout/retry waste, plus tests that protect schema, population, and filesystem-boundary distinctions.

Sequence diagram for trial filtering and share calculation

sequenceDiagram
    participant CLI
    participant Loader as _load
    participant CensusOf as census_of
    participant Summarize as summarize
    participant Render as render

    CLI->>Loader: load_run(root)
    Loader-->>CLI: trials with stella-events.jsonl
    loop each trial
        CLI->>CensusOf: census_of(trial)
        CensusOf->>CensusOf: _wall_ms(trial)
        CensusOf-->>CLI: TrialCensus
    end
    CLI->>Summarize: summarize(censuses)
    Summarize->>Summarize: exclude untimed trials from wall/tool/model shares
    Summarize->>Summarize: keep empty_trials separate
    Summarize-->>CLI: Census
    CLI->>Render: render(census, label)
    Render-->>CLI: basis-labelled report
Loading

Flow diagram for the offline trace census

flowchart LR
    Root[Match or run directory] --> Load[_load]
    Load --> Trials[Trial events]
    Trials --> PerTrial[census_of]
    PerTrial --> TrialCensus[TrialCensus]
    TrialCensus --> Summarize[summarize]
    Summarize --> Census[Census totals and shares]
    Census --> Render[render]
    Render --> Output[Offline text report]
Loading

File-Level Changes

Change Details Files
Adds a committed census implementation for measuring tool and model execution shares against per-trial wall-clock totals.
  • Computes wall clock from the first and last timestamped events.
  • Aggregates tool, bash, model, and timeout-related durations over a named trial set.
  • Reports ratios of aggregate sums and includes the trial basis, untimed trials, and empty trials.
  • Supports mirrored run or match-directory layouts through filesystem-only loading and renders a CLI report.
bench/trace_triage/census.py
Adds offline witness tests covering measurement boundaries, timeout waste, retry detection, reporting, and trial discovery.
  • Verifies untimed traces do not affect wall-clock shares while retaining bash duration.
  • Checks exact and similarity-based reattempt accounting for killed commands.
  • Covers healthy runs, absent shares without wall clock, empty traces, and exclusion of opposing contestant directories.
  • Validates that rendered output identifies the population behind each share.
bench/trace_triage/tests/test_census.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

The census rendered `bash 24.48h over 18705 tool calls` on one line under a
`tool execution 14.95h` line, which says three wrong things at once. The call
count is every tool's, not bash's. The shell total is over every trial while
the tool total is over the trials that carry a timestamp, so the smaller
number does not contain the larger one. And the indentation read as though it
did.

I published that misreading before catching it — the count went out on #3753
as "24.48h of bash wall clock in 18,705 calls" when the bash calls number is
13,245. The comment and the pull request body are corrected; this is the
render that invited it.

Now each section states what it is over. A share needs a clock and is held to
the trials that carry one. A duration does not, so a trace on the older schema
still contributes its shell time, under its own heading. `bash_calls` sits
beside `tool_calls` rather than standing in for it.

Refs #3753
@macanderson
macanderson merged commit be5e096 into main Sep 11, 2026
23 of 25 checks passed
@macanderson
macanderson deleted the fix/stella-p1-bench-and-plugins branch September 11, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closes-nothing Substantial change that closes no issue by design (SCR-003)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant