Skip to content

studiobench: settle the instruments that published four wrong numbers - #9542

Merged
danielhanchen merged 389 commits into
mainfrom
studiobench-instrument-settled
Aug 24, 2026
Merged

danielhanchen merged 389 commits into
mainfrom
studiobench-instrument-settled

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Nine measurement-instrument defects were catalogued while answering "is the reasoning-pane slowdown over long contexts fixed on main today". Four of them had already produced a number that somebody acted on, and all four were withdrawn. This lands the fixes.

The pattern is the finding, more than any individual entry. All four are the same mistake in different clothes: measuring at a moment whose meaning is not stable across the things being compared. A max() over a racing set picks a different action on each arm. A window row outlives the cell that gives it meaning. A census read on a state-attribute flip sits a different distance from "mounted" on each arm. A timing that terminates on that same flip is quantised to a paint and censored at a timeout.

Two of the four were certified clean by a null control, which is why the companion rule matters and is now written into CONTRIBUTING-perf.md:

A null control cannot detect a bias it shares. It runs one build against itself, so a symmetric skew cancels exactly. A flat null proves repeatability, never comparability.

That rule is the reason highlight_spans_while_open survived the check that killed census_peak.

Figures that are retracted or changed

published status what the corrected instrument reports
main mounts 43% more elements and 48% more Shiki spans than the pre-campaign baseline retracted Settled, the two arms mount the same document: -0.3% elements, +0.0% spans, identical on all three repetitions
main mounts 41% fewer spans at 100K (the measure adopted to replace the one above) retracted Same as above. Both figures were artifacts pointing in opposite directions
1M streaming regression, 46.7 -> 28.7 fps, 21.8% of frames over 33 ms retracted Drawn entirely from r1M.treatment.rep0, a cell that never finished. With the completed-cell guard applied there is no 1M comparison at all, because no 1M treatment cell completed
reasoning_toggle.open_ms improved 3,339.8 -> 1,777.8 ms at 100K withdrawn Inside the metric's own 33-42% spread, measured on one bundle alone on the machine. It is also no longer the same quantity: open_ms now terminates on a settled mount rather than on the data-state flip
keystroke p50_ms up 149.8% at the 1M rung retracted as a single number That payload held two concurrent sessions scored last-wins. Kept apart, the same payload reads +149.8% in one session and +42.8% in the other, each against its own concurrent null

The defects, and what changed

1. census_peak cannot be compared across arms. It is whichever per-action census had the most elements. The census attached to an action is taken after the action returns, and reasoning_toggle opens every pane then closes them again, so that census races the close and a different action wins the max() on each arm. On a null control, the same bundle served on both sides, the winner flipped between settings (panes collapsed, 64,648 elements) and reasoning_toggle (panes open, 106,067): a 70.1% swing in highlight_spans within one arm.

It stays in the payload as a diagnostic high-water mark, which is genuinely useful, but it now carries census_peak_from_action, census_peak_comparable_across_arms: false and a note saying why. The summary table that prints it prints the warning underneath it, so the columns cannot be read without it.

2. reasoning_toggle.open_ms does not exist above the 100K rung. The open settle exceeds SETTLE_TIMEOUT_MS and settle() returns null on every cell of every job, both arms, at 500K and above. _action_timings drops non-numeric timings, so those cells vanished from the pooled metric and a table row labelled reasoning_toggle.open_ms on a 100K/500K/1M ladder was silently a 100K-only number wearing a ladder label. A censored timing is now absent from timings rather than present as None, announced in expect with the budget that was hit, and payload_rules.refuse_partial_censoring refuses to pool a metric censored at some rungs and measured at others, the way the tool already refuses to pool across tiers and corpora.

4. Window rows outlive their cell, and nothing marked them. window rows are written as the film runs; the cell row is written when it ends. An in-flight or aborted cell therefore leaves a complete-looking set of window rows with nobody owning them. floor_table.cell_metrics guarded this; nothing else did, and the analysis that read stream:gap windows directly did not. A cell that does not finish now emits a terminal cell_aborted row, so a reader scanning forward can discard the orphans without joining backwards.

Worth keeping in mind when reading any window: an incomplete cell is not a shorter film, it is a different one. At 1M the completed base cell emitted 6 stream:gap windows against 17 at 100K, so an in-flight cell contributes whichever phase it had reached rather than a uniform sample.

