Skip to content

scenario_eval: the judge view's fixed size and byte-based estimate decide what can be judged #2257

Backlog

Description

@eric8810

Context

model-prompts §8.1 judges a policy text by comparing two arms on the same cases, model, settings and budget, with one fixed judge. The rule itself is sound. The measuring instrument has a weakness that decides which runs can be judged at all, and it surfaced as #2256.

The problem

The view is mostly scaffolding. judge_view renders the run's export, and rendered_request folds only the fields that repeated: the first request's system prompt and every tool definition appear in full. A scenario whose only text is a 56-byte summary reports a 23 817-token view against a 24 000-token window. So the budget is consumed by the same constant text in every run, not by what the run did, and the headroom left for the transcript is small.

The estimate is a byte heuristic with an asymmetric error. count_tokens is serialized_bytes / 4, not the judge model's tokenizer. Overestimating pushes a run to unjudged: it enters no probe rate, and the unjudged-run rate is a row with low power at 20 runs. Underestimating turns into a provider refusal, which §8.1 records as a failed run — charged to that arm's failed-run rate. The candidate text is usually the longer one, so both directions lean against the candidate.

"The view does not fit" reads as a run defect, not a measurement defect. §8.1 refuses to split a view (a probe about a whole run cannot be answered from a part) and records the run as unjudged with the estimate and the budget. That is defensible per run. What is missing is the evaluation-level signal: a scenario whose view cannot fit, or sits within a hair of the budget, produces inconclusive rather than a loud error, and can silently shrink the judged sample (the floor counts judged runs only).

