Skip to content

refactor(verifiers): pull the judge deploy and sample fan-out out of _judged, and share the run's sample overrides - #919

Open
earakely-scale wants to merge 1 commit into
mainfrom
edgararakelyan/judge-samples-tidy
Open

earakely-scale wants to merge 1 commit into
mainfrom
edgararakelyan/judge-samples-tidy

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

A refactor after #905, with no change in behavior. RubricsVerifierTaskStep._judged had grown to 434 lines with eight nested functions. This PR moves its judge setup and its fan-out into helpers of their own, and the method drops to 357 lines.

  • _judge_agent_of(context, run): finds the task's agent judge (agent_name), or deploys one with the run's model key and endpoint. This code was inline in a closure.
  • _judge_agents(make, count): an async context manager that holds the grade's agent judges: none for a direct judge, one, or one per sample. It terminates each one the step deployed on the way out. It replaces the hand-written task group, the cleanup on a failed deploy, and the finally at the end of grading.
  • _side_by_side(calls): runs coroutines at once and raises the first failure as itself. It replaces two copies of the TaskGroup-and-unwrap code, one for samples and one for batches.
  • _merged_samples(outcomes): merges a batch's samples into one outcome: median rows, summed retries, discrepancies named by sample, the first trajectory.
  • _JudgeOutcome: a NamedTuple for the four results _run_judge_with_output_retries returns. Code reads o.rows and o.retries instead of unpacking _, _, ds, _. It's still a tuple, so subclasses and test stubs that return plain tuples work unchanged.
  • judge_samples.overrides(samples, bar): builds the run overrides. bundle/run.py, task run and eval run each built them by hand, with the same asymmetry: a count is left out when it's None, but a bar of 0 is kept.
  • judge_samples.py: splits and disagreement share one tally of passes. A local variable no longer shadows splits, and both functions use one test for a sampled row.

One judge and one batch still run in the caller's task, as before #905, so the one-sample path runs the same code.

Tests

  • The existing suites pass unchanged: 5,147 tests over tst/unit/task_step, the bundle-run and CLI tests. The 4 tests in computer_exec_test.py fail on macOS before and after this change, because they shell out with GNU tools.
  • test_rubrics_verifier_judge_samples.py adds two assertions on judge_samples.overrides.

E2E

Run on an admin VM through the real LiteLLM proxy, behind the logging pass-through and grade checker that #905's rounds used, on 8601fab beside main af545d9. It spent about $6.20.

  • Scenarios, 25 of 25:
    • effort, thinking and batches on Claude, GPT-5 and GPT-4o models, with a refused effort failing the grade;
    • screenshots, per criterion and final frames;
    • 2 to 5 samples, binary and partial, in batches and by run override;
    • an evidence judge that grades once;
    • nine agreement cases: default and raised bars on the step and per run, partial scores, one sample.
  • One sample, beside main: seven bundle tasks graded the same on both. They cover a direct judge, an agent judge the verifier deploys, the task's own judge, an always-on judge, partial samples and user_sim_judge.
  • A judge per sample:
    • A judge the verifier deploys started 3 containers for 3 samples and 5 for 5.
    • The task's own judge used 1 container for 3 samples.
    • The always-on judge's 3 samples each staged their own 22 files.
    • Nothing was left up after any run.
  • Agreement:
    • At the default bar the coin task split, and the summary named it.
    • At a bar of 1.0 the same split failed the grade and the task, a tolerated judge carried on, and retry_config graded again, its line naming JudgeDisagreementError.
    • judge-agent-effort at 3 samples passed with c2 named as split, and at 1.0 failed on it.
  • Chaos: 15 minutes, 119 runs with 0 crashes. The runs varied the model, the sample count (82 runs sampled), the bar (53 runs set one), the format, and injected proxy and store faults.
  • Agent-judge chaos: 30 real agent-env runs of verifier-deployed, task-deployed and always-on judges at 1 to 5 samples. That chaos above used direct judges only, and these are the paths _judge_agent_of and _judge_agents took over. After every run a checker looked for containers left up, sandbox folders left behind and tracebacks.
    • SIGINT mid-judging, 5 runs: each exited 130. With 2 or 3 verifier-deployed judges up, which teardown can't reach since nothing records them, _judge_agents terminated every one.
    • A judge container killed mid-grade, 3 runs: the grade failed with AgentUnreachableError naming it, the run exited 1, and the other samples' judges were terminated.
    • One of N judges killed as it starts, at 5 samples and at an always-on judge's 3: the deploy failed, which failed the grade, and the judges that had come up were terminated.
    • Judge calls failing at the proxy, 50% of them, 3 runs: 3, 4 and 6 calls were faulted, and each grade graded.
    • No container was left up in any run, and no run printed a traceback.
    • Two problems these runs turned up are also on main:
      • A judge the verifier deploys leaves its sandbox folder in the local sandbox directory. LocalSandbox.terminate() keeps the folder, and teardown removes only the folders of sandboxes a run records. Main leaves one folder at one sample and two at two, as this branch does.
      • A judge whose container dies while it deploys is waited on for the deploy's full 300 s before the deploy fails.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable regressions or rule violations were found.

Summary

Extracts judge deployment, cleanup, parallel calls, and sample merging from _judged.

  • Rubric judges use shared helpers for setup, parallel grading, and cleanup.
  • Bundle, task, and eval runs use one helper to build judge sample overrides.
  • Sample disagreement summaries use one check and one shared pass tally.

Reviews (2) · Last reviewed commit: "refactor(verifiers): pull the judge depl..." · Reviewed by Greptile

…_judged, and share the run's sample overrides

- `_judge_agent_of` finds or deploys the agent judge.
- `_judge_agents` holds the judges for the grade and terminates the ones the step deployed.
- `_side_by_side` and `_merged_samples` run and merge samples and batches.
- `_JudgeOutcome` names the judge call's four results.
- `judge_samples.overrides` builds the run overrides that bundle runs, `task run` and `eval run` each built by hand.
- `splits` and `disagreement` share one tally.

One judge and one batch still run in the caller's task, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale marked this pull request as ready for review November 25, 2026 03:21
@earakely-scale
earakely-scale requested a review from a team as a code owner November 25, 2026 03:21

This branch has not been deployed

No deployments
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