5. The reasoning_toggle failure reason described a passing condition. reasoning_toggle: ran EXPECT FAILED -- 16 of 16 panes opened and 0 were still open after collapsing appeared repeatedly at 500K and 1M. Every clause of that message describes success. The ok condition has four clauses and reason was built from the last two, while the actual cause was always the first: open_ms was None. The reason is now built from whichever clause actually failed.

7. highlight_spans_while_open was captured at an instant that means different things on the two arms. This is the measure adopted to replace defect 1, on the strength of its null being 0.0% at 100K and 500K. The null is genuinely flat. It was still wrong across arms. spansOpen was read immediately after the open count reached N, and data-state flips when the Collapsible's state changes, not when the content it reveals has mounted and been highlighted. Those are different frames, and how far apart they are depends on the collapse mechanism, which is exactly what changed between the arms.

The toggle now settles on a quiet DOM: the span census has to stop moving for SETTLE_QUIET_FRAMES consecutive animation frames before anything is read, and if it never goes quiet the census and the timing are withheld with a reason rather than reported. Silence beats a confident wrong answer. Running the real REASONING_JS from before and after against a DOM whose data-state flips at frame 5 while spans keep mounting to frame 40: before reads 44,075, after reads 74,250, and after correctly reports null with a reason when the mount exceeds the budget.

8. open_ms is unstable by construction, not merely contended. On one bundle, alone on the machine, no second arm and nothing else running, three repetitions: 2639.3 / 1894.8 / 2078.3, a 39.3% spread, and 33-42% across the four arms measured that way. The in-band null moved +33.4% on this metric and that was read as contention between two concurrently served arms. It is not. open_frames, open_state_reached_ms and quiet_frames_required now travel with the timing so a reader can see the ruler's resolution and how much of open_ms was spent after the state flip.

9. Two concurrent runs sharing an --out directory interleaved silently. Found by making the mistake: a launcher was started twice, both sessions appended to one payload.jsonl, and nothing complained. Three run_meta rows, every cell_id present twice with completed: true on both, and the two copies carrying materially different timings because the runs were contending with each other. cell_metrics keyed on cell_id, so the second session silently overwrote the first.

Refused at both ends now. At write time a run whose --out holds a live session from another process exits rather than appends. At read time cell_metrics refuses when a cell id completed under more than one session, and names the colliding cell.

The collision, not the session count, is the discriminator, and that distinction matters: more than one session in a payload is ordinary. --resume re-runs the arm that died under a new session id into the same shard directory, and sharding appends several on purpose. The attempt that died is not marked completed, so its id does not collide. Refusing on session count instead would reject every resumed run and delete good readings.

10. A guard that cannot write its own row. cell_aborted and comparability were not registered in ROW_TYPES, so the first clean run after they landed died two seconds in with ValueError: row_type must be one of [...], got 'comparability'. A guard that crashes the run it protects is worse than no guard: without it the run produces a flawed number somebody may catch, with it the run produces nothing and the failure looks like the harness being broken.

Both are registered with their required keys. More importantly the emitter is now tested and not just the schema, because registering a row type and emitting a hand-built copy of it in a test proves the schema accepts the row, never that the harness still writes it. Mutation against the whole suite: drop the required reason key from the row the runner builds and every test still passed, while the first failed cell of a real run raised ValueError out of its own failure handler, which is this same defect one field lower. Stop writing the row entirely and every test still passed. The new test drives the real CellRunner through a real Recorder and kills both.

Provenance

TOOL_VERSION goes to 0.2.0, and that is load-bearing rather than housekeeping. It is the only comparability-key field that separates a run taken before these fixes from one taken after: the corpus is untouched, so the hash, the tier, the rungs and the engine all match. They must not match, because highlight_spans_while_open reads 74,250 where it read 44,075 on the same bundle and open_ms is now a different quantity. Left at 0.1.0 the key would have certified as comparable the one pair that differs by the largest instrument change in the campaign, which is the exact failure the key exists to prevent, committed by the guard itself.

Each run also emits a comparability row computed over the run_meta row it actually wrote, and --compare A B says whether two payloads may be compared and names the field that differs. floor_table.load already refuses to pool across tiers and corpora and that guard works; this is for the case it cannot reach, a comparison made in prose between two separately published runs, which is how a wrong number nearly propagated twice.

Not fixed here, deliberately

_check_equivalence still feeds census_peak into the seeded_equals_streamed gate, differencing that racing census against a seeded one read after an explicit 4 s wait. The row now records which census was used and whether it was settled, but the behaviour is unchanged: both sides of that comparison come from one cell on one build, so the instability widens the gate's tolerance rather than pointing a difference in a direction. Changing which census feeds it would change what the gate asserts, and that is not a change worth making without measuring it against a browser.

