Skip to content

Drain sandbox container logs and own bounded cleanup - #515

Merged
abhishekraok merged 7 commits into
mainfrom
codex/drain-sandbox-logs
Oct 30, 2026
Merged

abhishekraok merged 7 commits into
mainfrom
codex/drain-sandbox-logs

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

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

Description

Drain SWE-ReX's attached container stdout/stderr from startup, retaining bounded diagnostics so a full pipe cannot block file staging. Own one bounded, idempotent, cancellation-safe shutdown task instead of allowing the SDK destructor to schedule another cleanup. Startup cancellation also cancels and awaits its child task, including Modal startup.

Force-remove Podman containers immediately, including the target image's docker compatibility symlink. Podman's default shutdown grace previously consumed the entire removal deadline; the deadline remains ten seconds. Genuine Docker commands are unchanged.

Independent prerequisite for isolate-sandbox-commands (#470) and recover-quarantined-sandbox (#471), addressing livecodebench-stalled-execution (#457).

Affected results

Task definitions, graders, metrics and stored task hashes are unchanged. Container startup diagnostics, runtime responsiveness and cleanup change.

Type of Change

  • Bug fix

Validation

  • Ruff, formatting and source type checks pass. Local verification: 4,531 unit cases passed with 35 skipped; seven environment-sensitive cases passed when rerun with modern Git and the documented terminal settings.
  • Exact-head Python 3.12/3.13 CI at 4181e5b1.
  • Twenty-one adapter unit cases and real Docker log-flood/cleanup regressions pass. Podman and alias regressions fail against the old code. Cleanup fixtures explicitly ignore SIGTERM and specify a 30-second stop grace.
  • Exact-source target cleanup probe at 4181e5b1: four concurrent containers, two declared Podman and two Docker aliases, removed in under five seconds each. Independent exists, inspect and ps checks confirm absence; attached clients and both capture threads are reaped. Source SHA/module hashes are verified. Only the HTTP readiness/close fixture is substituted; this checks actual deployment startup and cleanup without grading.
  • Control diagnostic: default force removal exceeded ten seconds and left the container present; immediate removal completed in 0.109 seconds.
  • Independent source and validation review found no blockers.

Prior full grading receipts remain attributed to stack revision 679ae84: k=1 matches baseline; k=8 accounts for all 4,896 saved outputs with zero scoring errors or replacements. The subsequent source delta only changes cleanup. No new inference or upload was performed.

Remaining work

Human review. The adapter uses pinned SDK process/readiness internals, so SDK upgrades require its compatibility tests. SDK image pull/build behavior is unchanged.

@abhishekraok

Copy link
Copy Markdown
Collaborator Author

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

Grading validation is complete; cleanup is not yet confirmed, so this PR remains draft.

Saved-output check Processed Actually graded No extracted code Scoring errors Replacements
k=1 at 679ae849 612 563 49 0 0
k=8 at 679ae849 4,896 4,480 416 0 0

All 563 graded k=1 outcomes exactly match baseline (112 pass, 446 fail, five timeout); the 49 no-code responses match separately. Every k=8 sample index covers all 612 inputs. Saved request/output hashes, source provenance, all local starts and the pinned input inventory pass verification. The k=8 run recorded no write/health stalls or unobserved tasks. Timings are descriptive, with no model-quality or causal speed claim.

Current e00f5fd/a7f60e3a/c13d2b41 CI passes. The final delta is cleanup-only. Its cleanup smoke at c13d2b41 grades correctly but still logs four Could not confirm removal ... TimeoutError() warnings despite the 10-second allowance. This is the remaining blocker; neither successful grading nor the manager's All sandboxes stopped message is proof of removal. Receipts are retained for the focused cleanup follow-up. No new inference or upload was performed.

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

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:16:29.608491Z eb64707 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

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

The cleanup blocker is resolved at 4181e5b1. The exact-source target check confirms all four owned containers removed in 0.119–0.301 seconds, including both Podman and Docker compatibility-symlink cases, with clients/capture threads reaped and no fallback cleanup. Exact-head CI passes; this PR is ready for review.

The control diagnostic confirmed that Podman's default ten-second stop grace consumed the ten-second deadline. Removal now requests zero grace while retaining the deadline. This supersedes the earlier unconfirmed cleanup receipt; prior grading evidence remains attributed to its original source revision. No new inference or upload was performed.

@abhishekraok
abhishekraok merged commit e0fc27c into main Oct 30, 2026
8 checks passed
@abhishekraok
abhishekraok deleted the codex/drain-sandbox-logs branch October 30, 2026 21:20
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