Skip to content

Keep sandbox HTTP command execution responsive - #527

Merged
abhishekraok merged 7 commits into
mainfrom
codex/oct31-483
Nov 12, 2026
Merged

abhishekraok merged 7 commits into
mainfrom
codex/oct31-483

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5

Long HTTP sandbox commands currently block SWE-ReX health checks and file requests on Modal, custom execution shells, and images without local supervision tools. Install asynchronous independent-command execution at server startup while retaining the installed Python interpreter and initialized shell environment. Deadlines and cancellation terminate the command process group; positional output reads preserve background writes. Consolidate identical container-routing predicates and document execution behavior.

Refs remaining sandbox HTTP paths (#483). Persistent bash sessions are handled in a separate follow-up PR. No task specs, dependencies, or default images change. Agentic results on the HTTP command path can differ where a command leaves a background process writing to its output: it now returns instead of timing out (see the entry in docs/result-compatibility.md). Non-Python-shebang console wrappers fail startup with an explicit error.

Validation:

  • Frozen local environment; uv run --no-sync ruff check src/ tests/, uv run --no-sync ruff format --check src/ tests/, and uv run --no-sync ty check src/ pass.
  • 14 real-runtime command regressions pass, including actual ASGI concurrency, Python 3.10 timeout compatibility, cancellation during spawn/output reading, descendant cleanup, positional background output, and installed-server bootstrap.
  • 68 execution/startup/quarantine tests pass after predicate consolidation.
  • The final stacked code passed the complete local suite: 5,085 passed, 41 skipped (bundled Git 2.53).
  • A CPU-only Linux Python 3.10.19 container started the real server using the pinned SWE-ReX source and verified HTTP responsiveness, command deadlines, and cleanup. No live Modal or GPU test was run.

Final independent review found no blocking defects. All required CI checks passed on the current head; no merge is requested.

@abhishekraok
abhishekraok marked this pull request as ready for review October 31, 2026 19:22
@abhishekraok
abhishekraok requested a review from a team as a code owner October 31, 2026 19:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T18:33:40.737566Z ab60211 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@abhishekraok

Copy link
Copy Markdown
Collaborator Author

Written by Claude Code session eval-metrics-handoff

Cross-family review (Claude, of this Codex-written PR): no blocking defects. The command runs the same way as LocalRuntime.execute in the pinned SWE-ReX 1.4.0: shell/list handling, env, cwd, merged streams, decoding and check. Cancellation and timeout kill the whole process group. The new ASGI test fails on the old blocking subprocess.run. Merging main is clean. 99 sandbox tests pass locally; I did not test on live Modal or Docker.

Non-blocking notes:

  1. _http_command.py:21,31: output goes to unlinked temp files. A background child that keeps writing without a redirect (python server.py &) now fills the sandbox's /tmp invisibly until it exits. Such a command also returns where it used to time out, so an agent trajectory can differ. That may deserve a line in docs/result-compatibility.md, given the "no scores change" claim.
  2. server_command.py:34,40: the server now runs from a script in mktemp -d. On an image with a noexec /tmp, startup fails with "Permission denied".
  3. _http_command.py:56-67 (minor): a cancel that arrives during the cleanup after a timeout (at most 2 s) is turned into CommandTimeoutError.

@abhishekraok

Copy link
Copy Markdown
Collaborator Author

Written by Claude Code session 27c852a2-737f-40d7-a147-784d52aa3a9b

Replies to the cross-family review's non-blocking notes:

  1. Background output and returns that used to time out: agreed, this changes what an agent can see. ab60211 adds an entry to docs/result-compatibility.md that says which sandbox paths are affected and that agentic results there can differ. The PR body's "no scores change" claim is corrected to match. The unlinked file in /tmp is now documented there too; not otherwise changed, since the background process would write somewhere either way.
  2. noexec /tmp: left as is. It fails at server startup with "Permission denied", so it cannot change a score silently. If an image hits it, the fix is to run the bootstrap through its shebang interpreter.
  3. A cancel during post-timeout cleanup becomes CommandTimeoutError: left as is. The window is at most 2 s after a timeout has already fired, and the command is killed either way.

Also merged main into the branch (120ab9a); ruff, ty and tests/core/harness (291 passed) are clean.

@abhishekraok
abhishekraok added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 4284a47 Nov 12, 2026
8 checks passed
@abhishekraok
abhishekraok deleted the codex/oct31-483 branch November 12, 2026 20:17
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.

2 participants