Separately, SETTLE_TIMEOUT_MS = 8000 is a 100K-era constant that is silently wrong above the rung it was written at. It should scale from the same ladder the corpus is sized from rather than a second hand-picked table.

An app finding that fell out of the settling fix

Out of what used to be a silent success message, at the 500K rung:

open_ms is censored: the open count reached 16 after 10440ms but the span census
was still changing when the 8000ms budget ran out

Sixteen reasoning panes at 500K take over ten seconds to reach the open state. That is the data-state transition itself, before any content has mounted or been highlighted, so it is not a measurement artifact and not a settling question. Expanding the traces on a long thread does nothing visible for ten seconds. That is a better statement of the reasoning-pane problem than any scored metric this campaign produced.

Tests

pytest tests/studio/studiobench -q: 1018 passed, 0 failed, up from 981 on the base. ruff check clean.

Each new test was checked to fail without its fix rather than merely to pass with it, and the two mutants that previously survived the entire suite are now killed.

Based on studiobench-readiness-gate (#9439), continuing the stack, since these fixes touch scene/actions.py, runtime/session.py and __main__.py, which that branch also changes.

A floor may only certify a result it is actually a floor for

Two review items landed on the same line of sweep/floor_table.py, both on the side of the comparison nobody was reading, and both are now fixed in 08544ae4b.

summarise marks a metric poolable = False when it answered on some cells and was censored on others, and render read that flag on the RESULT only, so a result measured in full was scored against a floor built from whichever repetitions of the null control survived. Measured on this campaign's real null control, sbench_T_null plus sbench_C_null pooled as one 100K/500K/1M ladder with reasoning_toggle.close_ms censored above 100K: the four surviving 100K pairs give a floor of 17.13 percent, the censored repetitions ran 1429 to 2149 ms against 498 to 681 ms at 100K and pair as far apart as 1.50 on identical builds, and with them the same null reads 67.46 percent.

The scoring path also validated tier and corpus only, two of the fields comparability_key covers, while --compare covers all of them and is a separate command nothing obliges a caller to run. The real 0.1.0 null control scored a 0.2.0 payload on the same corpus and tier and certified nine metrics, stop_generation.stop_ms -76.3 percent faster among them, on a branch that deliberately redefines reasoning_toggle.open_ms. A Darwin/arm64 payload against the Linux/x86_64 floor certified nine as well. Both now refuse by name, through explain_incomparable rather than a second list of fields.

What this costs. The refusal is deliberately blunt: a metric loses its verdict whenever the null control's own entry for it is unpoolable, without asking whether the result's cells happen to lie inside the repetitions the null had left. On the campaign's real payloads that turns 5 metrics clearing all three gates into 4, and the one it removes, reasoning_toggle.close_ms at -24.8 percent against a floor of 17.1 percent, may well have been substantively fine, because the null's surviving pairs are the same rung the result was measured at. It is still refused, for two reasons. A floor built from surviving pairs is a truncated estimate of same-build scatter with the largest excursions removed, so it is biased low by construction and spread_pct, being max - min, can only shrink as pairs are dropped. And more simply: a floor this tool has already marked as not poolable has no standing to certify anything. The narrower rule, compare the measured cells on both sides and refuse only when they diverge, was written out and rejected; it is the "a flat null certifies the metric" error wearing a new costume.

Selftests go from 1293 to 1305 on the branch head, ruff clean, --doctor and the single-file build unaffected. Ten deliberate mutations of the two fixes, all caught.

danielhanchen and others added 30 commits August 22, 2026 08:14
# Conflicts:
#	tests/studio/studiobench/__main__.py
# Conflicts:
#	tests/studio/studiobench/__main__.py

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

ℹ️ 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 +130 to +132
if r.get("ran") and r.get("expect_ok") is False:
for key in r.get("timings") or {}:
out.setdefault(f"{action}.{key}", set()).add(cell)

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 Treat actions that did not run as censored

When a scheduled action has ran=False on only some completed cells—for example because its slot was missed or a required button was absent—_action_timings excludes that cell, but this function records censoring only for explicit *_censored flags or for actions that ran and failed an expectation. Consequently floor_table.summarise() can pool the metric from the surviving cells and grant it a verdict for the whole ladder. The standalone --assert-liveness command does not protect callers that invoke floor_table directly; derive the action's metric names from the rows where it did run and mark its non-running completed cells as censored too.

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.

Accepted as correct, and deliberately not fixed in this PR. The mechanism checks out and so does the rebuttal of my earlier reasoning on the settle-budget item: --assert-liveness is not automatic. main dispatches in an early-return chain where --report returns before it, and sweep.floor_table is its own CLI that never imports it, so the only thing sequencing them is CONTRIBUTING-perf.md. I withdraw the phrasing I used there, that a missed slot is a recorded and gated outcome; it is recorded, and gated only by a command the reporting path does not run. Reproduced the published row: message_menu measured at 100K and slot-missed at 500K prints a full SLOWER verdict off the 100K cells with no marker, while the identical situation written as open_censored is refused. What stops this being a fix here is that the gap looks chosen rather than missed. CONTRIBUTING-perf.md puts the liveness check before floor_table and says why in those terms, that floor_table drops a repetition whose action did not run instead of refusing it, and two tests in test_studiobench_sweep.py assert today's behaviour as the reason that ordering is load-bearing. Closing it in censored_metrics means rewriting both of those, which is a design call for the author rather than a review fix, so it is left for a follow-up.

danielhanchen and others added 8 commits August 23, 2026 21:04
…perseded cell from the floor

Two more places where a guard and the rows it guards were read through
different lenses.

streamcost.js gated noteSse on the "data:" marker while the character
counter beside it was gated on the marker OR a pending frame, so the
tail of a frame the socket cut inside its JSON body was counted in the
denominator and charged to nothing. It skipped the same three quantities
the batched-read note above it names: sseChunks, lastSseAt and the
deltaTaskMs numerator. When the suffix lands on a later task the first
half rendered nothing and its chain has already closed, so the render
the suffix starts is charged to no window at all and
stream_delta_cost_ms_per_kchar is biased downward exactly as
fragmentation rises, which is the regime the instrument exists to
measure. A stale lastSseAt also lets replyChars decide the stream went
idle and return null for a window still carrying it. Both call sites now
read one condition.

floor_table.cell_metrics named the surviving attempt as the last
COMPLETED cell row while failed_invalidating_gates, computed two lines
above it, names the winner as the last cell row of any completion state.
skippable_cells re-runs an A/B pair whole, so a resume with any work
left re-attempts cells that had already completed, and CellRunner.run
writes an incomplete cell row from a finally when the retry dies. The
retry's row then supersedes the dead attempt's FAILED gate while this
loop kept that same attempt's numbers, so a cell refused for losing its
thread's middle was republished after the resume and paired against a
clean base arm as faster. That is the 28.2% false result the function's
own docstring cites, reached through --resume.

Fixed by reading the rows through latest_attempt_rows, as
readings_by_arm and ui_parity.collect already do, with gate_failures
still computed from the raw stream because a gate row is not one of the
row types that function covers. cell_sessions reads through it too,
which its docstring already promised.

tests/studio/studiobench: 1263 passed.
Both of this round's changes to report() left actions_needing_an_excuse behind,
and both drifts fail the job rather than pass it, which is why they need the
same care as the excusing direction.

report() no longer counts a one-arm-only result for the three actions whose
ABILITY to run is a race, so no excuse can move their verdict. Scoped anyway,
the null observing the same legitimate stream-timing race made audit_null return
1 and reddened a job whose verdict was 0.

report() also carries the live arm in the corroboration key, so a pair blaming
opposite arms across the two repetitions is uncorroborated and cannot move the
verdict. Built here as bare four element tuples it corroborated, entered the
scope, and an undecided null then failed a passing job.

The rule is now stated where the function is: scope is what the verdict's fatal
set turns on, so anything the verdict declines to count is a question nobody is
going to ask. Both filters mirror report() exactly rather than approximating it.

Three regression tests, three mutations confirmed, one of them showing the scope
is not merely narrower: an action the verdict does fail on is still required of
the null.
partial_censoring reads every shard at once on purpose, because that is the set
summarise pools. But make_cell_id is r{rung}.{arm}.rep{rep} and sharding
restarts the repetition counter, so r500K.base.rep0 names a DIFFERENT cell in
each shard. Concatenated on the bare id, the completed-cell filter stopped
separating them: one shard's failed cell and another shard's successful one
became a single id that was both censored and completed, and a metric nothing
censored anywhere was refused as partially censored.

paired already keys on the shard for exactly this reason and says so in its
docstring; this reader was the one left behind. The precondition is an ordinary
failed cell, not an exotic kill: session.py writes completed False and only
flips it on success, and the action rows already flushed carry expect_ok False,
which censored_metrics counts as censored. CONTRIBUTING-perf.md prescribes two
shards of two repetitions, so both shards walk the same ladder and write the
same ids.

Reproduced: two shards, one failed cell in the first, nothing censored anywhere.
Each shard alone is clean; together the metric loses its verdict and the report
prints a refusal naming a rung where no censoring happened. Suffixed rather than
prefixed so refuse_partial_censoring still reads the rung off split(".", 1)[0]
and its message names rungs rather than directories, and the cross-shard catch
the docstring is about still fires.
… return

--audit-null reads nothing from the plan: it takes its shards from
args.payloads, audits each one as a null control, resets worst and
returns unconditionally. It was sitting below the structural early
return anyway, so it never ran whenever that return fired.

That is not an exotic payload. --mode visible and --mode behaviour both
hard-set structural to an empty set for every pattern, so --audit-null
with either of them could never run the audit at all, and auto mode
joined them the moment every pair classified as windowed. The command
exited 0 out of the ordinary visible report, having silently skipped
both the audit the caller explicitly asked for and the --compared-in
enforcement that goes with it, from an option whose whole promise is to
fail unless the null decided the actions the result needs an excuse for.

Moved above the return rather than duplicated below it, so there is one
call site and the auto-mode path that already worked reaches it after
exactly the same windowed reports as before.

tests/studio/studiobench: 1266 passed.
Narrowing the exemption from nine actions to three fixed the wrong half. It was
still keyed on the action NAME, and each of the three has non-racy failure paths
as well: send_turn returns not_run for 'no composer on the page'
(scene/actions.py:1016) and stop_generation for 'the stop button is not present'
(scene/actions.py:501). A treatment build that REMOVES either control records
exactly the one-arm-only regression this category exists to catch, and the
exemption swallowed it and filed it under expected to vary.

The mechanism was written down in RACY_EXECUTION all along; it just was not what
the code matched on. Each entry now carries the not_run substrings that qualify,
compare_rows carries the idle arm's own reason unwrapped, and racy_execution()
answers whether THIS not-run is a stream-timing race rather than whether the
action is capable of one. Used by the verdict, the audit scope and the evidence
step alike.

Two pre-existing tests asserted the exemption using 'the control never became
visible', which is not a racy reason, so they were asserting the over-broad
behaviour; they now supply the real not_run string the exemption names.

Four regression tests, three mutations confirmed in both directions: keying by
name again reopens the removed-control hole, and refusing every reason reds the
legitimate stream race.
run() takes the lock in its first millisecond and releases it in its outer
finally, but Recorder.close released the same adopted object, and close runs in
the finally under the cells. _render_ab and _summarise reopen payload.jsonl
after that and before run() lets go, so the directory was unheld for the whole
reporting window and a second invocation arriving in it was admitted.

What it then does is what the lock was moved earlier to prevent, to a run whose
cells had all completed. prepare_payload renames payload.jsonl aside before it
clones anything, so the first run either dies with FileNotFoundError after every
cell passed, or, once the contender has opened a payload of its own, renders
ab.md out of another run's rows and still exits 0. Both were reproduced by
driving a real second run() in from inside the reporting window.

A Recorder now records whether it took the lock or adopted one, and releases only
its own. A Recorder built without a lock still takes one, so the guard cannot be
switched off by forgetting to pass it.

Also notes in _read_marker_once_written why the wait cannot be reduced to a
non-empty check. That version has now been written twice independently, and
corrected the same way both times, so the wrong shape is the intuitive one and
is not visible from the call site.

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

ℹ️ 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 +130 to +132
if r.get("ran") and r.get("expect_ok") is False:
for key in r.get("timings") or {}:
out.setdefault(f"{action}.{key}", set()).add(cell)

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 discarded count metrics as censored

When a completed cell has ran=True but expect_ok=False for an action carrying counts—notably select_all_copy—_action_timings discards the entire action, but this branch marks only its timing keys as censored. measured_cells also searches only timings, so refuse_partial_censoring sees neither censoring nor measurements for metrics such as select_all_copy.count.selected_chars; the floor table can consequently pool and certify that invariant from only the successful cells, hiding repetitions where selection failed. Include the row's count keys under the existing action.count.key names and make measured_cells resolve that namespace.

Useful? React with 👍 / 👎.

danielhanchen and others added 7 commits August 23, 2026 22:12
# Conflicts:
#	tests/studio/studiobench/__main__.py
Four hunks, all resolved by combining both sides. Nothing was picked.

ui_parity.report, collection loop. Two independent features at one
insertion point: this branch buckets NOT_APPLICABLE, the incoming side
collects expect_regressed. Both kept, and the ORDER is the decision. The
incoming comment states its own invariant, collected before the verdict
branches, and the NOT_APPLICABLE branch continues, so putting it first
would drop a failed assertion whenever the pair was also a windowed
mount. Assertion collection first.

ui_parity.report, return. This branch added the decided == 0 guard so a
run that could not fire cannot exit 0; the incoming side added
expect_bad to the failure condition. Both kept, failure before
could-not-tell, because expect_bad survives a pair that continues and so
can be non-empty with nothing decided. Also dropped a duplicated comment
pair that an earlier merge had left there.

ui_parity.main, structural loop. The incoming side adds confine_to_runner
and calls report without select, because on that branch this function had
no windowed split to select from. select is the FOURTH positional here,
so taken as written it would have bound args.min_reps to select and
args.min_compared to min_reps, leaving the coverage floor at its default
of 0 and scoring a structural pass against an integer, with nothing
failing to say so. Combined: the runner confinement produces effective,
and the call keeps label, select and both thresholds.

test_studiobench_null_audit.py, 566 lines. A pure add/add at the end of
the file: three tests from the audit fix here, twenty-three from the
incoming instrument work. No overlap, both kept, 68 tests in the file.

tests/studio/studiobench: 1298 passed. Both negative controls re-run on
the merged tree and both still fail without their fix.
Two conflicts. One was a real semantic clash wearing a comment's clothes.

floor_table.cell_metrics. Both branches added a latest_attempt_rows
reduction and both described it in the comment that conflicted, but they
are not the same reduction. This branch's runs at the top of the
function and is CONDITIONAL, skipped when the caller named a session,
because superseding inside that escape hatch would empty the older of
two concurrent sessions and take away what the collision refusal points
a reader at. The incoming one was unconditional.

Keeping both would have read as harmless, since the reduction is
idempotent, and would have been a silent regression: the second call
supersedes inside the escape hatch and removes the hatch. So the
incoming unconditional call is dropped and this branch's conditional one
stands, which also makes the surviving comment the accurate one, since
gate_failures now reads rows that are already reduced on the default
path.

Verified rather than assumed: the incoming branch's regression test
test_a_superseded_cell_does_not_come_back_when_its_retry_crashes still
fails when this branch's conditional reduction is neutralised, so the
protection it was written for is intact through this branch's line and
not merely through its own.

Recorded and not fixed here: with session= named there is no reduction,
while failed_invalidating_gates still resolves its winner across every
session in the file, so naming the older of two sessions can have its
gate discarded by the newer one. Scoping that search to the named
session is a change to the hatch's semantics, not to this merge.

test_studiobench_run_acquisition.py. A pure add/add, two duplicate-run
tests here and six report-invalidation tests incoming. Both kept, 27
tests in the file.

Also verified for this branch's own refactor: release() calls
os.ftruncate before _unlock_fd, so the marker is blanked while the lock
is still held, and Recorder.close delegates to lock.release() only when
it owns the lock.

tests/studio/studiobench: 1419 passed.

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

ℹ️ 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 +397 to +398
if session is not None:
records = [r for r in records if r.get("session_id") in (session, 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.

P2 Badge Scope invalidating gates to the requested session

When cell_metrics(..., session=old) selects an older session whose cell failed thread_complete or follows_the_stream, and a later session completed the same cell_id, failed_invalidating_gates(records) runs before this filtering and treats the later cell as the winning attempt. It therefore discards the older session's failed gate and admits that session's invalid measurements—the exact escape hatch the collision error recommends using. Filter to the requested session before resolving gate failures (while retaining sessionless legacy rows), or make the gate resolver accept a session.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Known semantic gap in the session= escape hatch

Recording this on the thread so it is findable from the PR and not only from a comment in the middle of cell_metrics. Found while merging 9439 into this branch; not fixed here, deliberately.

The gap. cell_metrics reduces to the latest attempt at the top of the function, but that reduction is conditional and is skipped when the caller names a session. That skip is correct and intentional: superseding inside the hatch would empty the older of two concurrent sessions and take away exactly what the collision refusal points a reader at.

What is not scoped along with it is the gate lookup. failed_invalidating_gates still resolves its winning attempt across every session in the file, from the last cell row of any completion state. So a caller who names the older of two sessions can have that session gate discarded by the newer one, while the admission loop below goes on to admit the older session own completed cells. The two ends disagree about which attempt is being scored, which is the same two-lens shape this area has produced several times.

Reachability. Only through session=. The default path is unaffected, because there the reduction runs and both ends read the same rows. So this does not touch the ordinary floor or result scoring.

The fix, when someone takes it. Scope the gate search to the named session, so failed_invalidating_gates answers about the same attempt the loop is scoring. That is a change to what the hatch promises rather than a bug fix inside it, which is why it did not go into a merge commit.

What is already protected, so it is not re-litigated. The no-session path is covered by test_a_superseded_cell_does_not_come_back_when_its_retry_crashes, and I verified during the merge that it still fails when this branch conditional reduction is neutralised. The protection is real and it lives on this branch line, not on the one 9439 removed.

danielhanchen and others added 4 commits August 24, 2026 00:47
9351 landed as a squash, so this branch carries its real commits while
main carries one blob. 13 hunks across 6 files, every one of them a case
where this branch is a strict superset of main and main's side is the
state before this branch's own work.

Verified before resolving anything, because taking main's side on any of
these would silently revert a merged PR: 2c5df95 is an ancestor, and
--stream-tail-chars, latest_attempt_rows and corpus_dollars appear in the
same number of files and at the same hit counts on both sides. The one
real difference is IDLE_WINDOW_KINDS, 2 files on main and 1 here, and it
is a rename rather than a loss: this branch renamed it to
UNSCORED_WINDOW_KINDS and widened it from {"idle"} to {"idle", "setup"},
moving every use site with it. The single survivor was a stale mention in
a comment, corrected here.

That rename is why from_payload.py and types.py had to be read together
rather than resolved apart. UNSCORED_WINDOW_KINDS excludes "setup", and
"setup" is only a valid kind because this branch added it to
WINDOW_KINDS; taking main's side in types.py would have left the
exclusion naming a kind that can never be produced, which is dead code
that looks live. Checked after resolving: UNSCORED and UNAIDED are both
subsets of WINDOW_KINDS.

INTERFACES.md conflicted in two places and both were shadows of the code
conflicts rather than a docs merge, one documenting the "setup" kind and
one the UNSCORED_WINDOW_KINDS exclusion. Resolved to match the code and
then checked against it: the kind list in the doc and WINDOW_KINDS agree
exactly.

__main__.py took five hunks, all adding the click_probe and
probe_init_script identity axes. Audited rather than eyeballed: no key
present on main's side is absent from this branch's, and after resolving,
every IDENTITY_AXES entry is produced by requested_identity, every
HISTORICAL_DEFAULTS key is an axis, and TREATMENT_AXES is a subset.

tests/studio/studiobench: 1005 passed.
Pre-absorbing the parent's resolved head before 9356 squashes, so the
post-squash pass has nothing left to reconstruct from a stale base.

ZERO conflicts, which is the parent-first technique doing its job: this
branch already carried 9356's pre-squash head, so the only new content is
main's, arriving through a base that has already reconciled with it.

Checked rather than assumed, because a clean merge is not evidence of a
faithful one. origin/main is now a genuine ancestor of this branch, which
is the strongest containment there is. Symbol parity against main holds
for every axis the stack touches; the one counter that drops,
IDLE_WINDOW_KINDS at five hits to zero, is the rename verified on 9356,
where the nine UNSCORED_WINDOW_KINDS hits that replace it cover every use
site and add three more. Nothing main has was removed.

The 116 deletions are the parent's own supersessions plus blank-line
normalisation; the only content line changed in the three files that
looked suspicious is the stale IDLE_WINDOW_KINDS mention in a comment,
corrected on 9356 and propagating here.

tests/studio/studiobench: 1298 passed. Both negative controls re-run on
this tree, where they exist: neutralising the corpus axis still fails
test_a_visible_floor_from_another_corpus_is_not_applied, and moving the
audit block back below the early return still fails all three forced-mode
audit tests.
Pre-absorbing the parent's resolved head. ZERO conflicts again: the
parent had already reconciled with main, so this branch takes that
reconciliation as one side instead of re-deriving it.

One thing a clean merge and a green lint both missed. Both sides
contributed an import of latest_attempt_rows to the same from_payload
import list, so the name landed twice in one statement. Ruff does not
flag a duplicate inside a single ImportFrom and the tests cannot see it,
so it would have sat there indefinitely. Deduplicated, and checked with
an AST pass over the import names rather than by reading the block.

The pairing habit applied to floor_table against from_payload: every name
floor_table imports is defined in from_payload, and this branch's own
CONDITIONAL reduction in cell_metrics survived intact with no
unconditional duplicate reintroduced beside it, which is the resolution
this pair needed last time.

Containment checked rather than inferred from the absence of conflicts:
origin/main is an ancestor, and symbol parity against main holds on every
axis the stack touches.

tests/studio/studiobench: 1419 passed. All three negative controls re-run
on this tree. Neutralising this branch's conditional reduction still
fails test_a_superseded_cell_does_not_come_back_when_its_retry_crashes;
neutralising the corpus axis and moving the audit block back below the
early return still fail their four tests.
Base automatically changed from studiobench-readiness-gate to main August 24, 2026 03:27
danielhanchen and others added 2 commits August 24, 2026 03:44
9439 landed as c58a649, so this resolves against the squash rather than
the branch. Twelve hunks across five files, six of them with an EMPTY main
side, which is the shape that hides a move.

The one that actually bit was outside every marker. Git split
reasoning_toggle_one into a conflict over its `expect` dict AND a second
whole copy of the function plus its REASONING_ONE_JS constant, auto-merged
below as an ordinary addition. Resolving the marked region left the file
with two identical registrations and the suite did not merely fail, it
would not COLLECT: 22 errors, ValueError action already registered. The
two copies differed only in comments, so a reader diffing the conflict
region would have seen nothing wrong.

Caught by an AST duplicate-definition sweep rather than by reading, and
that sweep is the lesson: after every resolution, check the whole file for
duplicated defs and duplicated top-level constants, not just the hunks.
The constant was a second find the function-level check alone would have
missed.

The empty-main-side hunks were all moves this branch made, verified by
sweeping for where the code went rather than by trusting the marker:
side_specs is hoisted and already present at line 619, so main's copy
would have been a duplicate; run_meta is built once as meta_row with 21
fields, and main's marker held a second 20-field emission, with no field
main has that this branch lacks. The headed identity axis spans three
hunks and its own comment warns that a partial take makes every resume
refuse itself, so all three moved together.

Nothing main has was removed. TOOL_VERSION 0.1.0 to 0.2.0 is a bump;
make_context is WIDENED here, 7 positional plus an out_lock keyword
against main's 7, and the definition accepts it.

floor_table keeps this branch's CONDITIONAL reduction and drops main's
unconditional one, the same reconciliation as before arriving through the
squash: exactly one call, guarded by session is None. actions.py combines
main's fuller comment with this branch's panes_opened, which
test_studiobench_reasoning_one_live asserts.

tests/studio/studiobench: 1419 passed. AST ImportFrom and duplicate-def
sweeps clean. All three negative controls re-run and all three still fail
without their fix.

@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: 2b806ec497

ℹ️ 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 +299 to +302
# THE THREE THAT CHANGE WHAT IS MEASURED, not merely what is measured on. The harness
# already treats all three as identity axes that `--resume` refuses to toggle, and the
# `run_meta` emission says why in its own words -- so a key that ignored them would call
# two payloads comparable that the tool itself refuses to continue as one run.

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 Add windowed readiness to the comparability identity

When one payload is run with --windowed-arm treatment and another without it, these fields—and therefore --compare and the floor compatibility check—remain identical because run_meta never records the selected windowed arms. The flag changes that arm from the full-mount readiness gate to MODE_WINDOWED, permits fewer mounted messages, and makes several costs functions of the mounted window rather than thread length, so a full-mount null floor can incorrectly certify a windowed result as comparable. Record the per-arm readiness mode and include it in this identity.

Useful? React with 👍 / 👎.

Comment on lines +831 to +832
if floor_meta is not None:
meta, conflicts = merged_meta(paths)

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 Validate payload metadata even when no floor is supplied

When the CLI is used without --floor, this condition skips merged_meta(paths) entirely even though summarise() has already pooled every matched shard. Shards with the same tier and corpus but different tool_version, engine, host, cadence, headed mode, or other comparability fields therefore produce one combined numeric table; this commit itself demonstrates that the same metric name can denote a different quantity across tool versions. Check the payload's internal metadata conflicts unconditionally, and make only the floor-to-payload comparison conditional on floor_meta.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit 02206f3 into main Aug 24, 2026
29 checks passed
@danielhanchen
danielhanchen deleted the studiobench-instrument-settled branch August 24, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant