Skip to content

studiobench: a real-path performance benchmark and A/B simulator for Studio - #9296

Merged
danielhanchen merged 62 commits into
mainfrom
studiobench
Aug 23, 2026
Merged

danielhanchen merged 62 commits into
mainfrom
studiobench

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What this is

studiobench is a performance benchmark, profiler and A/B simulator for the Studio web UI that runs the real path: the real backend, real SSE bytes, real parseAssistantContent, the real autoscroll observer, real Streamdown and Shiki. No page.route on the primary transport and no local ChatModelAdapter.

It is purely additive. Nothing outside tests/studio/studiobench/, attribution/ and one new workflow file is touched.

Why

A full day of measurement failed to name what makes long generations slow, and the reason was the fixture rather than the analysis: the old harness measured a backend-free smoke page, so two whole mechanisms never executed. The cumulative <think> re-parse never ran. The autoscroll MutationObserver never ran, which is why LayoutDuration read as a flat floor.

Once it did run, it was pointed at the backlog. Of 40 frontend pull requests from the recent performance push:

verdict count
moved something measurable 2
no effect distinguishable from a null control 30
could not be measured (identical bundle, or a branch too stale to be a fair arm) 8

The two that moved: #8992 took message_menu.open_close_ms from 1,077.3 ms to 52.1 ms, and #9047 took reasoning_toggle.close_ms from 582.0 ms to 71.6 ms.

Several of the 30 had looked like clear wins right up until a detection floor was applied to them. That is the part worth generalising, and it is why this lands as a tool rather than as a number in a comment.

What is in it

Two paths, and the fast one is the point. --tier fast is a 57.3 second film at the 100K rung, about 5 minutes, or 9 for a full A/B wave. It exists so that someone trying a fix does not wait 20 minutes to learn they were wrong. It is a screen: one rung, a wider floor, direction only. --tier standard is the 243 second film across three rungs and is what a result has to survive before anyone quotes it.

A liveness gate. --assert-liveness PAYLOAD exits non-zero unless every scheduled action reports ran=true with no missed slot, and refuses a payload containing no cell rows rather than passing over it vacuously. This is the failure that has cost the most: three separate times, in three separate subsystems, code that could never fire reported as "no effect" and exited 0. Four scene actions recorded NOT RUN on 312 of 312 attempts because their slots opened while a follow-up turn was still streaming, and they read as fast, stable and meaningless.

A protocol document. CONTRIBUTING-perf.md is what an outside contributor needs in order to prove a claim: run a null control concurrently under the same load, derive a per-metric detection floor from it, then clear three gates (floor, sign consistency across paired ratios, effect exceeding its own scatter). It also records the traps, all of them observed rather than imagined: a stale branch measures its own age and not its diff, an already-merged change has to be measured against its merge commit's first parent or it produces a byte-identical bundle and a void that looks like "no effect", and the rung ladder varies thread size while holding reply length fixed, so a reply-length mechanism reads as a flat floor on it.

Ablation, so a lead can become a cause. arms/knobs.js injects knobs into the shipped build through add_init_script, so no recompile is needed. Every arm must report INVARIANCE and POTENCY: an arm claiming exactness that drifts is void, and an arm whose potency counter did not move reads NOT RUN rather than "no effect".

A parity digest, so that a performance change that quietly alters what is rendered is caught rather than shipped. It documents what it cannot see, which is stylesheet CSS, computed layout, colour and anything rastered.

One file for outsiders. python -m tests.studio.studiobench.build produces dist/studiobench.pyz. The bootstrap is stdlib-only and Playwright is imported lazily, so --doctor works on a machine with nothing installed, which is the machine where it has to say what is missing.

CI

studiobench-ci.yml deliberately gates on structure and never on a timing. A shared runner cannot resolve effects this size, and a job that is red when the runner is noisy teaches everyone to re-run it rather than to look at it.

job asserts
selftests 338 selftests, ruff, --doctor exits 0, the zipapp builds and the built artifact runs
liveness a real session at the 1K rung where every scheduled action ran

Verification

  • pytest tests/studio/studiobench -q: 338 passed
  • ruff check tests/studio/studiobench: clean
  • pytest tests/ --collect-only: adds 327 tests and zero collection errors, so repo-wide collection is unaffected
  • scripts/lint_workflow_triggers.py: passes with the new workflow included

Not in this PR

The A/B sweep drivers that turn the harness into a per-PR verdict follow separately, once ported off the assumptions of the machine they were written on. So do any performance fixes: a benchmark and a fix are different reviews with different risk.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49c77dba11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/studiobench-ci.yml Outdated
- name: Run a real-path session
run: |
python -m tests.studio.studiobench \
--tier quick --rungs 1K --reps 1 \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Choose a liveness rung that supplies follow-up turns

At the 1K rung, plan_rung() deliberately creates no follow_up_units because the target is below MULTI_TURN_MIN_CHARS, while the quick scene schedules send_turn twice; both calls therefore return ran = false with “stream queue is exhausted.” Consequently, once the real-path session succeeds, the following --assert-liveness step deterministically exits nonzero. Use a rung such as 10K that supplies the two follow-up turns, or explicitly exempt those actions.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Obsolete at head. The workflow no longer uses the 1K rung: it runs --tier fast --rungs 100K with --allow-not-run image_upload, and the step comment documents the 1K failure you describe as already fixed.

Comment on lines +375 to +376
rows = []
try:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Start resource cleanup when the first Studio launches

The cleanup try/finally begins only around the cell loop, after Studios, the pacer, watchdog, browser, recorder, authentication, and provider registration have already been created. Any earlier return or exception—for example a failed health check, development-bundle rejection, treatment install failure, authentication error, or browser launch failure—bypasses stop_studio(), pacer.stop(), and browser/watchdog cleanup, leaving owned processes and ports behind for subsequent runs. Enclose acquisition and setup in the cleanup scope as soon as the first owned resource starts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Resource hygiene rather than a wrong measurement inside a run. Flagging the real version of the concern for follow-up: launch_studio uses setsid -f, so an orphaned base Studio survives a setup failure and a rerun on the same port would pass wait_for_healthz against the OLD build. A port-in-use guard would close that; restructuring the try/finally as filed is a design change.

danielhanchen and others added 9 commits August 19, 2026 19:03
…lator for Studio

Adds tests/studio/studiobench, a self-contained benchmark that drives a real
Studio install through scripted long-context sessions and reports where the
time goes.

The tool exists because the previous harness measured a fixture that did not
run the code under investigation. It used a local ChatModelAdapter, which
bypassed both the cumulative <think> re-parse in the chat adapter and the
autoscroll MutationObserver, so two of the three prime suspects never executed
during a measurement. studiobench drives Studio as a real app instead: an
external provider registered in the backend points at a bundled SSE pacer, so
bytes cross a socket, pass through the backend relay, and land in the SPA's own
decoder, parser and delta accumulation.

