Repository navigation
Isolate sandbox commands from the SWE-ReX server - #470
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
b6eeba4 to
c75589a
Compare
335be85 to
9978dc6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 335be85953
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9978dc6 to
6f02cb5
Compare
c75589a to
a62c4f1
Compare
6f02cb5 to
880fbb5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 880fbb5724
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
880fbb5 to
3181c7d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3181c7d864
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
gregorybchris
left a comment
There was a problem hiding this comment.
This review was generated by an agent following
REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.
Looks good overall! This fixes the root cause of the #457 cascade for Docker/Podman sandboxes. One failure-visibility issue should be fixed before merge, and I'd like two pieces of run evidence.
Root cause, confirmed. SWE-ReX's /execute route is an async def that calls blocking subprocess.run, so the server handles one request at a time. I started a local swerex.server and sent two concurrent sleep 2 commands plus a write_file 0.3s later. All three finished at 4.03s. RemoteRuntime._request posts with aiohttp's default ClientTimeout(total=300), and LCB's grader ceiling is 900s. So one long grade blocks every file write and is_alive on that sandbox for more than 5 minutes. That matches the issue's timeline: transport failures during file writes about 5 minutes after the stall, then failed health checks, then quarantine. Running commands through the container CLI removes that blocking. --kill-after is a reasonable extra guard.
Verification. ruff check, ruff format --check and ty check src/ are clean. The only ty diagnostic is the unused type: ignore on the swerex import, which is already on main. The unit suite passes (3368 passed, 35 skipped). I could not run the Docker integration tests here. CI has not run on this PR: it targets codex/lcb-scoring-failures, and ci.yml only triggers for PRs into main. Only GitGuardian reported. The description's "Full Python 3.12/3.13 CI passes" applies to #469, not to this branch.
Overlap with #469 and #471. No real conflict. #470 shares no files with #469. Its commit also applies cleanly to current origin/main without #469 (git merge-tree --merge-base=a62c4f10 origin/main review-pr-470 succeeds), so the stated dependency is a stacking choice. The two PRs work together: the SandboxTransportError this PR raises is a SandboxInfrastructureError, so #469's format_scoring_error counts it as infrastructure. #471 edits manager.py, which #469 also touches, so #471 needs #469 first. #471's slot replacement calls executor.start(), which now runs this PR's capability probe. Suggested order: merge #469, retarget #470 to main so full CI runs (and rebase if #469 is squash-merged, so a62c4f10 drops out of the diff), then #471.
Blocking
src/olmo_eval/harness/sandbox/executor.py:622
When the runtime CLI does not return bytimeout + 10, the result is reported as an ordinary command timeout. The in-containertimeout --kill-after=5sends the command bytimeout + 5, so reaching the client deadline means the runtime is wedged, or a detached process is holding the pipe open. I reproduced this by making_execute_stream_controlraiseTimeoutErrorfor thesetsidcall and succeed for cleanup.execute_code("print(1)", timeout=3)returnedExecutionResult(success=False, error='timeout')and the sandbox stayedis_running.CodeExecutionScorerscores that as 0.0, and nothing marks it as infrastructure. That is the silent-zero class from #457 in a new place. LCB is unaffected because a missing verdict raisesScoringIncompleteError. Onmainthe same wedge reachedSandboxTransportErrorthrough the transport retries. Please treat a missed client deadline as an infrastructure failure: run_quarantine_if_unresponsive, then raiseSandboxTransportError. Please also updatetest_local_deadline_kills_the_process_groupandtest_slow_cleanup_uses_health_checks_before_quarantine, which currently asserterror == "timeout"for this path.except TimeoutError as exc: await self._quarantine_if_unresponsive(exc) raise SandboxTransportError( f"Container command did not return within {timeout + 10.0}s" ) from exc
Non-blocking
-
Grading concurrency per sandbox changes, which can move scores.
Onmain, the blocking/executehandler runs one command at a time in each sandbox. With this PR, each sandbox runs up tomax_concurrencycommands at once (default 4, so 16 graders across thecodex_pythonpool). The LCB grader enforces per-test limits withITIMER_REAL, which measures wall-clock time, so CPU contention can turn passes into Time Limit Exceeded.CodeExecutionScorertasks behave the same way. This is probably fine on a large host, but it affects persisted results. Could you replay a saved k=1 LCB run (for example the outputs of 01M42X0PXJ5RWPH1QG9DQH8QSW) throughmainand this branch, and post pass@1 plus the count of TLE verdicts for each? -
Please confirm the fix against the issue's own reproduction.
The PR tests real Docker, but the failing runs used Podman. The replay in #457 brings the cascade back deterministically on CPU-only jobs. Please rerun one of them (for example 01M4CSG2W9NBQAHDN006XNB1G2) on this branch with Podman. Post theSandboxRequiredErrorand transport-failure counts and the wall time. -
src/olmo_eval/harness/sandbox/executor.py:496
execute_commandandexecute_codenow kill every process left in the command's session when the command returns, including after success. Codex raised this (the comment on lines 639-640) and it has no reply yet. I found no in-repo caller that depends on background processes surviving. The diagnostics monitor uses_runtime.executedirectly, and agent scaffolds useexecute_in_session. Please reply on that thread, and state the new contract in both docstrings so the next caller knows about it. -
src/olmo_eval/harness/sandbox/executor.py:635
The"timeout"label depends on exit code and elapsed time, and no unit test covers it. Please add a test where the command exits 124 before the deadline (no label) and one where it exits 124 or 137 after the deadline (labeled). Also, which case produces exit code 9?timeoutreports a KILL as 137. -
src/olmo_eval/harness/sandbox/executor.py:526,:1026
The local-route predicate is copied intoexecute_commandandexecute_code.mode == DOCKER and container_namealso appears instart,_execute_stream_controland_quarantine_if_unresponsive. Could this be one_uses_container_cliproperty, so a future change to the route lands in one place? -
Follow-up issue for the remaining HTTP paths.
Modal sandboxes, images without GNUsetsid --waitandtimeout --kill-after, and configs withexec_shellstill send commands over HTTP, so they still serialize and can still cascade. The fallback only logs a warning.execute_in_sessionhas the same problem: SWE-ReX's session runner calls blockingpexpect.expectinside anasync def. Please file an issue that names these paths and link it here.
Nits
- Nit:
_execute_stream_control's docstring still says "short streaming-control command", but it now carries full commands up to the caller's timeout. The class docstring ("via SWE-ReX") is also no longer accurate for Docker mode. - Nit: the PID file is named
_sandbox_pgid_*, but it records the session leader'sstatline._sandbox_session_*would match what cleanup reads.
Before merge
Please fix the blocking item and its tests, and post the two replays from Non-blocking 1 and 2. Then merge #469, retarget this PR to main, and let full CI run. You may merge once CI is green. Please file the follow-up issue from item 6 and link it here.
Mark missing or exhausted sandbox scoring as infrastructure failure at both per-output and response-level catches. Preserve already-recorded verdicts and failure counts, and cover eight-sample LiveCodeBench responses.
a62c4f1 to
16f9e73
Compare
3181c7d to
aac7036
Compare
Run local sandbox commands independently of SWE-ReX HTTP and clean up their sessions on deadline or cancellation. Preserve raw argument sizes and image compatibility, never replay delivered commands, and verify behavior with real Docker regressions.
aac7036 to
e851ebc
Compare
|
Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5 The reviewed code findings are fixed, with regression tests and independent review. Five real Docker tests pass, including normal background-process lifetime; a controlled setsid/timeout command also confirms signal exit status 9. The original saved-output Podman bundle and replay spec are reachable and were inspected, but the full replay and paired k=1 pass/TLE comparison have not been run in this update. Those validation requests remain explicitly pending before this PR merges. Current Python CI is linked in the PR description. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94074a78b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Verify command-session cleanup before returning sandbox capacity
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b7b076dc3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Bound local sandbox output capture while preserving completion markers
|
Written by Claude Code for @gregorybchris. Current state, now that #492 is merged (d60f81f) and #469 is superseded:
|
|
Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5 Resolved against current main at f23bc99: the PR now targets main and its diff excludes the superseded scoring-gate changes. Main's failure-budget files are preserved. The recovery stack passes 4,498 unit tests and ten Docker regressions; independent review found no blockers. The earlier smoke used HTTP fallback, so it is not isolation evidence. A strict diagnostic now checks the actual local path and saved-output identity: https://beaker.org/ex/01M5ZSPJ52VHTK7E9691YMB3RZ |
|
Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5 The strict diagnostic identified the target incompatibility: Neptune lacks Both exact-head CI runs pass. The full stack has 4,504 unit tests and twelve real Docker regressions passing, including timeout/cancel with the children file absent; the timeout regression fails on the old supervisor. Independent review found no blockers. The strict Podman smoke now passes the strict gate: four local-ready executor attempts, two actual grader results, exact source provenance, and trusted saved-input checksum. This replaces the earlier HTTP-fallback receipt. Full saved-output comparisons are running: baseline k=1, stack k=1, and stack k=8. Their results remain pending before merge; no new inference or upload is involved. |
Skip Podman stop grace during forced sandbox removal.
…b-command-isolation
…b-command-isolation
…b-command-isolation
…b-command-isolation
Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5
Description
Execute supported Docker/Podman commands independently of SWE-ReX's blocking HTTP server so long-running programs cannot block file staging or health checks. A Linux child subreaper cleans descendants, including setsid/double-fork children; uncertain cleanup quarantines the slot. Kernels without proc-children files use parent-PID discovery through
/proc/*/stat.Stage source through bounded stdin writes and retain bounded output diagnostics. Unsupported images and custom shells retain the HTTP route tracked in remove-blocking-http (#483).
Based on drain-sandbox-container (#515). Recovery remains separate in recover-quarantined-sandbox (#471).
Affected results
Task hashes and graders are unchanged. Preserve main's count-scoring-failures (#492) failure-budget policy; infrastructure errors remain unscored and explicit.
Type of Change
Validation
Remaining work
Human review and parent merge. Retarget the recovery child before merging this PR. Related to livecodebench-stalled-execution (#457).