fix: blame the runtime, not the harness, when the box dies mid-rollout - #2156
Conversation
Not every runtime raises when the box is gone — some surface it as exec's own non-zero result, indistinguishable from the program failing. One probe (Runtime.alive) on Harness.run's failure path tells the two apart, so a dead sandbox records SandboxError instead of HarnessError. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit de4ada9. Configure here.
ApprovabilityVerdict: Approved This is a focused error-attribution fix that adds a runtime health check to distinguish between command failures and runtime deaths, raising the appropriate error type. The change is small, self-contained to diagnostic logic, and authored by the primary maintainer of these files. You can customize Macroscope's approvability policy. Learn more. |

Summary
exec's own non-zero result, indistinguishable from the harness program failing. A sandbox that died mid-rollout was therefore recorded asHarnessError("harness exited 137"), blaming the agent program for an infrastructure death.Runtime.alive(): one trivial probe exec (true) that tells the two apart, and uses it at the single shared blame site —Harness.run's non-zero-exit path. Probe fails →SandboxError("runtime died under harness ..."); probe succeeds → the program genuinely failed and the existingHarnessErrorstands.Fixes RES-1195.
Verification
Real eval rollouts (bash harness, sleeper task whose agent runs
sleep 63), killing the box manually mid-rollout:docker rm -f <container>mid-rollout)trace.error = HarnessError: harness 'bash' exited 137trace.error = SandboxError: runtime died under harness 'bash' (exit 137)trace.error = HarnessError: harness 'bash' exited -9trace.error = SandboxError: runtime died under harness 'bash' (exit -9)Controls: a program exiting non-zero in a live box still records
HarnessErroron both runtimes.uv run pytest tests/v1 -n auto -m "not e2e"passes.🤖 Generated with Claude Code
Note
Low Risk
Narrow failure-path change with an extra probe exec; genuine program failures in a live runtime still raise HarnessError unchanged.
Overview
When a harness segment exits non-zero, the framework now probes the runtime with
Runtime.alive()(trueexec) before assigning blame. If the box no longer runs commands, the trace getsSandboxError(“runtime died under harness …”) instead ofHarnessError(“harness exited …”), so infra kills (e.g. exit 137 / -9) are not attributed to the agent program.alive()is a default on theRuntimebase class (success on exit 0,Falseon exec failure). The only call site is the shared non-zero exit path inHarness.run.Reviewed by Cursor Bugbot for commit de4ada9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Raise
SandboxErrorinstead ofHarnessErrorwhen the runtime dies mid-rolloutRuntime.alive()in base.py, an async method that runstrueand returnsFalseif any exception occurs.runtime.alive()to distinguish a dead sandbox from a program failure, raisingSandboxErrorif the runtime is gone andHarnessErrorotherwise.HarnessErrorfor all non-zero exits must now also handleSandboxErrorwhen the runtime has died.📊 Macroscope summarized de4ada9. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.