Repository navigation
Description
Describe the bug
The SWE resources servers capture the model's patch by running git in the agent's sandbox, after the agent ends. The agent controls that sandbox and its git setup. So an agent can make the capture hang until its 300 s deadline. A capture that fails with a provider error type (such as "timeout") is masked as an infrastructure failure, so the rollout is not graded. A model can then learn to hide a failing rollout from the loss and from eval denominators, where a graded empty patch would give it 0.
Where this applies on main today (cdf2a680f2):
- The shared capture code runs
git status,git diff <base> <tip>andgit add -N . && git diff <base>with the repository's own config. Hooks,core.fsmonitor, text conversion and external diff drivers all run (swebench/patch_capture.pyL252-L273; deadline at L213). - swemer_v1, swemer_v2, swemer_ultra, swemer_oml, swe_next, swe_rebench and swe_internal_v1 mark the capture incomplete, and so mask the row, whenever
error_typeis set (for exampleswemer_v1/app.pyL391). - scale_swe masks a capture timeout as
verifier_erroron purpose: "A timeout counts as infrastructure too" (scale_swe/app.pyL500-L505). - fix(swe): mask verifications without a verdict and block agent egress in more SWE servers #6670 brings the same rule to swe_gym and r2e_gym, and to the scale_swe cookie path. It keeps main's rule so that all ten servers stay alike, and leaves the fix to this issue. The review thread that found it: fix(swe): mask verifications without a verdict and block agent egress in more SWE servers #6670 (comment)
Steps/Code to reproduce bug
In a task sandbox, as the agent:
echo '* diff=stall' >> .gitattributes
git config diff.stall.textconv 'sleep 100000'Then end the episode and let the server verify it. The capture's git diff runs the text conversion, hits the 300 s deadline with error_type="timeout", and the row comes back masked, with no grading. Other ways to stall the capture: a core.fsmonitor hook, a post-index-change or other index hook, an external diff driver (diff.external or diff.<driver>.command), a clean or process filter from .gitattributes, a very large untracked tree, or a replaced git binary or PATH.
Expected behavior
A capture failure that the agent caused is graded: the empty patch, or a completed 0 with a failure_reason. Only a confirmed infrastructure failure (the provider lost the sandbox, or the exec never answered) is masked.
Proposed plan
- Harden the shared capture (small PR, all ten servers). Run the capture's git commands with
-c core.fsmonitor= -c core.hooksPath=/dev/null, and its diffs with--no-textconv --no-ext-diff. Text conversion and external diff output is not a patch that applies anyway. Clean and process filters stay on, because they decide the patch content. Add real-git tests: a hanging fsmonitor hook, index hook, textconv driver and external diff driver no longer stop the capture. - Tell an agent stall from a sick sandbox. After a capture timeout, run one trivial command (such as
true) in the same sandbox with a short deadline. If it answers, the sandbox is alive, so the stall came from the repository the agent left: grade it as an agent failure, unmasked. If it does not answer, mask the row as infrastructure. Without this check, scoring every capture timeout 0 would also train a 0 when the sandbox was only overloaded. - Apply that rule in all ten servers, on both the episode path and the cookie path. Add a real-git regression test for each kind: a hanging agent-installed driver must give an unmasked row, and a lost provider must still mask.
Step 1 cannot close every way in, because the agent controls the whole sandbox (it can replace git). Step 2 is the real fix.
Additional context
A draft of step 1 exists, with real-git tests for both the episode and the Agent /run paths. It was kept out of #6670 to keep that PR focused.
🤖 Generated with Claude Code
Activity