Three layers:

  runtime, pacer, fixture, scene   install and launch a real Studio, stream a
      frozen deterministic corpus at a deficit-scheduled cadence, and drive 15
      scripted actions as a fixed-duration film, so a slow machine records a
      missed slot rather than taking a different path through a shorter session.

  instruments, analysis, symbols   frame, input, RSS, glass, tracing, CPU
      profile, heap, coverage and forced-layout instruments behind one registry,
      with a symbol bridge that names minified React frames without ever letting
      a development-build millisecond into a table.

  arms, scoring, report            a telescoping ablation ladder where each arm
      declares what proves it did not change the output and what proves it
      fired, plus bounded perceptual scoring, an A/B that voids on control
      drift, and an offline report path.

Integrity gates are part of the design rather than an afterthought. A
development build is refused outright, because React's development paths inflate
the axis under investigation by about 3.2x in proportion to elements created per
frame, which does not cancel in an A/B ratio. Every zero carries whether the
thing was attempted, so "did not happen" and "could not be measured" cannot be
confused. Every batch carries a null arm that must read the same and a spike arm
that must read different, or nothing in that batch is quotable.

Verified against a real production Studio at the 1K and 10K rungs: 15 of 16
actions, no missed slots, no failed expectations, and corpus density of 6.37
chars per highlight span against 5.6 in the field capture.

Two known gaps are recorded rather than papered over. Seeded thread mass does
not render identically to streamed thread mass (20 percent drift in code blocks
and highlight spans at 10K), because a seeded message stores a reasoning part
and is never re-parsed on load, so rungs above 10K are labelled seeded_only. And
the three-clock agreement gate is not implementable on a headless engine, where
the screencast emits on visual change and rAF has no vsync to normalise against;
it reports null with a reason rather than a fabricated verdict.
…ing the measured reply

Three fixes, each found by running the tool rather than by reading it.

1. THE STREAMED TAIL IS NOW THE SAME SIZE AT EVERY RUNG.

The scene is a fixed-duration film: three actions run during generation and
ten run after the reply is complete, at wall-clock times. The streamed tail
used to grow with the rung, so at the field cadence it drained in 11s at 1K,
54s at 10K, 354s at 100K and 811s at 1M, against a film 135s long. Above 10K
the stream outlasted the whole film, so every action labelled "after the reply
is complete" ran mid-generation. Nothing crashed and a full table was printed;
the labels were simply false, which is worse.

The tail is now a fixed 6000 characters, sized from the film rather than chosen
round, and the entire size ladder lives in the seeded prefix. Stream duration is
15 to 18 seconds at every rung and each rung lands within 0.1 percent of its
target. This also isolates the variable under investigation: the question is
what a streamed chunk costs as a function of the thread already on screen, which
needs the chunk workload fixed while the thread grows, not both moving at once.

2. STOP_GENERATION NO LONGER TRUNCATES THE MEASURED REPLY.

It stopped whatever the cell was streaming. At the 10K rung the pacer got 5304
of 17737 characters away before the socket broke, so the ten actions after it
and the final census ran against a thread a third of its claimed size. The
seeded-versus-streamed equivalence check then compared that truncated reply
against a complete seeded one and reported 20 percent drift, which read as a
finding about seeding and was a finding about this action. Stop now starts and
stops its own short turn, so it also has something to stop at the small rungs
where it previously reported not_run.

3. --ab RUNS BOTH BUILDS INSIDE ONE SESSION.

Two Studios, one browser, one session id, cells alternating with the order
flipped per repetition so linear drift cancels instead of landing on whichever
side runs second. Both sides register the same pacer, so the bytes on the wire
are identical by construction. The production-build gate now runs on both sides,
because an A/B where one arm is a development build puts a 3.2x inflation on one
side and reads as a colossal win or regression. Init scripts are origin-gated:
localStorage keys are identical across the two builds, so seeding both
unconditionally had one build's auth token overwriting the other's.

Also in this change:

- layout_cost now registers. It was implemented in arms/layoutcost.py behind a
  register(register_instrument) hook that nothing called, so the M3 forced-layout
  hypothesis would have read as "not measured" rather than "not happening".
- The frame recorder exports its raw per-frame deltas. time_in_jank_pct and
  jank_index are defined over the whole distribution and cannot be recovered
  from percentiles, so two of the six scored metrics were uncomputable. Over the
  per-window cap it emits a bound and a reason rather than a biased sample: the
  gap array is sorted ascending, so a head slice would drop exactly the janky
  frames and score a stuttering window as clean.
- scoring/from_payload.py converts session rows into scored readings, keeping
  three absences apart: an action absent from the scene, an action that ran and
  recorded nothing, and an action that did not run and said why. At 1K
  scroll_after cannot run because the thread is shorter than the viewport, and
  scoring that as an instant scroll would make the smallest thread look fastest.
- The bare-zero ban now recognises how the session layer attests. It demanded a
  same-name sibling flag, so frames_over_33 needed frames_over_33_attempted,
  while the recorder writes one frames_attempted per instrument block. The check
  failed on every real payload, and a check that fails on everything gets turned
  off. Attestation now covers the block that declares it, still bites on a bare
  zero and on a zero under a false attestation, and does not leak into nested
  blocks.
- The census records where highlight spans live. A collapsed reasoning pane in a
  seeded thread does not mount its children while a streamed one does, so the
  same text carries 1485 more spans depending on how it got there. Without the
  split that is one number with three possible explanations.
- --report scores and renders an existing payload offline, so a payload from
  another machine analyses here.
…e this machine's noise floor

The first live A/B was main against main on one Studio, which is a null control
by construction: comparing a build with itself must land inside its own noise.
It did not, and finding that out is the point.

  keystroke_p95_ms  6.7%   max_frame_ms 18.5%
  menu_open_ms      5.8%   time_in_jank_pct 13.2%

So this machine cannot currently tell two identical builds apart at the 1K rung,
and the real noise floor here is 18.5 percent, not the declared 5. Any win
smaller than that measured on this box is not a win. The scoring layer already
refused to call it one; what was missing was the tool noticing that the run was
a null control at all.

Three changes:

1. An A/B whose two refs and two URLs are identical is now DETECTED as a null
   control rather than waiting to be declared. It renders as VOID with the
   metrics that drifted named, instead of as an ordinary table reading "7.7
   percent faster" from a build compared with itself. On a null control the run
   then derives and prints this machine's own noise floor.

2. Pairs are formed per REPETITION, matching (rung, rep) on both sides.
   Readings were collapsed to one per rung, so --reps 2 still produced one pair
   per metric, every confidence interval read "too few pairs", and the bootstrap
   had nothing to resample. Repetition r of each side ran adjacent in time,
   which is what makes the comparison paired at all.

3. image_upload reports WHY it found no attachments button. A bare "not visible"
   is the action layer's version of a bare zero: it cannot distinguish a control
   that is absent, one that is present and covered, and a locator that disagrees
   with the page, and it has already cost three wrong hypotheses. A direct probe
   found the button at 36x36, fully opaque and hit-testable, on a fresh chat,
   after a settings round trip, and under a 20,000-character composer fill, so it
   is none of those three. The row now carries geometry, computed style, hit
   testing, dialog and popper counts, so the next run answers the question
   instead of the next investigation.
…g-pane mount is not seedable

The 10K rung now passes its seeded-versus-streamed check on every gated
quantity, exactly: content_spans 3995 against 3995, content code blocks 5
against 5, assistant messages 4 against 4, reasoning panes 4 against 4. Seeding
reproduces the rendered content precisely, and never was the problem.

What the check had actually been measuring, in three layers:

First, stop_generation was aborting the cell's own stream, so the comparison put
a truncated reply against a complete seeded one and called the difference a
seeding failure. Fixed in the previous commit; the drift fell from 20 percent to
2.1 percent.

Second, the fix then left its own throwaway turn in the thread, which showed up
as "streamed 5 assistant messages vs seeded 4". Stop now removes the turn it
created, so the thread it leaves behind is the thread it found, and reports
whether the cleanup worked rather than assuming it.

Third, and this one is a property of the app rather than of the fixture: a
collapsed reasoning pane mounts its children only when the text was STREAMED
into it. It was open while the text arrived and collapsing leaves the subtree in
place; a seeded thread never mounts it, and open-then-close on the seeded side
unmounts it again. So gating on total highlight_spans asked a question seeding
can never pass, and the answer moved with whatever pane state the film happened
to leave behind: two runs of the same rung reported 2.1 and 36.4 percent.

The gate is now content, and the reasoning difference is measured and reported
beside it:

  reasoning_spans   streamed 2285   seeded 0        100%
  highlight_spans   streamed 6280   seeded 3995    36.4%
  assistant_chars   streamed 38836  seeded 19798   49.0%

A streamed thread carries 36 percent more mounted DOM and 49 percent more text
than the identical thread reopened. That is worth stating plainly: it means the
field symptom lives in the streamed state, and that reopening a thread sheds
most of the mass that streaming accumulated.

Also: image_upload's new diagnostic answered its own question on the first run
that used it. The button is in the DOM with width 0, height 0 and a null
offsetParent, so it is the unmounted duplicate composer the code comment warned
about, and the :visible filter is right to reject it. Three hypotheses had been
spent on that, and a direct probe had already refuted all of them.
…nce per cell

Four changes to the fixture, all verified against a real Studio.

RANDOMISED BLOCK AND TURN SIZES. Every prose block was 1,250 characters and
every fence 1,800, and the escalating cycle was an exact doubling. With every
block the same size, "cost per block" and "cost per character" are perfectly
collinear and no measurement can separate them. Sizes now jitter plus or minus
55 percent on blocks and 35 percent on turns, symmetric so the span-density
calibration the corpus is tuned to keeps its mean. Randomised is not
nondeterministic: the jitter is drawn from the per-unit RNG, so unit 40 is the
same text whether it was reached by generating 41 units or by asking for that
one, and the corpus hash still pins every byte.

TOOL CALLS. The corpus had prose and fences and no tool calls at all, so a
component with its own mount and update cost was never exercised. The stored
part shape was VERIFIED rather than guessed: a flat tool-call part and an
assistant-ui tool-invocation wrapper both rendered their sibling text and no tool
UI, while the shape carrying argsText and state produced a tool block. Tool calls
now scale 1, 5, 14, 23, 29 across the ladder, and the census counts them.

The census selector was wrong twice, and both times it read a confident zero on
a thread that provably contained tool blocks. There are two renderers: a known
tool gets tool-group-root, anything else gets the generic tool-fallback-root. It
counts both now, and reports 2 where the plan seeds 2.

MORE THAN ONE STREAMED TURN. A cell seeded its bulk and then streamed exactly
once, at the end, so the quantity this tool exists to measure -- what a chunk
costs given what is already on screen -- was sampled once per cell. A new
send_turn action streams two further turns mid-film with user actions on either
side, alternating reasoning-heavy and code-heavy units so consecutive sends
exercise the cumulative think re-parse and the Streamdown path rather than
repeating one of them. Verified live: turn 1 reasoning 9 to 11 messages, turn 2
code 11 to 13, first token about 60ms each.

The follow-ups cost no wall clock: they are 1,500 characters each against an
opening turn that keeps the full 6,000-character budget. Rungs still land within
0.08 to 1.52 percent of their target, and the opening stream still drains in 12
to 18 seconds at every rung.

Two bugs of my own, both caught by running rather than reading:

- The second send_turn re-sent the FIRST turn, reporting turn_index 1 twice. The
  scene builds each action's args as {**base_args, **slot.args}, so the scalar
  cursor I wrote back landed in a dict that is discarded when the action returns.
  It is a shared mutable cursor now.
- Splitting the streaming budget evenly across three turns left the opening
  stream draining in about four seconds, shorter than the during-generation slots
  timed against it, so those slots would have run against a finished reply while
  still being labelled "during generation". The rung-plan invariant test caught
  it before any run; the opening turn keeps the whole budget and the follow-ups
  are extra.

A rung below 20,000 characters streams once. Three turns need about 9,000
characters of budget and the 1K rung is 4,000 in total, so splitting it three
ways put the rung 40 percent over its own target. A 1K-token conversation being
a single exchange is also what it actually is.

Known gap, stated rather than implied by the tool counts: the pacer does not
stream tool calls. It emits reasoning_content and content only, so tool blocks
arrive by seeding alone and a streamed turn never exercises a live tool call.
… tier

Three things this run of the tool could not do, each of which turned out to
hide a check that reported success without looking.

UI PARITY. A normalised structural digest of the rendered DOM, taken at the
close of every action window on both arms of an A/B, so 'the UI is unchanged'
becomes a per-action assertion instead of a claim. The first null control
failed on 42 of 42 pairs with identical character counts on both sides: every
message root carries a backend-minted data-message-id, the two arms are two
installs with two databases, and a UUID is fixed width. Attribution is
measured rather than argued, by re-running with exactly those rules removed.
Two silent false negatives came out of building the controls: the overlay walk
had never been able to fire because compare() only read the whole-thread
digest, and verdicts were being issued on actions that never ran, so
image_upload was reported as a stable matching surface nobody had opened.

