Skip to content

studiobench: the verdict tools, so a performance number can be shown to be real - #9297

Merged
danielhanchen merged 111 commits into
mainfrom
studiobench-sweep
Aug 23, 2026
Merged

danielhanchen merged 111 commits into
mainfrom
studiobench-sweep

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Stacked on #9296. Base is studiobench, so the diff shown here is only this change. Merge #9296 first.

What this is

studiobench answers "how long did this take". These two tools answer the question that actually decides a pull request: is that difference real.

They were written outside the repository during the audit of 40 frontend PRs and are ported here so that an outside contributor can reach the same verdict rather than being asked to trust one. Nothing outside tests/studio/studiobench/sweep/ is added; CONTRIBUTING-perf.md gains the commands.

sweep/floor_table.py

Prints a detection floor per metric, paired by repetition, then applies three gates.

The floor comes from a null control: the same build run against itself. Whatever spread that produces is how far apart two identical builds land on this machine under this load. A difference smaller than it is not a small effect, it is an effect that cannot be told from zero, and it prints VOID rather than as a number.

gate what it rejects
1. the per-metric floor a delta smaller than what identical builds already differ by
2. sign consistency a mean that clears the floor while its four paired ratios straddle 1.0
3. the effect exceeds its own scatter a consistent, floor-clearing mean whose readings range from 2% to 60%

Gate 1's bar is max(|null bias|, null spread) rather than the spread alone. In a null control several metrics show a systematic offset between the two arm labels with identical builds behind them: stop_generation.stop_ms reads 6.6% faster on the treatment side, tightly, on every repetition. Whatever causes that is charged to the treatment arm in a real comparison too, so it has to be cleared as well as the scatter.

Gate 3 is new here. It was applied by hand during the audit, where it rejected 12 rows that had passed gates 1 and 2 and were junk. Applying a documented gate by hand is how it stops being applied.

Per-metric rather than global because a single floor of 16.5% driven entirely by jank_index says nothing about whether message_menu.open_close_ms can resolve 5%. Every numeric timing on every action that ran is harvested and given its own floor. Paired by repetition rather than pooled because the two arms of a repetition run adjacent in time, and the element census climbs monotonically through a session, so pooling charges that climb to whichever arm ran later.

sweep/ui_parity.py

Compares the structural DOM digests both arms already record, per action. It separates actions where a mismatch is signal from actions that vary between runs of any build, and it counts NOT COMPARABLE and NOT EXERCISED as their own outcomes rather than folding them into the passes. An action that never ran is not evidence that it is stable.

With --null it derives the unstable set from a base-vs-base run and reports every disagreement with the declared set in both directions, so an entry gets audited rather than inherited.

What they refuse to do

  • Pool payloads recorded at two different tiers. A 57 second film and a 243 second film measure the same action with different amounts of thread settled around it; they are two measurements of one quantity, not two samples of it.
  • Score a payload against a floor from another tier, for the same reason.
  • Call anything a result with no --floor. Run it that way and it prints the deltas followed by a statement that none of them is a result.

Verification

Reproduces a known-true case exactly. On #8992's landed axis, the ported tool and the original produce identical output:

metric                        n       base      treat   delta %  spread %      floor %  verdict
message_menu.close_ms         4      556.0       30.2     -94.5       1.3          6.6  faster
message_menu.open_close_ms    4     1120.2       58.0     -94.8       1.2         16.8  faster
message_menu.open_ms          4      564.1       27.8     -95.1       1.2         37.6  faster

15 selftests, and every gate is tested in both directions. A gate that only ever passes is worse than no gate, because it gets cited.

  • pytest tests/studio/studiobench -q: 353 passed
  • ruff check tests/studio/studiobench: clean

Not ported

The fleet orchestrator that ran these across 40 PRs in parallel stays out. It reads /sys/devices/system/node, shells out to numactl and to gh, and assumes an output tree that does not exist in a clone. It is useful on the machine it was written for and a liability shipped, so CONTRIBUTING-perf.md describes the technique instead: pin whole physical cores, never split SMT siblings across jobs, one NUMA node per job, and run the null control as one of the parallel jobs so the floor sees the contention the results do.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.
danielhanchen and others added 2 commits August 19, 2026 19:07
studiobench answers "how long did this take". These answer the question that
actually decides a pull request, which is "is that difference real". They were
written outside the repo during the 40-PR audit and are ported here so an
outside contributor can reach the same verdict rather than being asked to trust
one.

