Skip to content

fix(verifiers): a judge the verifier deploys leaves no sandbox folder, and _judged's judge deploy and sample fan-out become helpers - #919

Merged
earakely-scale merged 2 commits into
mainfrom
edgararakelyan/judge-samples-tidy
Nov 25, 2026
Merged

earakely-scale merged 2 commits into
mainfrom
edgararakelyan/judge-samples-tidy

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

What changes

Two changes after #905: one fix, and a refactor that changes no behavior.

The fix. A judge the verifier deploys left its sandbox folder in the local sandbox directory. Main does this too: one folder per grade, and since judge samples, one per sample.

  • A run's teardown removes the work folders of the sandboxes it records, and this judge isn't recorded. _terminate_auto_deployed_judge stopped the judge's container and nothing removed its folder.
  • It now removes the folder once the sandbox is terminated, when the sandbox ran on this machine (remove_local_work_dir), as the gateway env provider does after a failed deploy.
  • A folder it can't remove is logged, not raised. A sandbox it couldn't terminate keeps its folder, as teardown keeps one for a retry.
  • The agent-judge chaos below found it.

The refactor. 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.
  • test_rubrics_verifier_judge_teardown.py checks the fix three ways: a judge on this machine has its folder removed, one elsewhere has nothing removed, and one whose terminate failed keeps its folder. Three test fakes of a sandbox now declare ON_THIS_MACHINE, as every real sandbox does through the Sandbox base.

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, then on c39ba7c for the fix. It spent about $7.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 left 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 left one folder at one sample and two at two. This PR now fixes it.
      • A judge whose container dies while it deploys is waited on for the deploy's full 300 s before the deploy fails. That's in the agent deploy, outside this PR, and is left for a follow-up.
  • The fix, on c39ba7c: 9 more runs. They covered:

    • a verifier-deployed judge at 1 and 3 samples;
    • an always-on judge at 2;
    • the task's own judge at 3;
    • a judge killed mid-grade;
    • SIGINT mid-judging with 2, 3 and 5 per-sample judges up.

    None left a judge folder, any other sandbox folder, or a container.

🤖 Generated with Claude Code

Confidence Score: 5/5 · The PR appears safe to merge; no actionable new issues were found.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable new issues were found.

Summary

Extracts judge setup, cleanup, parallel calls, and sample merging into helpers. Shares sample overrides across bundle and CLI runs.

  • Rubric grading selects and manages agent judges through shared helpers.
  • Sample and batch grading share one path for parallel calls and results.
  • Bundle, task, and eval runs build judge settings through one shared helper.
  • Verifier-deployed judges remove their local work folders after teardown.

Reviews (7) · Last reviewed commit: "fix(verifiers): a judge the verifier dep..." · 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
… behind

A run's teardown removes the work folders of the sandboxes it records. A judge the verifier deploys isn't recorded, so
`_terminate_auto_deployed_judge` stopped its container and left its folder in the local sandbox directory: one per
grade, and since judge samples, one per sample. Once the sandbox is terminated, it now removes the folder when the
sandbox ran on this machine, as the gateway provider does after a failed deploy. It keeps the folder of a sandbox it
couldn't terminate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale earakely-scale changed the title refactor(verifiers): pull the judge deploy and sample fan-out out of _judged, and share the run's sample overrides fix(verifiers): a judge the verifier deploys leaves no sandbox folder, and _judged's judge deploy and sample fan-out become helpers Nov 25, 2026
@earakely-scale
earakely-scale merged commit 7f1a7a8 into main Nov 25, 2026
37 of 38 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/judge-samples-tidy branch November 25, 2026 20:37
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