SURFACE COVERAGE. 53 surfaces with reach, settle and restore, plus 11 listed
as known-uncovered with the mechanism that puts each out of reach. The chat,
image, video and audio pages are mounted persistently and only hidden and
inert off-route, so .aui-thread-root still resolves on /hub: with the default
root every surface would have returned one identical digest and all 53 would
have passed. Each surface names its own root and a scoping probe verifies the
move was observed. Reached is reported separately from comparable, because
three sweeps of one build disagreed on 9 of 53.

A FAST TIER. The eighteen actions cost about 12 s of real work at 100K; the
standard film spends 243 s delivering them. The fast film is 57.3 s and keeps
every action, because a tier that drops actions cannot tell you the fix broke
the one it dropped. Two packing constraints are now tests rather than
comments: stop_generation owns its own turn so it must clear the opening
drain, and anything needing a settled reply must clear the follow-up turn a
preceding send_turn started. The first fast film opened message_menu 1.7 s
after a send and recorded NOT RUN on 312 of 312 attempts across a 36 job
sweep, silently removing the four actions that carry the largest measured
effect in this codebase.
The harness measured 40 pull requests but nothing kept it working and nothing
told an outsider how to use it. Three additions close that.

A liveness gate. `--assert-liveness PAYLOAD` exits non-zero unless every
scheduled action reports ran=true with no missed slot, and refuses a payload
with no cell rows rather than passing over it vacuously. This is the failure
mode that has cost the most here: three separate times, in three separate
subsystems, code that could never fire reported as "no effect" and exited 0.
Four scene actions recorded NOT RUN on 312 of 312 attempts because their slots
opened while a follow-up turn was still streaming, and read as fast and stable.
`session.py` already counted `actions_not_run` and `slots_missed` per cell;
this turns the README's advice to check `ran` before reading a timing into
something a machine does. 11 selftests, including the empty-payload case,
because a gate that cannot fail is worse than no gate.

CONTRIBUTING-perf.md, the protocol for proving a performance claim: screen on
the fast tier, confirm on standard at 4 repetitions, clear the per-metric
detection floor from an in-band null control, sign consistency, stability, then
parity. It also records what the ladder cannot see, why a stale branch measures
its own age rather than its diff, and why an already-merged change has to be
measured against its merge commit's first parent.

A workflow. It deliberately gates on structure and never on a timing: a shared
runner cannot resolve effects this size, and a red-when-noisy job teaches people
to re-run rather than to look. Selftests, ruff, --doctor, the single-file zipapp
build, and a real-path session at the 1K rung whose only assertion is that every
action ran.

README now opens with how to run it rather than why it exists, and documents the
fast tier, which was undocumented.
…the apt step

Two fixes, both from the first real run of this workflow.

The liveness gate worked and caught my own mistake. I picked the 1K rung on the
reasoning that the smallest rung is the cheapest, and nine actions reported NOT
RUN, every one for an honest reason the rung itself caused: the thread was
shorter than the viewport so neither scroll could travel, no follow-up turns
were planned so send_turn found an exhausted queue, and the last assistant
message carried no More, Copy or Delete button. A gate asserting that everything
ran, at a size where most of it cannot, asserts nothing.

Rather than guess again, I checked real payloads. At 10K message_menu still
drops out on some cells. At 100K everything except image_upload runs on every
cell of every run measured, which is the same 100K the README names as the
smallest rung carrying real load, arrived at from the other direction. So the
job runs the fast tier's 57.3 s film at 100K.

image_upload is excused by name and it is the only one. It reports NOT RUN with
the same evidence every time: the composer's attachments button is in the DOM
with a zero box and mounted false, alongside model_loaded_hint false. This
fixture drives an external provider and loads no model, so Studio does not mount
the control. That is a property of the fixture, not of anything under test,
which is what the flag is for. It is documented at the call site so it can be
closed rather than inherited.

The apt step now goes through retry-with-apt-lock.sh, carries timeout-minutes
and sets APT_ACQUIRE_RETRIES, which the repo's own guards require and which I
had missed because the branch predated them. The CDN download is separated from
the apt transaction, --with-deps is dropped so playwright does not run its own
apt-get update, and the libraries are probed by launching the engine rather than
assumed missing. Rebased onto main so those guards apply.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee6de26689

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

_log(f"\nA/B table could not be built: {type(exc).__name__}: {exc}")
return

text = render_ab_table(result)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require parity before rendering the A/B verdict

In an A/B where the treatment changes or removes rendered work, every action row already carries a parity digest, but this path immediately renders the timing result without pairing those rows or calling analysis.parity.compare_rows. Such a treatment can therefore be reported as IMPROVED even though it produced different UI—the exact case where a performance comparison is invalid. Compare the per-action parity rows and void or clearly fail the A/B before writing ab.md when stable actions differ or are not comparable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Parity is captured per action window, and CONTRIBUTING-perf.md makes parity step 4 of a human protocol kept separate from the timing table. Gating the A/B verdict on it is a new feature, and no number printed today is wrong.

Comment on lines +287 to +291
delta_pct = (geo - 1.0) * 100.0
anchor = METRIC_BY_KEY.get(metric_key)
lower_is_better = anchor.lower_is_better if anchor else True
worse = delta_pct > 0 if lower_is_better else delta_pct < 0
comparison.beyond_noise = abs(delta_pct) > noise_floor_pct

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce consistency and uncertainty before declaring an effect

When repetitions disagree, this classifies solely from the geometric mean and fixed floor; the computed bootstrap interval and ratio signs never affect the verdict. For example, paired ratios [0.8, 0.8, 0.8, 1.1] produce an IMPROVED verdict at a 5% floor even though one repetition regresses and the generated 95% CI extends above 1.0. This turns scatter into a quotable win or regression, contrary to the benchmark's stated sign-consistency and stability gates; require consistent signs and an interval/scatter test before setting beyond_noise.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Verdict policy. compare() classifies on geomean against the measured floor by design, and ratio_range and ci95 are both computed and rendered. Adding sign and stability preconditions changes the rule rather than fixing a measurement.

Comment on lines +580 to +582
session_id = session_id,
label = label,
is_null_control = is_null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Accept the measured null-control floor in real A/B runs

A null-control run prints a derived machine floor and tells the caller to pass it to a real A/B, but the CLI defines no noise-floor option and this call supplies neither noise_floor_pct nor noise_floor_source, so every real comparison silently uses the 5% default. On a machine whose null control measured 9%, a 7% delta will consequently be declared an effect even though it is inside the measured noise. Persist or accept the derived floor and pass it into compare_arms rather than issuing an unusable instruction.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The floor default is declared in the output as noise_floor_source "declared default", so nothing is passed off as measured. A --noise-floor option is a feature request; the "pass it to a real A/B" sentence overpromises, and that is a doc issue.

Comment on lines +325 to +328
with s.window("stream:drain", kind = "stream") as w:
drained = self._drain_stream(page, expected_ms)
w.note("drained", drained)
row["stream"] = drained

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Mark a cell incomplete when its stream never drains

If the renderer is still generating after the generous drain deadline, _drain_stream returns finished: false, but this result is only recorded and _run_inner returns normally, causing CellRunner.run to set completed = true. If the scheduled actions happened to run, both the CLI completion check and --assert-liveness can then pass a renderer that remained wedged more than three times past cadence plus two minutes, and its partial windows remain scoreable. Convert this result into a cell failure or otherwise make completion and liveness reject it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

stream.finished false and its reason are already on the cell row, so the incomplete drain is recorded and visible. Promoting it to a cell failure is policy, and the film's own windows were still measured.

Comment on lines +127 to +129
if frames.get("frame_gaps_truncated"):
truncated += 1
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail pooled frame metrics when any window is truncated

When one active window exceeds the frame-gap cap but another window exports gaps, this silently skips the truncated window and computes time_in_jank_pct and jank_index from the remaining subset; the existing failure branch runs only when no usable deltas remain. Because truncation removes an entire measured interval and can correlate with the busiest window, the resulting cell-level values can look clean while omitting its worst activity. Treat either pooled metric as failed whenever truncated > 0, or preserve an explicitly valid aggregate for the omitted window.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Scoring policy. frame_gaps_truncated is in the payload, max_frame_ms still folds the truncated window in, and the failure branch fires when nothing usable remains.

scene/parity.js numbers its message rows with a bare loop counter, so every
capture starts at `i: 0`. The payload validator's bare-zero ban already exempts
every other ordinal in the payload (index, rung_index, arm_index, window_index,
slot_index, step_index) but not this one, because it is spelled `i` rather than
`index`. The result was that --report raised PayloadSchemaError on any payload
carrying parity rows at all, so the documented report step never ran.

Exempt the ordinal only. A zero-length signature (chars: 0) stays a loud
failure, which is what the ban is there for.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b364369bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

payload: dict[str, Any] = {
"schema": "studiobench/payload/1",
"source": "recorder_rows",
"complete": bool(sections.get("header")) and bool(completed_cells),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require terminal evidence before marking a payload complete

If a standard/full run completes its first cell and the renderer or driver then dies on a later rung, completed_cells is nonempty and this marks the whole payload complete. render_summary therefore suppresses its RUN DID NOT FINISH warning for exactly the incremental-crash case the payload format is intended to preserve; completeness needs a footer or validation that every recorded planned cell/rung completed, rather than merely one successful cell.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

assemble_rows documents its rule that there is no footer row in the harness contract, and a crash still surfaces as rung_incomplete or renderer_crash in excluded_cells. With the ladder item above fixed, a truncated standard run now also shows its missing rung INCOMPLETE.

The branch was 60 commits behind main, which is the only reason the stack was
red: main has since fixed the four failure families this stack's CI was
inheriting (#9342 for the sliced chat-adapter harness and the install.sh
fallback range, #9348 for the two backend guards on the 3.13 leg, #9335 for the
3.9 union floor).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 119c7b2331

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +306 to +308
if weighted_logs:
total_weight = sum(w for w, _ in weighted_logs)
result.headline_ratio = math.exp(sum(w * lg for w, lg in weighted_logs) / total_weight)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require metric coverage before producing an A/B headline

When most instruments or scheduled actions produce no usable readings on both arms, weighted_logs can contain only one low-weight metric, yet this renormalizes that metric to 100% of the headline and enables an IMPROVED or REGRESSED verdict. Thus a completed comparison with five of six metrics missing can still make a quotable global claim, unlike rung scoring's explicit coverage floor; refuse or void the headline unless sufficient declared metric weight is represented.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A coverage floor on the headline is new policy; n_pairs per metric is already rendered so a thin result is visible to the reader.

Comment thread tests/studio/studiobench/__main__.py Outdated
"instrument_level": args.instrument_level,
}
)
rec.gate("production_build", verdict.production, verdict.as_dict())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Run the integrity self-checks before recording cells

In every real CLI run, setup proceeds from attaching instruments to recording only the production/reportable gates and then directly into the cells; repository-wide usage shows instruments.selfcheck.run_gates() is invoked only by unit tests. Consequently the injected-stall, input-delay, scene-contrast, long-task-support, and clock-agreement checks never execute or abort a measurement, so a blind or misattributed instrument can still generate a normal report despite these gates being implemented specifically to prevent that.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct that run_gates() is only called from unit tests, but wiring it needs a whole calibration phase: baseline and delayed keystroke passes, stall injection and scene contrast. That is unbuilt work, not broken code. Worth noting the input.js fix above is the precondition for the input-delay gate ever passing.

pre-commit-ci Bot and others added 2 commits August 20, 2026 21:30
Following the README literally on a clean checkout does not produce a number.
Three separate defects, all now covered by tests:

--report failed the bare-zero ban in three places on a real payload, none of
them a missing measurement. The first parity message row is an ordinal spelled
`i` rather than `index`. The equivalence block exempted `drift` but not the
two counts drift is computed from, so a field absent from both arms (0 streamed,
0 seeded, marked gating:false by the payload itself) was rejected. And an
instrument that attests with `frames_attempted` had that attestation dropped as
soon as the walker stepped into a sample array, so a 0 ms inter-frame gap read
as a hole. The gate is wrong in all three cases, not the data.

The docs never mentioned that --attach needs credentials. --username and
--password exist but appear in neither document, so the README's own iteration
command fails with HTTP 401 after the browser has started, and --doctor reports
PASS on that exact configuration. Document the flags, the bootstrap password
path, and the fact that --branch is a multi-gigabyte install rather than the
advertised 20 minutes. Also fix the output path (payload lands in <out>/, not
report/, which is a source package), tell the reader to pass --out rather than
have a directory appear in their clone, install webkit rather than chromium on
the platforms that default to it, and document --report and summary.md, which
were named nowhere.

Two --help strings were misleading: --ab advertised itself as "not yet wired"
while the contributor guide builds its whole protocol on it, and --tier omitted
fast, the tier the README pushes hardest.

