Repository navigation
fix(verifier): clear result files before running the container verifier - #310
Merged
earakely-scale merged 2 commits intoOct 23, 2026
Conversation
In reward mode the step read reward_path from the task container after the verifier ran, without removing it first. A reward file the agent wrote during its turn was graded as the verifier's when test.sh exited without writing one (set -e, or 'pytest && echo 1 > reward.txt'): score 1.0 for a failed run. Remove every result path inside the container before the main command, and correct the comment that said a non-zero exit is recorded as 0. Closes scaleapi#305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the reward file is read for the score, so it is the one cleared before the command runs. Other result files stay as they were: a step can extract what an earlier step's job wrote, as the supervisor steps that adopt a running engine do, and clearing them made those steps extract nothing. The rm runs as uid 0, which needs no passwd entry, and the comment no longer claims more than the clearing gives: a process the agent left running can still write the file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks for adding the cleanup; the pre-written reward case from #305 now scores 0. Two concerns:
Happy to share the test cases. |
Collaborator
|
I pushed a3b7365 on top of 58a6c2f with three changes from review:
Verified on an agent-environments-admin VM (m5.2xlarge, linux/amd64), with real Docker, on three trees:
|
psinghal20
approved these changes
Oct 23, 2026
|
Thanks for the quick turnaround. I re-ran the cases from #305 against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Closes #305
In reward mode,
RunContainerUnitTestsVerifierTaskStepdocker cp'dreward_pathout of the task container after the verifier command ran, and scored whatever it found. Nothing removed the file first. An agent working in that container could write1to the reward path during its turn. Iftest.shthen exited without writing a reward, the planted file was recorded asscore=1.0, result=Truefor a failed run. That covers aset -escript, orpytest && echo 1 > reward.txt, which relies on "missing file = 0".This PR removes every entry in
result_paths(which includesreward_path) inside the container right before the main command. Anything extracted afterwards was written by this verifier run.docker exec -u root -w / … rm -f -- <paths>viaexec_script, so it fails loudly. Root ensures an agent-owned file can be removed.-w /resolves a relative path the same way the laterdocker cpdoes.setup_commands, so a setup step can't leave a stale result behind either. A retried step also no longer reads a previous attempt's file.test.shthat writes a partial reward and exits non-zero is still graded by that reward. I corrected the step-9 comment, which said a non-zero exit is "already recorded as score 0": that only happens when no reward file exists.How it was tested
test_reward_comes_from_this_verifier_run, parametrized: correct answer, wrong answer, and wrong answer with a planted/logs/verifier/reward.txt. It drivesexecute()against a fake sandbox that models the container's files:rm -fanddocker cpact on them, and the verifier command writes the reward only when the answer is right. Onmainthe planted case scores 1.0 and fails the test. With this change it scores 0.0. The other two cases pass on both.pytest tst/unit packages/agentenv-protocol/tests -n 4: 9455 passed, 49 skipped. 16 failed and 119 errored, all intst/unit/store/aws/*,store/google_transport_test.pyandgcp_secret_manager_secret_store_test.py(SocketBlockedError, no local emulators here). The identical set fails onmain.ruff checkis clean on both files.Found and fixed with Claude Code. The runs above were executed locally.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
Clears
reward_pathbefore the verifier command runs, without deleting other requested result files.Reviews (2) · Last reviewed commit: "fix(verifier): clear only the reward fil..." · Reviewed by Greptile