Environment decides the outcome. Because paths are part of the view and the estimate is byte-based, the same fixture is judged on one host and unjudged on another (#2256: 17 tokens, /tmp versus /var/folders/…). "Same cases, same budget" does not hold across machines.

Options to settle

  • State the constant part once per evaluation instead of per run (or replace it with a digest plus names) as long as every probe §8.1 needs can still be answered; otherwise record that limitation in the rule.
  • Give the judge its own declared window, independent of the model under test, so the judge's budget is not a side effect of the arm's window.
  • Normalize paths (relative to the run's roots) so a view does not depend on the host's temp directory.
  • Calibrate the estimate against the judge's tokenizer, or record its measured error and direction beside each report.
  • Fail the evaluation, rather than the run, when a scenario's view does not fit the budget. Same for a fixture whose margin is under some stated fraction.

The owner document is docs/design/model-prompts.md §8.1 and §9.8, so a rule change updates it first. #2139 and #635 are the earlier judge-view size changes.

Acceptance

  • A stated decision on each option above, recorded in §8.1/§9.8 or in a follow-up issue.
  • A fixture whose view lands near the budget is rejected by the harness with its measurement, not by a test flipping on the host.
  • The judged/unjudged outcome for a given scenario, model and budget no longer depends on the machine's paths.

Activity

  1. added
    design
    on Nov 27, 2026
  2. eric8810 commented on Nov 27, 2026

    @eric8810
    CollaboratorAuthor

    Provenance

    Piece Commit Author Date
    View renders every request field, folding only repeats 937883252 huihui 2026-10-30
    View over budget is never split; the run is unjudged ace088c65 huihui 2026-10-30
    Rule text (model-prompts §8.1, "Failed and unjudged runs") 3a875e0265, 6fe98868be, 98f53eaa43 huihui 2026-10-28 → 11-25
    count_tokens = bytes / 4 278e257e7 eric8810 2026-10-16
    The harness started as one file and stayed one 5742a16c3 huihui 2026-10-29

    --model and --judge are both required (scenario_eval.rs:1634-1650), and the judge window is read from the judge's own selection (judge_window, scenario_eval.rs:8953), so the two windows are chosen independently — an earlier version of this comment said the judge defaulted to the run model; it does not.

    What still holds: whatever window the judge declares, the view carries the run's system prompt and tool definitions in full, so the content the probes ask about competes with constant scaffolding for the judge's budget. A judge window that is comfortably larger than the run model's hides that; a judge window near the run's does not. Fixture already ships a second, 128 000-token provider for this case; using it for the behavioural tests is #2256's fix.

  3. eric8810 commented on Nov 27, 2026

    @eric8810
    CollaboratorAuthor

    Landed in #2261 (stacked on #2260): every run's record now states judgeEstimate and judgeBudget (optional on the wire, so older runs.jsonl still reads), the fit flow asserts both margins instead of sitting on the line, and §8.1 records the fact.

    Deliberately not adopted here, because each changes the rule rather than its observability:

    • dropping the run's system prompt and tool definitions from the view — §8.1 requires that nothing be dropped, and a probe may ask about what the model was told;
    • calibrating the byte estimate against the judge's tokenizer — the estimate is a pre-call bound, and its error direction is now visible per run;
    • failing the evaluation when a scenario's view cannot fit — the unjudged-run rate already compares it, and a probe with no judged run already makes the verdict inconclusive.

    If the maintainers want the last item to be a hard failure, it is a §8.1 change and belongs in its own decision.

  4. eric8810 commented on Nov 27, 2026

    @eric8810
    CollaboratorAuthor

    One decision remains: should an unfittable judge view fail the evaluation, or stay an unjudged run? The last comment records that as a §8.1 rule change. Please decide which it is; if it is a hard failure, update §8.1 and add the flow test rather than treating it as an implementation detail.

  5. added
    P3
    on Nov 27, 2026
  6. eric8810 commented on Nov 27, 2026

    @eric8810
    CollaboratorAuthor

    Proposal

    What landed already (no rule change): every run's record states judgeEstimate and judgeBudget, the fit flow asserts its margin, and §8.1 records that fact (#2261).

    The three open questions are one decision each. My recommendation, with the reasoning, is below; @yyhhyyyyyy owns §8.1 and should accept or reject.

    1. Do not drop the system prompt and tool definitions from the view

    The view's fixed part dominates: a scenario whose only text is a 56-byte summary produced a 23 817-token view against a 24 000-token window, because the first request's system prompt and tool definitions are carried in full. Tempting, but wrong to cut: the view is the record of what the run was given, and a probe may ask about it ("the run must not show the operator's instruction", "the tool was offered"). Dropping it would also make the judged text depend on which policy text is under test, which is exactly what the comparison holds fixed.

    The consequence to state instead: a judge's declared window must hold the run's fixed request plus the run itself, so --judge names a model with a wide window, not the model under test.

    2. Keep bytes / 4, and stop calling it a measurement

    count_tokens is a pre-call upper-bound heuristic, not the judge's tokenizer. Calibrating it means shipping a tokenizer per judge model and making the fit check depend on which provider is configured — a new coupling for little value, since the check's job is only to avoid an overflow refusal.

    What it costs is already visible: the pair is recorded per run, and its error direction is knowable (an overestimate turns a run unjudged, an underestimate turns a provider refusal into a failed run). §8.1 should say that the estimate is the runner's bound, and that the report's margin is read with that bound, not as the judge's own count.

    3. Make a scenario's margin a precondition, not a run outcome

    Today a view that does not fit leaves the run unjudged, and the run enters no probe rate. That is right for a genuinely long run. It is wrong for a scenario that sits on the line: #2260 fixed eight flows that flipped between judged and unjudged on 17 tokens, and #2214 grew the fixed request enough to cross it.

    Adopted rule, one sentence in §8.1:

    A scenario whose view is within one tenth of the judge's budget fails the evaluation before its first run, and the report names the estimate and the budget.

    That keeps unjudged for runs that outgrow the judge at runtime (still a compared rate) and stops a fixture from depending on the host's path length or on a text change elsewhere.

    Not recommended: making every unfit view a hard evaluation failure. It would remove the unjudged-run rate as a signal and turn a legitimately long run into an error the operator cannot override.

    Cost

    Item 3 is small: judge_export already computes the pair, so the check is a comparison before the call, one carried reason, and one report row; the existing fit flow gains a case for the band. Items 1 and 2 are wording in §8.1.

    If this reads right, I will draft the §8.1 text and the check together for review.

  7. yyhhyyyyyy commented on Nov 29, 2026

    @yyhhyyyyyy
    Collaborator

    Decision on the proposal, item by item, then the path question from the issue body.

    1. Accepted: the view keeps the system prompt and the tool definitions in full. §8.1 will state that the model --judge selects must declare a window that holds the run's fixed request plus the run itself, since the same budget feeds the candidate text's own cost and the transcript. Separately, we will open a PR that folds losslessly in judge_view what is byte-identical to what came before: prompt/changed, context/configured, and the system and tools of a child line's first request when they are identical to the earlier value. The unchanged-marker collapse loses nothing: the view still rebuilds every request field, as the_judge_view_keeps_every_request_field (xtask/src/scenario_eval.rs:14620) and assert_view_rebuilds (xtask/src/scenario_eval.rs:17150) require, and a 1-turn fixture view stops carrying the same fixed text two to four times.

    2. Accepted with one correction to the wording: bytes / 4 stays, and §8.1 will describe it as an estimate taken before the call from serialized UTF-8 bytes at four bytes per token (crates/dim-agent-capabilities/src/context_model.rs:23), which can miss in either direction, not as a bound or upper bound. It is not one: code, diffs and dense punctuation pack real tokens into one or two bytes each, so the estimate runs low there; multi-byte UTF-8 text counts three bytes per character while tokenizers vary widely per character, so it can run either way; and the JSONL view is measured after its quotes and backslashes are escaped again, which inflates the byte count the tokens never pay. An underestimate ends in a provider refusal and stays a failed run, which a true upper bound could never produce. This is a documentation change only; the usage's real input tokens are not recorded.

    3. Not adopted; the behavior as of feat(xtask): record each run's judge view against the judge's budget #2261 stays, with no hard failure. The rule and its cost note disagree on when the check could even run: before the first run there is no view to measure, since the pre-run probe only lists tool names and the estimate and budget pair exists only after a run is exported, and checking in judge_export would hard-fail a run that grew honestly into the band while a still larger run is only unjudged. The comparison already carries the signal: the unjudged-run rate compares such runs between the arms, and a probe whose arm has no judged run already makes the verdict inconclusive, so no pass rests on unjudged data. And because the byte estimate is no bound, a tenth of the budget cannot promise to catch what it misses, so the rule would not deliver the guarantee it states. Two follow-ups we do want go into a separate PR: the scenario.md report gains a line with the judged runs' peak estimate and smallest margin, and the test fixture's Fixture::options default judge moves to the wide-window judge/mock (a 128,000-token window instead of the run model's 24,000), so a fixture sits on the line only when a test means it to.

    4. Path normalization is not adopted either. The host-path difference inside a view, /tmp against /var/folders/..., is on the order of 70 to 100 tokens for the working-directory and home paths the startup repeats, well inside the margin a wide-window judge carries. Rewriting paths relative to the run's roots would break the view's lossless-rebuild contract, which the_judge_view_keeps_every_request_field and assert_view_rebuilds pin down, and the hosts differ anyway in ways no path rewrite removes: the sandbox declaration text (macOS adds $TMPDIR to what a process may write), the platform and architecture line, the shell, and the timezone. Windows does not come into it: the harness refuses to start off unix, since a run's endpoint, sandbox backend and file-tool boundary are unix-only.

    One bookkeeping item while §8.1 is edited: #2261 updated the English docs/design/model-prompts.md but missed the Chinese mirror, which still lacks its two added sentences, the one stating that every run's record carries the estimate the fit check took and the judge's budget it compared, and the one stating that a run whose judging ended on a timeout keeps the pair when it reached the check.

    Since you offered to draft the §8.1 text and the check together: please go ahead with the §8.1 text for items 1 and 2, along the wording above, in both the English file and its Chinese mirror, which also brings in the two sentences the mirror is missing. Item 3 was not adopted, so the check itself is dropped; the report margin line and the fixture's default judge move are ours, in the follow-up PR named there.

  8. added
    P2
    and removed
    P3
    on Nov 29, 2026
  9. eric8810 commented on Nov 29, 2026

    @eric8810
    CollaboratorAuthor

    Accepted P2 now that the §8.1 decision is recorded: items 1–2 are documentation wording in the English file and its Chinese mirror; items 3–4 are not adopted. The report margin line and the fixture's default judge stay in the separate follow-up PR named above. Removing P3 because the blocking decision is resolved.

  10. eric8810 commented on Nov 29, 2026

    @eric8810
    CollaboratorAuthor

    The §8.1 text for items 1 and 2 is in #2334, English and the Chinese mirror, including the two sentences the mirror was missing from #2261. Items 3 and 4 stay as you decided; the report margin line, the fixture's default judge and the folding change are yours in the follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2design

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions