fix(trace-repair): declare the control that screens a row, and refuse a task whose grader is a coin flip - #556
Conversation
… a task whose grader is a coin flip Admission condition 3 asks whether a row is rescued by continuing from the recorded end state with no intervention. Both milestone runs answered it under a control pinned to zero model calls. A rollout that makes no model call executes no command, so both control arms graded the bytes condition 2 had already graded as failing: the condition could only ever fire on a grader that disagreed with itself, and every row walked through it. Nothing in the artifacts recorded which control had screened a row. The control is now a hashed declaration rather than a default. `defineControlPolicy` carries the step budget, scaffold, model and command timeout into a digest, and `assertControlCalibrated` refuses the two contradictions at configuration time: screening under a control that cannot act, and calling a control inert when it can. Under `controlScreening: 'declared-inert'` a control pass is recorded as `control-passed-on-identical-state` rather than as a rescue nothing performed. Every admission decision, admitted or not, carries the policy, its digest, the screening mode and the task's measured oracle flip rate. A task graded by wall clock cannot serve as ground truth for an intervention study. `certify-task-oracle.sh` gains a determinism phase: re-grade byte-identical containers N times, idle and under CPU contention, and count flips per assertion rather than per suite. Counting the suite reward hides the failure, because the reward is a conjunction and a suite whose per-parameter timing assertions each flip still returns one steady verdict at a state far from the threshold. The verdict rule lives in `oracleDeterminism` and is applied through `scripts/tb-oracle-determinism.ts`, so a certification run and a campaign cannot disagree about what a stable oracle is. Skipping the phase yields CERTIFIED_UNCHECKED_DETERMINISM, never CERTIFIED. Measured at the image digests the milestones ran against, 16 replicates per task: password-recovery, sanitize-git-repo and count-dataset-tokens flip 0 units; largest-eigenval flips 8 of its 9 test_speedup[size] parameters, worst 37.5 %, while its whole-suite reward never moves. The measurements are checked in as benchmarks/trace-repair/task-oracles.json, which stores replicates rather than verdicts so the file cannot declare a task stable. Admission reads that certification before it opens a container. A task with no entry leaves as task-oracle-uncertified; an unstable one as task-oracle-nondeterministic. Rows screened by an inert control carry the control-cannot-rescue threat into the Delta-repair report. Milestone 1's headline is unchanged and its published numbers are not rewritten; docs/trace-repair-admission.md states which of its rows and verdicts the defects touched.
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 4bed2514
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-08-10T08:53:04Z
…w a flip A load group of one measures nothing, and the substrate rule already rejects it. Refusing at the flag names the mistake instead of failing three phases in.
tangletools
left a comment
There was a problem hiding this comment.
⚪ Value Audit — audit-incomplete
| Verdict | audit-incomplete |
| Concerns | 1 (1 low) |
| Heuristic | 0.0s |
| Duplication | 0.0s |
| Interrogation | 210.3s (2 bridge agents) |
| Total | 210.3s |
💰 Value — error
value agent never ran: the CLI bridge refused admission (no model was started).
- Model: opencode/deepseek/deepseek-v4-pro
- Bridge attempts: 4
- Bridge error: opencode/kimi-for-coding/k2p7: Bridge returned 503: bridge at capacity (queue_timeout, lane=None): active=20/20 queued=1/48 — no model was started
🎯 Usefulness — error
usefulness agent never ran: the CLI bridge refused admission (no model was started).
- Model: opencode/deepseek/deepseek-v4-pro
- Bridge attempts: 4
- Bridge error: opencode/zai-coding-plan/glm-5.2: Bridge returned 503: bridge at capacity (queue_timeout, lane=None): active=20/20 queued=2/48 — no model was started
🔎 Heuristic Signals
🟡 Cruft: magic number added scripts/tb-repair-milestone1.ts
- commandTimeoutSeconds: Math.ceil(STEP_TIMEOUT_MS / 1000),
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
|
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — a80dd1d0
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
tangletools · auto-approval · reason: drewstone_author · 2026-08-10T10:27:20Z
Two defects made the TB-Repair denominator unreadable. Both are repaired here, and both repairs have tests that fail against the behaviour on
main.1. The control that screened a row was never declared
Admission condition 3 asks whether a row is rescued by continuing from the recorded end state with no intervention. Both milestone runs answered it under a control pinned to zero model calls.
A rollout that makes no model call executes no command, so the container a control arm graded held the same bytes condition 2 had already graded as failing. The condition could only fire on a grader that disagreed with itself. It screened nothing, and nothing in the artifacts said which control had screened a row — a reader had to open the runner's source.
Measured against
origin/main@0d6620b, handingadmitRowthe exact evidence shapescripts/tb-repair-milestone1.tsproduced:The last line is the wrong reading:
no-fix-control-passedmeans "the row is repairable by continuing alone", and nothing continued.The repair.
defineControlPolicymakes the control a hashed declaration — id, step budget, scaffold, model, command timeout — so a step budget cannot move under an unchanged label, and a policy that calls no model must recordmodel: null.assertControlCalibratedrefuses both contradictions at configuration time, before a verdict exists for any row:controlScreeningenforced(default)stepBudget >= 1no-fix-control-passed— repairable by continuing alonedeclared-inertstepBudget == 0control-passed-on-identical-state— the task's grader disagreed with itselfEither pairing the other way round raises
UncalibratedControlError. Every decision now carries anAdmissionScreeningRecord— policy, digest, screening mode, task name, measured oracle flip rate — on rejected decisions as well as admitted ones.AdmissionRowVerdictcarries the same for rows the executing pre-pass excluded before any control ran, anddeltaRepairraises acontrol-cannot-rescuethreat when any row was screened by an inert control, so a control rate of zero cannot be read as a screen.2. A task graded by wall clock was carrying ground truth
largest-eigenvalassertsdt < ref_dtattests/test_outputs.py:111— the only wall-clock assertion across the four task suites the milestones sampled.certify-task-oracle.shgains phase C: re-grade byte-identical containers N times, idle and under CPU contention, and refuse to certify a task whose verdict is not stable. Two design points are load-bearing and were both found by measurement, not by reasoning:largest-eigenval— a false green I nearly shipped. The reward is a conjunction; a suite whose per-parameter timing assertions each flip still returns one steady verdict at a state far from the threshold. Phase C now reads pytest's own-rAsummary, which keeps the parameter, sotest_speedup[6]is its own unit. The CTRF report the suites also write collapses parametrised tests to their base name and is not used.The verdict rule lives in
oracleDeterminismand is applied throughscripts/tb-oracle-determinism.ts, so a certification run and a campaign cannot drift apart about what a stable oracle is. No node means no verdict, not a weaker one. Skipping phase C yieldsCERTIFIED_UNCHECKED_DETERMINISM, neverCERTIFIED.Before and after, same task, same image, same machine
origin/main's certifier, extracted withgit showand run unmodified:The same task on this branch:
Measured, at the same image digests the milestones ran against
16 replicates per task: 8 on the untouched image and 8 after the reference solution, half of each under CPU contention.
password-recoverysha256:15fcd84b…CERTIFIEDsanitize-git-reposha256:4b5234da…CERTIFIEDcount-dataset-tokenssha256:9c513c4b…CERTIFIEDlargest-eigenvalsha256:cb9e3e3b…NONDETERMINISTIC_ORACLEAll eight flipped units are
test_speedup[size]parameters on the untouched image, where/app/eigen.pyholds the reference implementation the assertion compares against:The whole-suite reward on that state never moved: 0 of 8. An earlier run of the same certification put the worst unit at 50 %; a flip rate that is itself unstable is what a coin flip looks like. A separate probe held
/app/eigen.pyat sha256bbd5be97…across four gradings and saw the per-size failure count swing 1, 4, 3, 3 of 9.The measurements are checked in as
benchmarks/trace-repair/task-oracles.json. It stores replicates, not verdicts:parseTaskOracleRegistryre-derives the verdict on read by the rule a campaign enforces, so the file cannot declare a task stable and a reviewer can recount it.Admission reads that certification before it opens a container. A task with no entry leaves as
task-oracle-uncertified; an unstable one astask-oracle-nondeterministic. The two are different facts — the check has not run, versus it ran and the task failed it.The honest consequence for Milestone 1
Nothing is rewritten.
milestone1.jsonis untouched;docs/trace-repair-admission.mdrecords what it measured.largest-eigenvalno-fix-control-passed, claiming the row was repairable by continuing alone; nothing continuedWhich rows were affected: the two
largest-eigenvalrows,largest-eigenval__cxEtBTx(no-fix control passed 2/3) andlargest-eigenval__4GTN8MQ(1/3).Which verdicts were affected: both, and only both. Both were exclusions, and both remain exclusions under the repaired code — but for the reason that is true (
task-oracle-nondeterministic) rather than one that is not.Does the headline separation survive excluding the timing-graded task? Yes, and it never depended on it. The 17 admitted rows contain zero
largest-eigenvalrows, so dropping the task changes nothing:What does not survive is any reading of milestone 1 as evidence that condition 3 screened anything. Across both milestones the control-pass rate was 3 of 3 on
largest-eigenval's 7 evaluations and 0 of 61 on the three tasks that certify stable, under a control that made zero model calls. One row,largest-eigenval__4GTN8MQ, was excluded by milestone 1 on a control pass of 1/3 and admitted by milestone 2 on a control pass of 0/3 — same row, same control, opposite verdicts.Milestone 2's admitted set is contaminated: 4 of its 43 admitted rows come from the timing-graded task. Its numbers are conditional on that and are not restated here.
Unconditional continuation has still never been given a model call on this corpus. Nothing in this PR claims it rescues nothing; it makes that a question a run can answer, by requiring a control that could.
Tests that fail against the current behaviour
tests/trace-repair/control-policy.test.ts—admitRowthrowsUncalibratedControlErroron a zero-step control under default criteria (onmainit admits the row); a control pass under an inert control rejects ascontrol-passed-on-identical-stateand not as a rescue; every decision, admitted or rejected, carries the policy digest (onmaina decision has onlyadmittedandrow).tests/trace-repair/oracle-determinism.test.ts— an assertion that flipped while the suite reward never moved is caught (the case that produced the false green); a missing assertion counts as a flip of the suite's shape; reward-granularity fallback is recorded as coarser rather than substituted; a certification measured on another task is refused.src/trace-repair/admission.test.ts—runAdmissionrefuses a zero-step policy before any control call, and excludes uncertified and nondeterministic tasks with zero replay and zero control calls.tests/trace-repair/delta-repair.test.ts—control-cannot-rescueis raised and the strongeradmission-conditions-on-control-failureis withheld.benchmarks/trace-repair/tools/certify-task-oracle.test.mjs— runs the script's--self-test, which checks the flip and verdict tables. Replacing the rule with "always stable" (which is what the tool did before) fails 3 cases, so the self-test is not vacuous.Proof
Full suite: 5255/5261 pass.
tests/contract-self-improve.test.tstimes out at 10 s under load and fails identically on unmodifiedorigin/main@0d6620bin a fresh worktree; it passes in isolation on this branch. Pre-existing, not introduced here.