sweep/floor_table.py prints a detection floor PER METRIC, paired by repetition,
and applies three gates. The floor comes from a null control, the same build run
against itself, whose spread is how far apart two identical builds land on this
machine under this load. A difference smaller than that is not a small effect;
it is an effect that cannot be told from zero, and it prints VOID rather than a
number.

Gate 1 is the floor, and the bar is max(|null bias|, null spread) rather than
the spread alone: in a null control stop_generation.stop_ms reads 6.6% "faster"
on the treatment side, tightly, on every repetition, and whatever causes that is
charged to the treatment arm in a real comparison too. Gate 2 is sign
consistency, which separates an effect from a metric that is thrashing. Gate 3
is new here: the effect must exceed its own scatter. It was applied by hand
during the audit, where it rejected 12 rows that had passed gates 1 and 2 and
were junk, and applying a documented gate by hand is how it stops being applied.

sweep/ui_parity.py compares the structural DOM digests the two arms already
record, separating actions where a mismatch is signal from ones that vary
between runs of any build, and counting NOT COMPARABLE and NOT EXERCISED as
their own outcomes rather than folding them into the passes.

Both refuse rather than guess: pooling payloads from two tiers is refused,
because a 57 s film and a 243 s film measure the same action with different
amounts of thread settled around it; scoring against a floor from another tier
is refused for the same reason; and running floor_table with no --floor at all
prints the deltas followed by a statement that none of them is a result.

Verified against a known-true case. On PR 8992's landed axis, the ported tool
reproduces the original byte for byte: message_menu.open_close_ms 1120.2 ms to
58.0 ms, -94.8%, spread 1.2%, against a 16.8% floor from its own wave's null
control.

15 selftests. Every gate is tested in both directions, because a gate that only
ever passes is worse than no gate: it gets cited.

@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: 5451f4970b

ℹ️ 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".

missing += 1
cid = r.get("cell_id") or ""
rep = cid.rsplit(".", 1)[-1]
out[(shard, rep, r.get("action"))][arm_of(cid)] = r

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 repeated action slots in parity pairing

Each film schedules scroll_during_generation and send_turn twice per cell, but both occurrences have the same action name, so this assignment overwrites the first row with the second even within one rung. A DOM mismatch after the first occurrence therefore disappears whenever the second occurrence matches; adding the rung to this key, as requested separately, would not fix this additional collision. Include an occurrence ordinal or another per-slot identity in the pairing key.

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.

Both doubled slots, send_turn and scroll_during_generation, are in analysis/parity.py: UNSTABLE_ACTIONS, so their pairs land in unstable_bad and can never move the verdict or the exit code. Coverage on rows that carry no verdict.

confident wrong answer.
"""
out: dict[str, float] = {}
for name, row in _actions_for(records, cid).items():

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 repeated action slots in timing harvest

The standard, quick, and fast schedules each run scroll_during_generation and send_turn twice, but _actions_for() indexes rows solely by action name and retains only the last occurrence. Consequently this purported harvest of every action timing omits the first occurrence entirely, allowing a performance change isolated to that slot to be absent from both its floor and verdict; iterate the raw rows or retain an occurrence-qualified metric instead.

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.

_actions_for keeps the last row on both arms, so the ratio stays like-for-like and the printed number is right for that slot. If one arm misses the second slot the metric drops out of the intersection and the pair is discarded rather than crossed.

select_all_copy asserts only that the selection came back with more than zero
characters. The selection is taken over the viewport DOM, so any change that
stops mounting the whole thread truncates the clipboard from roughly 400,000
characters to a few thousand while every timing improves and the action still
reports expect_ok. Nothing in the harness could see that.

Actions can now record a counts dict alongside their timings, cleared by the
same rule as timings when the action did not run. The floor table harvests them
as action.count.key and scores them with the same paired arithmetic and the
opposite sign: a timing falling is the result a change is trying to produce, a
count falling is a regression, so it reads LOST (invariant fell) rather than
faster. The comparison is against the other arm rather than an absolute
threshold, which needs no per-rung calibration because both arms seed a
byte-identical thread.

select_all_copy reports selected_chars. Its expect_ok stays chars > 0 on
purpose: an absolute bar there would need calibrating per rung and would go
stale with the corpus.

Also documents the case in CONTRIBUTING-perf.md, next to the note that the
parity digest cannot judge a change that alters the DOM by design.
@danielhanchen

Copy link
Copy Markdown
Member Author

Pushed one more piece to this branch: the table now scores correctness invariants, not only timings.

The gap it closes: select_all_copy asserts only that the selection came back with more than zero characters, and the selection is taken over the viewport DOM. So any change that stops mounting the whole thread truncates the clipboard from roughly 400,000 characters to a few thousand while every timing improves and the action still reports expect_ok. Nothing in the harness could see it.

Actions can now record a counts dict alongside their timings, cleared by the same rule as timings when the action did not run. The floor table harvests them as action.count.key and scores them with the same paired arithmetic and the opposite sign: a timing falling is the result a change is trying to produce, a count falling is a regression, so it reads LOST (invariant fell) rather than faster. The comparison is against the other arm, so there is nothing to calibrate per rung: both arms seed a byte-identical thread.

select_all_copy reports selected_chars. Its expect_ok stays chars > 0 deliberately, since an absolute bar there would need calibrating per rung and would go stale with the corpus.

Seven selftests cover it, including both directions of the count verdict and the boolean case, since True is an int in Python and a flag flipping is not a 100 percent regression. 360 tests pass, ruff clean.

@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: 0f527d82f0

ℹ️ 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".

print("\n (reported, not counted) actions that vary between runs of any build:")
for action, shard, rep, moved in unstable_bad[:8]:
print(f" {action:<26} {shard} {rep}: {', '.join(moved[:3])}")
return 1 if stable_bad else 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 Fail parity when no pair was actually comparable

If action rows exist but every pair is NOT COMPARABLE or NOT EXERCISED—for example, parity capture failed on both arms—stable_bad remains empty and this returns success even though there were zero MATCH/DIFFER observations. An automated invocation of the documented parity gate can therefore pass with no parity coverage at all; return a nonzero status when none of the results were actually 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.

The run prints NOT COMPARABLE: N (never measured; not a pass) and matched: 0 on the same screen. A payload where every pair failed capture on both arms is an instrument failure, not well-formed input.

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.
Picks up the payload validator fix so --report stops failing on the first
parity message row.

@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: d31cd62c57

ℹ️ 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 +129 to +130
if b:
out[metric].append((b, t))

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 Retain zero-baseline frame regressions

When a base cell has no long frames, time_in_jank_pct (and sometimes jank_index) is legitimately exactly 0.0; if the treatment introduces jank, this truthiness check drops the pair entirely instead of reporting the regression. Handle zero-to-zero and zero-to-positive pairs explicitly rather than omitting every metric whose base value is zero.

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.

if b: guards the division and the whole table is ratio arithmetic, so a zero base has no ratio to report. Quoting 0 to x needs a second, non-ratio metric type, which is a design change, and nothing wrong is printed today.

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).
Carries main into the stack: the four failure families this branch was
inheriting are fixed upstream, and the payload validator no longer rejects the
first parity message row.

@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: 1317b362fb

ℹ️ 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 +217 to +218
if stat["n"] > 1 and stat["spread_pct"] > abs(stat["delta_pct"]):
return f, "VOID (effect under its own scatter)"

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 verdicts based on a single pair

When a result contains only one matched repetition—such as a benchmark recorded with the default --reps 1 or an incomplete shard—this condition skips the scatter gate, while consistent is vacuously true and the observed spread is zero. Any one-off delta that clears the null floor is consequently printed as faster, SLOWER, or an invariant change despite having no repeatability evidence; require the documented minimum repetition count or return a non-result verdict when n is too small.

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.

Deliberate, and pinned by this PR's own test_gate_three_cannot_fire_on_a_single_pair. n is printed in its own column and the doc mandates --reps 4. Weak evidence for a real delta is not a wrong measurement.

Comment on lines +266 to +269
null_paths: list[Path] = []
for pattern in args.null:
null_paths.extend(shards_of(pattern))
unstable, derived, checks = unstable_set(null_paths or None)

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 Fail when an explicit null path matches nothing

When the user supplies a misspelled or empty --null pattern, null_paths remains empty and this call treats it exactly like omitting --null, falling back to the declared unstable set before continuing to score the payload. The documented parity command can therefore exit successfully without using the requested null control; explicitly supplied null patterns that resolve to no payload should return an error instead.

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 --null that resolves to nothing prints UNSTABLE SET DECLARED, not measured and names the remedy. The scoring set is measured | UNSTABLE_ACTIONS, so the fallback is a subset of the union and no mismatch is silenced that the derived path would have caught.

Comment on lines +291 to +295
if null_tiers and tiers and null_tiers != tiers:
print(
f"\n WARNING: the null control was recorded at tier {sorted(null_tiers)} and "
f"this payload at {sorted(tiers)}. Which actions are unstable depends on the "
f"film's slot spacing, so this unstable set does not transfer."

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 Refuse parity scoring across mismatched tiers

When the null control and target payload use different tiers, this branch only prints a warning and then calls report() with the non-transferable unstable set. Because action stability depends on the film's slot spacing, a difference can be classified as expected solely because it was unstable in the other tier, and the command can still return success; refuse the comparison rather than emitting a parity verdict from the wrong tier.

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 mismatch is user-supplied, two explicitly different directories, and the tool prints a warning naming the hazard before scoring. Silent mixing is what I fixed in 3818423436; loudly warned user error is not the same thing.

pre-commit-ci Bot and others added 3 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.
9296 is merged. Taking it from its own branch head rather than from main's
squash commit: the squash re-adds every studiobench file as new content with
no shared history, so merging it produces an add/add conflict in each one,
while the branch head shares the history this branch was cut from.

# Conflicts:
#	tests/studio/studiobench/CONTRIBUTING-perf.md
The two-tier null control test opened by proving the pooling it guards
against was real: a differing 100K pair from the fast film and a matching
one from the standard film reached min_observations together and marked
the action unstable across two films.

latest_attempt_rows now keys an attempt on any attempt-stamped row rather
than on the terminal cell row alone. The two films in this fixture write
the same cell ids, so they are read as two attempts of one cell and the
superseded one is dropped before pairing. One observation survives and
nothing is derived, so the old setup assertion was asserting a bug that no
longer exists.

The refusal itself is kept and still asserted. It is the layer that does
not depend on the two films colliding on a cell id, and two tiers walking
different ladders need not collide at all.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 5 commits August 23, 2026 07:39
An action with ran = True and expect_ok = False reached neither problem
branch, so --assert-liveness exited 0 even though the action could not
prove it performed the intended UI operation. scoring/from_payload.py and
report/payload.py already refuse a timing whose assertion failed, so the
gate was the one reader that did not. A selector or interaction regression
failing every cell's assertion left the workflow green while the benchmark
surface was no longer functional.

Keyed on expect_ok is False, not falsiness, so an action with no assertion
of its own (expect_ok None) still reports NOT RUN rather than blurring the
two failure modes.
The bootstrap CI was computed, printed in the ci95 column and then never
consulted: beyond_noise alone decided improved or regressed. Paired ratios
of 0.7, 0.7, 1.2, 1.2 give a geometric mean of 0.917, clear of a 5% floor,
with a CI of 0.700-1.200 that contains 1.0, and the table read IMPROVED
over data whose repetitions do not agree on the sign. sweep/floor_table.py
already voids its own pooled ratios under the same rule.

A win is withheld, a fail is never cleared: the better side becomes
inconclusive, the worse side stays a regression but is labelled unresolved
so the size is not quoted as measured. The headline line follows, since a
per-metric inconclusive under a quotable VERDICT: IMPROVED was the half fix.

Ratios that do agree, 0.70 0.72 0.68 0.74 with a CI of 0.690-0.730, still
read improved, so the gate does not swallow real effects.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 3 commits August 23, 2026 08:14
…support

Gating only the verdict word left the number beside it uncorrected. One
resolved metric anywhere unlocked IMPROVED for the whole aggregate, while
weighted_logs still carried every mover. keystroke_p95_ms at 0.2, 0.2, 1.5,
1.5 (geomean 0.548, CI 0.200-1.500) beside a resolved menu_open_ms of 0.900
quoted a headline of 0.631, a 36.9% win almost entirely made of data the
same table labels inconclusive. It now reads 0.900, the 10% actually
resolved, and the direction is unchanged.

Two ways the exclusion could have weakened an existing refusal, both
covered: an all-unresolved table has no headline at all and must read
INCONCLUSIVE rather than NO READING, which blames the instrument for a
refusal that came from the data; and an unresolved mover beside a flat
metric puts the aggregate back inside the floor, where NO DIFFERENCE would
assert the change did nothing. Metrics within noise still contribute, since
they are the evidence of no effect and pull toward 1.0. Regressions are
collected independently of the headline, so no fail can be cleared.
The allow-list skip sat above all three problem branches, so a name passed
to --allow-not-run left the liveness loop entirely rather than being excused
for not running. image_upload is listed in studiobench-ci.yml only because
the fixture cannot mount the control; scene/actions.py returns ran = True
with expect_ok set the moment it can click, so once it does mount, an upload
that produces no attachment would have exited 0 on a broken surface.

The allowance now applies only inside the not-ran branch. This does not
tighten the current CI: scene/schedule.py records a real missed slot as
ran = False, so a slow runner still lands in the not-ran branch and stays
excusable by name, which is covered by a test.
@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

danielhanchen commented Aug 23, 2026 •

Copy link
Copy Markdown
Member Author

Round summary for this sweep.

CI. pre-commit.ci - pr was red for a merge conflict, not a lint failure: the run page showed only queue then mergeable check -> merge conflict, with no hook executed. 9296 was squash-merged, so its commits share no history with this branch and merging origin/main produced add/add conflicts on 8 studiobench files. Merging 9296's real branch head (f589e69b) first reduced that to 3, and for all 3 main's content is byte-identical to 9296's, so the whole difference was this PR's own additions. pre-commit.ci went green on 1be49393.

Six items, all genuine, all fixed.

Item Fix
Require the confidence interval to clear no-effect 69b1d8e88
Reject actions whose own liveness assertion failed 99683b525
Exclude inconclusive metrics from the headline claim 5d35053ac
Limit allow-not-run to actions that did not run 6d26c658e
Check missed slots before applying not-run allowances 5f8d14f9e
Treat an unavailable CI as unresolved a2e36fae3

The last three each caught a defect in one of the first three, which is worth recording. Gating the verdict word left the number beside it uncorrected. Scoping the allow-list to the not-ran branch put missed slots inside it, since schedule.py records an overrun as ran = False. And testing whether the interval contains 1.0 fails open when bootstrap_geomean_ci returns no interval at all below three usable pairs.

Two behaviour changes worth a second opinion, both deliberate:

A one or two pair comparison no longer claims a direction, which the fast tier and any partially measured metric reach. That tier already records a reportable_tier gate calling itself a direction rather than a number, so this looks consistent, but it is a visible change and not a pure bug fix.

The liveness gate now holds allow-listed actions to their slots. This does not affect the current CI, because a real missed slot is recorded as ran = False only when the machine was late, and image_upload is listed because the fixture cannot mount it at all.

The exclusion from the headline is one-sided throughout: an unresolved win is withheld, an unresolved regression keeps its FAIL and its place in the aggregate, where it can only pull the number toward worse. Withholding a win costs a headline; withholding a loss ships it.

pytest tests/studio/studiobench -q: 654 passed, 0 failed (636 before this sweep). ruff check: clean.

Downstream. Every push was a fast-forward, no rebase and no force-push, so 9341's head is untouched and its frozen corpus intact. 9341 will need a merge of studiobench-sweep covering __main__.py and test_studiobench_liveness.py. 9351 was already conflicting beforehand and is unrelated.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

scene/schedule.py records an overrun as ran = False with slot_missed set,
so scoping the allowance to the not-ran branch put missed slots inside it.
A listed name then inherited an excuse written for a different failure: the
action could have been performed and the machine was simply too slow to
reach the window. On image_upload, the only allowance this repo ships, that
is the difference between a timed benchmark and an untimed one, and the
help text already promised a listed action is still held to its slot.

The slot check now runs before the allowance, so it applies to every action
whether or not it is listed. The test asserting the opposite was mine from
the previous commit and asserted the wrong behaviour, so it is inverted
rather than kept: an allowance for what a platform cannot do should never
have covered what it merely failed to do in time.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

bootstrap_geomean_ci returns (None, None) below three usable pairs, and the
rule added earlier in this branch tested whether the interval contains 1.0.
That fails open when there is no interval: two pairs at 0.5 printed a 50%
win, and a single surviving pair published VERDICT: IMPROVED with the same
table saying too few pairs in its ci95 column. A rule that claims a
direction only when the CI clears 1.0 cannot be satisfied by a CI that is
absent, so absent now reads as unresolved.

The refusal is one-sided, and correcting that fixes an over-reach from the
previous commit. Only an unresolved WIN is withheld from the headline; an
unresolved regression keeps its FAIL and its place in the aggregate, where
it can only pull the number toward worse. Excluding it made the headline
read rosier than the run was, and it dropped the bounded single-pair
regression over a zero base back out of the headline, which is a third of
the bug _divisible exists to prevent.

This changes what a one or two pair comparison prints, which the fast tier
and a partially measured metric both reach. That tier already records a
reportable_tier gate saying it is a direction and not a number, and the
five tests updated here were using the verdict word as a proxy for the
table having a reading; each keeps the contrast it was written for.
@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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: a2e36fae34

ℹ️ 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 83539fa into main Aug 23, 2026
25 of 26 checks passed
@danielhanchen
danielhanchen deleted the studiobench-sweep branch August 23, 2026 11:38
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