CI ran the session but never --report, which is why a validator that rejected
every payload it produced looked green. Run it, and require the summary.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0d6d34474

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/studio/studiobench/scoring/ab.py Outdated
Comment on lines +347 to +350
floor = max(minimum_pct, max(deviations))
return floor, (
f"measured from the null-treatment control over {len(deviations)} metrics "
f"(worst deviation {max(deviations):.2f}%)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve per-metric null-control floors

When different metrics have different noise, this collapses every null-control deviation into one global maximum, despite the benchmark protocol requiring a floor per metric. For example, a noisy frame metric with a 20% deviation makes a stable menu metric's 10% improvement appear inside noise even if that metric's own null deviation is 1%, suppressing real effects and making the generated floor unusable for the per-metric gate. Return and apply a floor keyed by metric rather than the worst deviation across all metrics.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

noise_floor_from_null_control documents returning the worst deviation, and per-metric floors mean threading a map through compare(). Design change; the per-metric deltas are already in the table.

Comment on lines +204 to +206
# Repetitions of the same rung: keep the first and let the caller ask for reps
# explicitly. Silently averaging reps here would hide a bimodal rung.
by_rung.setdefault(rung, readings)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include every repetition in scored reports

For the documented --tier standard --reps 4 workflow, measures_from_records() silently keeps only the first cell for each rung, and report.build.score_payload() consumes this collapsed result directly. Consequently --report bases every per-rung metric, onset, and aggregate on repetition 0 while discarding the other three measurements, so an outlier first repetition can determine the published summary despite the user explicitly collecting repetitions for stability. Preserve repetitions through reporting and combine or display them with an explicit policy instead of using setdefault.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

measures_from_records documents keeping rep 0 because silently averaging reps here would hide a bimodal rung, and measures_by_cell exists precisely so the A/B keeps every repetition. Reporting policy, not a bug.

Comment on lines +364 to +367
# An action that ran but overran its budget has pushed nothing (the next slot has its own
# absolute start), but it has overlapped the next one, so it is flagged.
row["over_budget_ms"] = round(over_ms, 1) if over_ms > 0 else 0.0
row["over_budget"] = over_ms > 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject actions that overrun the fixed film

When an action finishes after its deadline but before the following slot's deadline, the sequential runner starts the following action late, yet that action still records ran=true and slot_missed=false. Although this code records over_budget, neither scoring nor --assert-liveness checks it, so the CI gate can pass a run whose later actions occurred at different stream occupancy than the fixed wall-clock film promises. Treat an overrun as a liveness/completion failure or exclude the affected measurements rather than merely annotating it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

(t_start_ms, budget_ms) is a window to START in, so arriving after t_start but inside the budget is the contract and over_budget_ms is recorded. An action that really is too late already records slot_missed and fails --assert-liveness.

Comment on lines +91 to +96
" for n in ('chromium', 'webkit', 'firefox'):\n"
" try:\n"
" p = getattr(pw, n).executable_path\n"
" out.append(n if pathlib.Path(p).exists() else n + ' (not installed)')\n"
" except Exception:\n"
" out.append(n + ' (unavailable)')\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail doctor when no browser engine is installed

On a machine with the Playwright Python package but without downloaded browser binaries, the probe prints every engine as (not installed) and still exits zero, so check() reports [ok] and the overall doctor can return PASS. The subsequent benchmark then fails at factory.launch(), even though --doctor is specifically presented as the prerequisite check for missing dependencies. Make the probe exit nonzero when the requested/default engine, or at least every engine, lacks an executable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in bdbf1f6. doctor printed "chromium (not installed)" and returned 0, but pip install playwright without playwright install is the README's own two-step quickstart, and the exit status is what a script reads. No engine with an executable is now fatal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correcting myself: I reacted positively to this and shipped the change, and CI proved it wrong. Making the missing engine fatal broke the studiobench-ci step named "Doctor reports rather than crashes", and the comment directly above that job's install step says why it must not fail: the job installs no browser deliberately, because "it must stay runnable on a machine with no Chromium, because that is also the machine an external tester first runs --doctor on". A non-zero exit there turns the one command that explains the problem into another thing that fails without saying why. Reverted in d0b5d21. What I kept is the half that was a real gap: the doctor now prints the missing engine and the exact playwright install command on that line instead of a bare [ok], so the silence you objected to is gone without breaking the invariant.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b71be5c1e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +356 to +359
const dropped = await removeLast();
const after = D.messageCount();
return {
removed: dropped && after < before,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delete both messages in the throwaway turn

When stop_generation starts its own turn, this calls removeLast() only once, so it deletes the assistant response but leaves the preceding one more user prompt in the thread. Studio's deleteThreadMessage removes replies automatically only when the selected target is a user message (studio/frontend/src/features/chat/utils/delete-thread-message.ts:150-163); deleting an assistant does not remove its parent. The code nevertheless reports removed=true, and every subsequent action, census, and equivalence check runs against a thread containing undeclared scaffolding rather than the planned corpus.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Factually right, and I checked it: deleteThreadMessage cascades only from a user message, so the comment above STOP_CLEANUP_JS overstates what the code does. But the residue is one short user turn, present identically on both arms and outside every gated key, since assistant_messages, content_spans, content_code_blocks and reasoning_panes are all assistant-side. No measurement moves. The fix as literally described would also delete a CORPUS assistant message, because dom.js only has lastAssistantMessage(). A comment correction, not a code change.

The README says the ratio is measured per rung rather than assumed at 4.0, and the frozen corpus
carries a quarter of headroom (MANIFEST_CHARS_PER_TOKEN = 5.0) that exists only so a measured
ratio above the provisional one can reach plan_rung. Neither was true of the production path:
build_cells defaulted chars_per_token to 4.0 and the only production caller never passed it, so
every rung was planned at exactly the provisional ratio. measure_chars_per_token ran afterwards,
on the already-seeded thread, and its result was recorded and read by nothing.

On this corpus tiktoken reads 3.336, so a cell labelled 1M tokens held 4,000,000 characters, about
1.2M tokens, a fifth over its own label, on the axis the ONSET RUNG headline is quoted against.

The ratio is now measured once on the corpus before any cell is built and passed into plan_rung,
and it travels on every cell's meta with a ladder_ratio_measured gate row. Measured once rather
than per rung on purpose: the per-cell number comes from that rung's streamed unit alone, 6,000
characters of either reasoning or code, and swings between 3.2 and 4.9 by which kind the rung
lands on. The axis needs the corpus's ratio, not one turn's.

Only a real tokeniser sizes the ladder. measure_chars_per_token's last-resort whitespace estimate
labels itself as off by tens of percent on dense code, and this corpus is mostly dense code, where
it reads 6.675 against tiktoken's 3.336 -- past MANIFEST_CHARS_PER_TOKEN, so feeding it to
plan_rung would make the whole run refuse on any machine without a tokeniser. Without one the
rungs keep the provisional ratio and the gate records that they did.

Suite 548 -> 551.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 4 commits August 23, 2026 02:59
…d no frames

_frame_measures pooled the active windows of a cell and skipped, with a bare continue, any window
whose recorder was installed and exported no gaps. That window contributed no deltas, no wall time
and no worst frame, so the remaining windows answered for the whole cell.

That is the one case compute_frame_stats already refuses to score. A single window with
frames_attempted and no gaps reads Measure.failed on every metric with no_frames_recorded set,
because rAF stops being scheduled when the compositor decides nothing is visible and the naive
reading of that is zero dropped frames. Pooled, the same window read as absent rather than as
unmeasured.

The recorder produces exactly this shape: instruments/frames.js emits frames_attempted true,
frame_gaps_ms [] and max_frame_ms null when it saw no frames, and a cell opens one window per
action beside the stream window, so a freeze covering one action leaves that window frameless and
its neighbours normal. Measured on constructed records: a 4 s frozen window beside a smooth one
scored 0.0 percent time in jank and a 40 ms worst frame, byte-identical to the same cell without
the freeze in it.

The pooled metrics now fail in the same shape as the single-window path. Placed after the
attempted_any check, so a cell where the recorder was never installed still reads not_attempted
rather than failed.

Suite 551 -> 554.
The identity axes covered the tier, the cadence, the instrument level, the corpus and the two
refs, and not the engine that rendered every frame of the ladder. So a run recorded under
chromium, resumed with --engine webkit and another rung, was accepted: _resume_set skipped the
chromium cells by cell_id, webkit measured the rest, and score_payload read the two as one
build's ladder. assemble_rows keeps the FIRST run_meta as the assembled payload's one header, so
what the file states about the engine covers rungs it did not render.

The engine is now an identity axis. requested_identity resolves it the way browser.launch does,
via default_engine, rather than comparing the flag: --engine has no default and the commonest
change of all is one run naming an engine and the resume naming none. default_engine reads
platform.system() and nothing else, so it is answerable before anything is installed, and
Playwright stays lazily imported.

recorded_identities reads the resolved value out of run_meta.platform.engine, which is nested and
so invisible to the axis loop. run_meta is emitted after browser.launch returns, so a session that
never got a browser up declares no engine and, by the rule every other axis follows, still
resumes.

Two selftest stubs hardcoded engine = "webkit" for the bundle they fake. They now resolve it, or a
legitimate resume would read as an engine change on Windows, where the default is chromium.

Suite 554 -> 558.
…rs-per-token ratio

A rung is named in tokens and built in characters, and the chars-per-token ratio is the only thing
that makes those the same claim. ladder_chars_per_token measures it afresh on every invocation,
--resume included, and nothing pinned it across one: corpus_hash is the frozen fixture's own hash
and says nothing about how many tokens a tokeniser reads out of it, and cell_id is the rung, the
arm and the repetition.

The fallback is bi-stable on legitimate input. measure_chars_per_token tries tiktoken first, then
Studio's count_tokens endpoint, each inside a bare except, and anything else is not in
LADDER_RATIO_SOURCES, so the ladder keeps the provisional 4.0. tiktoken is not a dependency of
this harness, and where it is installed get_encoding fetches cl100k_base over the network on first
use. So one absent package, one cold cache or one blocked minute is the whole difference between
4.0 and 3.336 on this corpus.

Then a run with no tokeniser sizes every rung at 4.0 and dies at 100K, and the resume finds one
and sizes at 3.336: 1K and 10K stay at 4,000 and 40,000 characters while 100K and 1M are built at
333,600 and 3,336,000. Nothing downstream can see the mixture, since score_payload keys by rung
and the report prints one ladder, so ONSET RUNG names a token label standing over two different
amounts of work in the same table.

The ratio is recorded per cell on Cell.meta already, so recorded_identities reads it off a cell
the session actually wrote, on the same rule as the mode: a session that recorded no cell declares
no ratio, and a payload written before the ratio travelled on meta still resumes.

The check is ladder_ratio_problems rather than an entry in IDENTITY_AXES, on the same footing as
commit_problems: those axes are compared by prepare_payload before anything is installed, and this
one is not known until build_cells has measured the corpus. It runs immediately after that
measurement and before the first cell.

Tolerance is 5e-4. measure_chars_per_token rounds to three decimals and the provisional value is
exact, so every ratio that can reach a payload sits on a 0.001 grid, and half a grid step
separates the same measurement re-read through JSON from a different one.

Suite 558 -> 565.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen added 2 commits August 23, 2026 03:42
… its ladder ratio

prepare_payload states the rule: a refusal has to leave the payload it refused exactly as it found
it, and an archive arriving after the Recorder has opened the file has already appended this run's
header to the payload it was moving. prepare_payload and commit_problems keep that rule by running
before the Recorder exists, at 485 and 560 against make_context at 714. The ladder ratio cannot:
it is not known until build_cells has measured the corpus, so its refusal at 839 was the only
payload-mutating exit in run().

So a refused --resume --rungs 1K,10K against a valid, complete 1K payload damaged it. run_meta is
already in the file at 724 and recorded_ladder folds EVERY run_meta by design, because a resume is
allowed to add rungs, so 10K became a rung the payload promised and never recorded: --report on
the untouched file then scored it INCOMPLETE, declared for this tier but no cell was recorded for
it. The ladder_ratio_measured gate landed the same way, and excluded_from_rows turns any failed
gate into an excluded cell, so the report also grew a selfcheck_failed exclusion from a session
that measured nothing. Neither is recoverable by re-running: the rows are in the other run's
evidence file.

payload_mark takes the length before make_context opens the Recorder and rollback_session_rows
truncates back to it on the refusal path, so the file returns to its exact prior bytes. Safe
because the Recorder is the only writer on the main thread and flushes and fsyncs every row as it
emits it, so nothing is buffered to be written back after the truncation, and it is closed first.
A floor guard makes the truncate a no-op when the file is already at or below the mark, and an
OSError is logged rather than raised over the refusal that is the actual answer.

Moving the check earlier was the alternative. ladder_chars_per_token lives inside build_cells,
whose chars_per_token parameter flattens to source "caller" and provisional False, so hoisting it
would change a signature on the path every run takes to fix a path only a refusal takes.

Suite 565 -> 568.
ab.skippable_cells already describes this failure and quotes its headline: an interrupted standard
tier whose 10K pair had recorded a 30% regression published VERDICT: IMPROVED (20.0% faster) off
the 100K pair alone, with nothing in ab.md mentioning 10K at all. The guard it added closes the
resume road, by re-running every pair when an A/B has any work left. It says nothing about the
other road into the same place.

CellRunner.run catches the exception, records the failure and returns an incomplete row, so a
failed cell does not stop the run and _render_ab was reached unconditionally. readings_by_arm
drops a cell whose completed is not True, and compare_arms iterates set(base) & set(treatment), so
the failed cell takes its HEALTHY PARTNER out of the table with it and the rung disappears
entirely. Which rung is lost is chosen by which cell happened to die.

Measured on a two-rung A/B, 10K base 100 ms against treatment 200 ms and 100K base 100 ms against
treatment 80 ms, with the 10K base cell failed: the published verdict is IMPROVED, headline ratio
0.800, 20.0% faster, over rungs [100000]. The same payload with 10K complete is VERDICT: FAIL,
headline ratio 1.265, 26.5% slower, keystroke_p95_ms 26.5% worse against a 5.0% noise floor. A
milder variant turns NO DIFFERENCE into IMPROVED.

The exit code is already nonzero when a cell fails, and that is not enough here. render.py states
the editorial rule this rests on: printing a table with a warning above it does not work, because
the table gets screenshotted and the warning does not. ab.md is written to disk, outlives the
process and is what gets pasted into a PR, while _render_ab runs before _summarise so the console
shows the verdict first and the failure count after.

unmeasured_planned_cells answers which planned cells this session has no completed reading for,
read through latest_attempt_rows so a retry that recovered is not counted missing. A hole in the
plan sets the existing void path rather than inventing a convention: no numbers are printed, and
the reason names the cells. No noise floor is derived from a partial null control either, since
that number is quoted afterwards at every real A/B on the machine. planned defaults to empty, so
existing callers are unchanged.

Suite 568 -> 574.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc286cccd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/studio/studiobench/__main__.py Outdated

def planned_rungs(args) -> list:
"""The ladder this run will actually walk: `--rungs` when given, else the tier's own."""
return args.rungs.split(",") if args.rungs else list(TIER_RUNGS[args.tier])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize comma-separated rungs before setup

When --rungs contains ordinary whitespace or lowercase input, such as --rungs "1K, 10K", this returns " 10K" unchanged; much later, after Studio installation/launch and browser setup, plan_rung() indexes RUNGS[rung] and raises KeyError. Strip and normalize each label—and reject unsupported labels—before acquiring these potentially expensive resources.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and the damage is worse than a late crash, which is why this got a fix rather than a P2 shrug. planned_rungs did a bare split(","), so:

planned_rungs('1K, 10K') -> ['1K', ' 10K']   RUNGS[' 10K'] -> KeyError
planned_rungs('1k,10k')  -> ['1k', '10k']    both KeyError

The ordering is what matters. rungs = planned_rungs(args) is at :726 and run_meta is emitted at :729, while build_cells does not reach RUNGS\[rung\] until :815. recorded_ladder folds EVERY run_meta in the file, deliberately, because a resume is allowed to add rungs. So the crashed run leaves its promise behind:

ladder before   ['1K']
ladder after    ['1K', ' 10K']

and ' 10K' is a rung nothing can ever satisfy, so --report on that payload scores it INCOMPLETE from then on. That is the same permanent-damage class as 627c1d1 two rounds ago, arriving through the argument parser instead of through a refusal. Your point about the expensive resources is also right and is the smaller half: the install and the browser launch both sit between :726 and :815.

Fixed in f589e69. Both ways of typing it that read as correct are accepted rather than refused -- whitespace around a comma is stripped, a lowercase suffix is upper-cased, and an empty field from a doubled or trailing comma is dropped -- and anything else is refused by name against the ladder it was checked against:

--rungs '1X' names '1X', which is not a rung. The ladder is 1K, 10K, 100K, 500K, 1M, comma-separated.

The refusal lands at the first call, which is the watchdog arming before any side is installed, so nothing expensive is acquired. RUNGS is imported inside the function on this file's usual rule so --help still answers on a machine with nothing installed. Six tests in test_studiobench_cli_contracts.py, including the control that the tier still supplies the ladder when --rungs is absent. Suite 574 -> 580.

…dder

planned_rungs did a bare split(","), so --rungs "1K, 10K" became ["1K", " 10K"] and --rungs 1k,10k
became ["1k", "10k"]. RUNGS carries neither, and plan_rung indexes it directly.

The late KeyError is the smaller half. run_meta records the rungs the run PROMISED at 729, and
build_cells does not reach RUNGS[rung] until 815, and recorded_ladder folds every run_meta in the
file because a resume is allowed to add rungs. So a resume mistyped this way appended a rung that
nothing can ever satisfy to a payload that was complete, and --report scored it INCOMPLETE from
then on: the same permanent damage the ladder-ratio refusal had to learn to roll back, arriving
through the argument parser instead. The Studio install and the browser launch sit between the two
points as well, so the check is worth minutes even on a fresh payload.

Both ways of typing it that read as correct are now accepted rather than refused: whitespace
around a comma is stripped and a lowercase suffix is upper-cased, and an empty field from a
doubled or trailing comma is dropped. Anything else is refused by name against the ladder it was
checked against, at the first call, which is the watchdog arming before any side is installed.
RUNGS is imported inside the function on this file's usual rule, so --help still answers on a
machine with nothing installed.

Suite 574 -> 580.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: f589e69bbf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 06e94e9 into main Aug 23, 2026
26 checks passed
@danielhanchen
danielhanchen deleted the studiobench branch August 23, 2026 06:01
danielhanchen added a commit that referenced this pull request Aug 31, 2026
A top-level attribution/ directory holding one file is repository clutter, and
the file has no business being at the root: it is a vite config used by exactly
one thing, the studiobench harness under tests/studio/studiobench, whose
bridge_build.py is the only referrer in the tree.

Three things fall out of the move for free.

It stops shipping. attribution/ was a tracked top-level directory, so
setuptools-scm put the config in the sdist of every release; under tests/ the
prune from #10060 covers it. The published sdist was carrying a build config
whose consumer, after #10060, no longer ships with it.

It gains CI. studiobench-ci.yml triggers on tests/studio/studiobench/**, so a
change to this config now runs the suite. Nothing anywhere triggered on
attribution/, which is how this file managed to break twice inside its own
introducing PR (#9296).

Module resolution is unchanged. The config resolves its plugins through
createRequire anchored at studio/frontend/package.json precisely because no
ancestor of its own directory has a node_modules. That is still true of the new
location, so the reason the anchoring exists survives intact. studio/frontend
was the other obvious home and is the wrong one: package-data already globs
frontend/*.ts, so parking it there would ship it inside the wheel.

Verified by building the frontend with the config from both paths, against the
same node_modules:

  before  525 js, 509 maps, 522 banner hits, 0 sourceMappingURL, 2430/2506 names
  after   525 js, 509 maps, 522 banner hits, 0 sourceMappingURL, 2430/2506 names

Identical, including the SHA over the emitted relative paths -- and vite names
chunks by content hash, so an identical path set means identical bytes. The
built dist stays gitignored (the bare dist/ rule is unanchored). Both artifacts
build with no attribution entry and no tests path segment. Suite green:
1400 passed, 155 skipped, ruff clean.

Co-authored-by: danielhanchen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant