Skip to content

refactor(sandbox): remove unused stdlib runner compatibility - #5327

Merged
yaoyu-33 merged 75 commits into
mainfrom
codex/remove-stdlib-runner
Nov 6, 2026
Merged

yaoyu-33 merged 75 commits into
mainfrom
codex/remove-stdlib-runner

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #5152 → #5153 → this PR. Base: refactor/codex-bash-runner. Merge after #5153.

What and why

After #5153 moves Codex to the shared Bash runner and Node launcher, no built-in adapter uses the shared standard-library Python runner compatibility path. This PR removes that unused path separately so the Codex migration and the shared API removal can be reviewed independently.

Only six shared API, test, and documentation files change:

  • Remove SandboxCommand.stdlib_runner, the supervised_launch_command(stdlib_runner=...) keyword, check_stdlib_runner, RUNNER_FILE, and RUNNER_INTERPRETER.
  • Stop resolving the task interpreter or creating bin/gym-runner.
  • Remove compatibility-only bootstrap cases; retain launch fencing, quoting, and explicit-interpreter coverage. Exercise the real Bash runner in the process-name test and use shell signal status 137 in its cleanup receipt fixture.
  • Update the harness guide and add-harness skill with the current launch contract and migration instructions.

No separate issue is needed: this is the scoped cleanup following #5153 and the harness-runtime work discussed in #5094.

Compatibility

Out-of-tree adapters using the removed API must stop passing stdlib_runner and supply their executable explicitly. CLI adapters use harness_runner.sh; Python SDK shims supply their own interpreter, typically through SandboxPythonRuntime.

Hermes, Stirrup, and NOOA already pass explicit adapter-managed interpreters and never enabled this flag. Their files and launch behavior are unchanged. No benchmark-result change is expected.

Validation

Current head eedd6eae2 includes the reviewed musl installer fix 9bc9afd8e from #5153. Its own diff remains exactly the six shared API/test/documentation files listed above. The parent fix passed 31 Linux installer/bootstrap tests and real nonroot Alpine 3.20/3.16 installation checks. Full pre-commit checks pass on this combined tree.

Prior split validation:

At f1317267f:

  • Targeted Codex/shared sandbox regression tests: 412 passed, 49 skipped. All skips are Linux-only process/sandbox contracts on this macOS host.
  • pre-commit run --all-files: passed.
  • cd fern && npm run check: passed, zero errors and one warning.
  • Independent review: no findings; verified the lower PR retains compatibility and this PR removes only the unused path.
  • Combined Git tree matches the pre-split cleanup plus current parent exactly (6651d9d6e0e7285b377c5962d348dd4e48c0a1fa).

Test selection (existing development venv, plugin autoload disabled, async plugin loaded explicitly, source imports verified against this checkout):

pytest -p pytest_asyncio.plugin -p no:cacheprovider -o addopts='' -o log_cli=false -q \
  responses_api_agents/codex_agent/tests/test_sandbox_launcher.py \
  responses_api_agents/codex_agent/tests/test_bootstrap.py \
  responses_api_agents/codex_agent/tests/test_install_runtime.py \
  responses_api_agents/codex_agent/tests/test_exec_transport.py \
  responses_api_agents/codex_agent/tests/test_sandbox_sessions.py \
  responses_api_agents/codex_agent/tests/test_sandbox_runner.py \
  tests/unit_tests/test_sandbox_supervisor_bootstrap.py \
  tests/unit_tests/test_sandbox_supervisor_client.py \
  tests/unit_tests/test_sandbox_session.py \
  tests/unit_tests/test_harness_runner.py

New model rollouts: N/A. This removes a path unused by all built-in adapters after #5153; it changes no active harness or verifier behavior. The Codex migration's prior real-model evidence is linked in #5153. Fresh Linux CI remains pending.

hemildesai and others added 30 commits October 26, 2026 15:04
The supervisor uploaded into task sandboxes now needs only bash, /proc, sleep and mv, so
sandboxed harnesses no longer require Python 3.8+ in the task image. It keeps the CLI and
receipt contract: run the harness in its own process group, stop it at the deadline or
when the stop file appears (TERM, then KILL the group), and confirm no group member runs.

Stops now reach the supervisor through stop.request instead of SIGTERM, so the launch
shell no longer ignores TERM and the harness keeps the default disposition. Shared
receipt types and timeouts move to supervisor_client; SandboxCommand drops its python
field. shell_assignments() renders runner inputs as bash source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
harness_runner.sh replaces per-harness Python runners: it sources the PARAMS written by
shell_assignments(), records runtime.json, applies the harness environment and runs the
CLI with file-backed stdio. With events set, it stamps each JSON stdout line with the time
it was seen, reading a file so a detached tool holding stdout cannot stall it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…rmes tests

Point the harness guide, package docs and SandboxSession docstring at process_supervisor.sh
and harness_runner.sh, drop the Python-in-sandbox requirement and the subreaper drain the
bash supervisor no longer performs. Hermes tests use the bash supervisor. The runner stamps
a final unterminated event line with the same fallback time as the others on bash < 5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Kilo sessions now run through the shared bash harness runner with PARAMS
written by shell_assignments(); sandbox_runner.py is gone. A short setup
string removes a stale plugin receipt and records the task's HOME/XDG for
the task-environment plugin, unset_env drops inherited KILO_*/OPENCODE_*/
OpenAI variables, and the exit code comes from the cleanup receipt.
Path checks are POSIX shell, the bootstrap installs only bash, and the
installer drops its Python checks. The SQLite snapshot moves host-side:
kilo.db and its WAL files are downloaded and backed up locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ndbox

Claude sessions now launch through the shared bash harness_runner.sh with params.sh instead of
sandbox_runner.py and input.json. The offline runtime installer is a bash script with the same
SHA-256, version and lock semantics, so task images need bash and coreutils but no Python.

Signed-off-by: Hemil Desai <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Launch OpenClaw through the shared bash harness_runner.sh with PARAMS from shell_assignments()
and a staged prompt file, replacing sandbox_runner.py. The workdir overlap check is POSIX sh,
session setup installs only a missing bash, and the runtime installer drops its Python checks
(apk now reports whether musl images have libstdc++; the prepare step already guards the
runtime path against the task workdir).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Task images now need only bash. The shared harness_runner.sh replaces
sandbox_runner.py: PARAMS carry the CLI argv, environment and stdio files, and a
short setup records the task HOME/XDG directories for the shell.env hook, removes
a stale initialization receipt and creates the private CLI directories.

The SQLite snapshot moves to the agent server: after confirmed cleanup the adapter
downloads opencode.db (and its -wal/-shm files when present) and runs the same
export there, producing the same export.json and observations.db. The bootstrap
no longer installs python3 and checks workdir overlap with POSIX shell, and the
runtime installer serializes with flock, or a reclaimable lock directory without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Pi now runs under the shared bash harness runner: the adapter stages params.sh
and prompt.txt, and the runner records [seen_at, event] lines. Session setup no
longer installs python3, the runtime installer checks for the musl C++ library
by path instead of with ctypes, and the host parser skips recorded lines that
are not [number, object] records.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…available

A missing or undownloadable session database again leaves no export, so
collection reports "OpenCode sandbox runner returned no valid result" with the
output log, as when export.json was missing before. The export no longer depends
on copying the observation store: a failed copy, like the failed observations.db
download before, only adds observation gaps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hemil Desai <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
The bash supervisor no longer takes an interpreter, so NOOA drops the removed
SandboxCommand.python field (its own pinned Python still runs its worker), and
the Codex worker keeps its Python runner under the bash supervisor: its
sandbox-local 429 retry proxy still needs Python. OpenCode drops
sandbox_python_executable; sandbox_path_prefix now reaches the CLI through the
runner setup. Tests and READMEs name process_supervisor.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… runner names

On bash < 4.2 printf has no strftime, so every event was stamped with an empty
time and the host parsers dropped them all; fall back to date. Strip a trailing
CR before recording a JSON line. Inherited variables named like runner PARAMS
(setup, events, stdout, ...) no longer configure the runner or leak into the CLI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…he bash supervisor

A stopped CLI's tools that run in their own session (OpenCode and Codex start every
shell tool that way) kept writing to the task after a confirmed receipt. Before
stopping the harness, the supervisor now records its descendants outside its
process group from /proc and kills them, and the groups they lead, with the
harness; confirmation waits for them too. Services orphaned before the stop are
still left for the sandbox owner.

The supervisor also:
- reads each /proc/PID/stat whole and never evaluates its fields as arithmetic, so
  a process name holding a newline cannot run code or hide a group member;
- refuses to launch without a readable /proc, and counts unreadable process
  state as running;
- bounds the wait for a KILLed harness and writes a negative receipt instead;
- exits on a missing option value or separator instead of looping or running part
  of the command, and ignores an inherited errexit.

Launches render fixed-point seconds, and a deadline shorter than the supervisor's
centisecond resolution expires before launch instead of leaving no receipt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…runner descriptors

Without job control bash starts an async command with INT and QUIT ignored, and
the CLI's tools inherited that. The CLI also inherited the runner's read and
events descriptors, so a tool could write raw lines into events.jsonl. Reset the
two signals (bash 5 honours the reset) and close both descriptors for the CLI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…e to older bash

Without flock, the Claude installer never reclaimed the lock of a killed
installer, and OpenCode's reclaim could delete a lock another installer had just
taken (or skip an owner killed before it wrote its PID). Both now take a symlink
that names the owner by PID and start time, and remove a dead owner's lock only
under a second lock after re-reading it.

The Claude installer lowercases the trusted digest without bash 4 expansions.
The Pi installer no longer fails under set -u on bash < 4.4 when it needs no
packages, and checks every default musl library directory for libstdc++.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
sqlite3's context manager commits but does not close, so a failed export kept the
copied databases open while the snapshot directory was removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…wn sessions

The receipt docstring, the harness guide and the Codex, Pi, OpenCode, OpenClaw,
Hermes and Terminal-Bench READMEs now describe what the bash supervisor does:
it kills the harness group and, after a forced stop, the descendants that ran in
other process groups when the stop began; processes that left the harness
earlier stay with the sandbox owner. The receipt documents shell exit statuses.
The Kilo and local-provider tests cover a tool in its own session again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… stop test

shell_assignments() now raises for NUL and non-string words, which bash would
silently drop or which raised an opaque TypeError. The Hermes close test stops
the supervisor through the stop file alone, as production does, and the
sandboxed Hermes README states that the supervisor needs the task image's bash.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…completed tools

The bash port's tests asserted that a tool still running in its own session
survives a close, and modelled a completed tool's service as a direct child of
the CLI. With the supervisor's stop-time cleanup, an in-flight detached tool is
stopped again, as before the port; a service left by a tool that already exited
still survives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
The harness guide said Codex starts its CLI through harness_runner.sh. On main
Codex keeps its Python sandbox_runner.py for its sandbox-local retry proxy, so it
still needs the task image's Python; Hermes, Stirrup and NOOA run their Python
shims on interpreters they install privately.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…sandbox-runtime

# Conflicts:
#	responses_api_agents/hermes_agent/tests/test_sandbox.py
Resolve the conflicts with #4805, which hid the Python supervisor and opted-in
Python runners from `pkill python` by running them through interpreter links.
The supervisor here is bash, so its link is dropped. Its runner link survives as
SandboxCommand.stdlib_runner on the bash launch: Codex, the one harness that
keeps a standard-library Python runner, runs it as bin/gym-runner from
`sandbox_runner`. OpenCode, OpenClaw, Pi and Kilo keep the bash runner, whose
name never mentions python. The pkill and delayed-launch tests follow the bash
supervisor; the READMEs and the harness guide describe the result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…afe task dirs

Address review findings on the bash runtime:
- Without flock, the OpenCode and Claude installers now queue on numbered
  owner links that are never removed or reused, and skip a number whose
  owner is done or gone. There is no second reclaim lock left to strand, and
  an installer killed at any point cannot block or release another.
- A preinstalled OpenCode binary must exit successfully from --version, not
  only print the version, before it replaces the cached runtime.
- OpenCode's and Kilo's task-env.json writers escape every JSON control
  character, so task HOME/XDG paths with tabs or newlines stay valid JSON.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…l-name tests

The pkill tests merged from main called payload() with a timeout, which only
the Python runner's input carried; the bash runner takes its timeout from
execute().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
The pkill test from main assumed the supervisor's only child is the runner. The
bash supervisor also forks its polling sleeps, so take the runner as the parent
of the tool it started and check that it is a supervisor child.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Review found that one descendant snapshot before TERM let a confirmed receipt
leave processes running: a TERM handler that runs `setsid ... &` and exits, or
a tool that keeps forking new sessions during the grace period.

- The supervisor gives the harness a NEMO_GYM_SUPERVISOR environment marker
  unique to this run. On a forced stop it scans /proc when the stop begins, on
  every grace and drain round, and before the final KILL. It reaches the
  harness group, descendants of the harness, of its group and of reached
  processes, and processes carrying the marker. Marked processes that had
  already left the harness when the stop began are preserved as services, as
  the subreaper on main did. The Codex runner passes the marker through its
  env allowlist.
- A recorded group is killed or awaited only while its ID is free or still
  held by the recorded leader (same start time), so a reused group ID is not
  hit.
- Without a process group of its own, the supervisor restarts itself as a job
  in a new group, so a provider's group KILL cannot end it before the receipt.
  The shell left behind passes on TERM and the exit status.
- Docstrings and READMEs state what a forced stop reaches and what it does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…statuses

- emit() strips a trailing CR without `${1%$'\r'}`, which tried the suffix at
  every position and took seconds per MB, long enough for Pi's agent_end event
  to outlast the deadline.
- The runner resets errexit, nounset, pipefail and IFS, so a BASH_ENV with
  `set -e` no longer stops it at the first non-JSON line.
- A failed exec redirection no longer falls through into events mode or
  launches the CLI. The runner exits 125 for its own failures (bad cwd, an
  exit in setup) and 126 or 127 when the CLI could not be started.
- Drop `trap - INT QUIT`: it did not change what the CLI inherits, and its test
  passed without it.
- Kilo tells runner failures apart from Kilo's own exit status, reports no exit
  code for a Kilo the runner never started, and none for a cancelled run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…e Code

- The OpenCode installer removes a partly staged binary from its single EXIT
  trap, however it exits, and a cached binary must exit successfully from
  --version to be reused.
- Claude Code setup installs a missing bash on root images with apk or
  apt-get, as the other bash-runner adapters do, and otherwise fails with a
  message that names bash instead of a bare 127.
- Reword "native" in the Claude installer docs, docstring and a test name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
yaoyu-33 and others added 3 commits November 4, 2026 07:28
The harness guide's adapter list conflicted: main now says framework
adapters list the framework in pyproject.toml (#4837), and this branch
says Codex starts through harness_runner.sh and sandbox_launcher.mjs.
Keep both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Preserve the network policy and preinstalled runtime checks from main while keeping the Bash/Node launcher and removing task-image Python requirements. Keep the obsolete Python transport deleted and reconcile session test imports and runtime documentation.

Validation: 370 focused tests passed, 6 skipped; pre-commit run --all-files passed. No new model rollout: this merge preserves the existing harness and network-policy contracts.
Signed-off-by: yaoyu-33 <[email protected]>
Merge the updated Bash-runner parent while preserving the package and test
relocations, typed termination failures, and explicit expiry marker.

Keep the shared stdlib-runner API removal. Pool arrived on the parent after
this cleanup was split and still used that API, so let Pool provide its own
neutral interpreter path, preserving its fallback to python3. Remove the
stale public export and regenerate the affected import-surface entries.

Validation:
- Shared supervisor bootstrap/client/session and harness-runner tests,
  Codex session/launcher tests, and Pool's complete test suite:
  628 passed, 25 skipped on macOS.
- Public agent exports, external public imports, and Fern links:
  32 passed and 24 subtests passed.
- Both refreshed legacy import-surface entries resolve all recorded names.
- pre-commit run --all-files: passed after formatting the new test.
- Fern check: zero errors; unauthenticated remote redirect check skipped.

New model rollouts: N/A for conflict integration and equivalent runner API
migration; model requests, harness execution, and grading are unchanged.
Linux-only process checks remain for CI.

Signed-off-by: yaoyu-33 <[email protected]>
Base automatically changed from refactor/codex-bash-runner to main November 6, 2026 21:14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of behavior differences from the shared path this replaces. They look fine to me,
but worth confirming they're intended

  • The link used to be made inside the fenced launch command, after the [ -d session_dir ]
    and launch-claim checks. It now runs as a separate exec at stage time, before the fence.
    The session dir already exists here, so I don't see a practical issue.
  • A failed exec (error_type, e.g. a timeout) now fails stage with RuntimeError. Before,
    any failure to resolve or link fell back to running python3 directly. Should an exec error
    fall back too, or is failing loudly preferred?
  • Each activation now makes one more exec round trip (up to 30 s).

@weijiac0619

Copy link
Copy Markdown
Contributor

could you add pool_agent to the description?

@yaoyu-33

yaoyu-33 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

/ok to test 4297ada

@copy-pr-bot

copy-pr-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

/ok to test 4297ada27c

@yaoyu-33, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@yaoyu-33

yaoyu-33 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 4297ada

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 6, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42304790842

Merged via the queue into main with commit 0283487 Nov 6, 2026
68 checks passed
@yaoyu-33
yaoyu-33 deleted the codex/remove-stdlib-runner branch November 6, 2026 22:41
@ananthsub ananthsub mentioned this pull request Nov 10, 2026
3 of 6 tasks
yaoyu-33 added a commit that referenced this pull request Nov 10, 2026
SandboxCommand lost its stdlib_runner field on main (#5327); the staging test still asserted it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
fernandol-nvidia pushed a commit to fernandol-nvidia/Gym that referenced this pull request Nov 10, 2026
…NVIDIA-NeMo#5654)

* feat(mini-swe): run mini-SWE in task sandboxes through agent sessions

mini_swe_agent now serves agent sessions next to its SWE-Gym /run path. A session runs
mini-SWE 2.4.6 in the sandbox the Resources Server lends, or in one the agent starts from
sandbox_provider, supervised by SandboxSession. The runtime is built on the agent server
with SandboxPythonRuntime from a full lock (runtime/requirements.txt), uploaded at seed,
checked for its version before reuse, and published atomically; the sandbox needs no
network. SandboxPythonRuntime takes that lock as constraints instead of the agent
server's environment, which keeps the fork /run uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): connect a task MCP server Harbor also grants once

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* feat(mini-swe): document agent sessions; quiet the runtime check and trim logs in the sandbox

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): keep the submission output and report MCP calls only in the response

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* docs(mini-swe): state the Ray requirement and the runtime's measured size

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* refactor(mini-swe): spell new identifiers mini_swe

The metadata keys, observation source and tool-call variable this PR adds follow the upstream distribution name
(mini-swe-agent); miniswe stays only in the deprecated variant and upstream's import package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* feat(mini-swe): serve agent sessions from an entrypoint without Ray

app.py declares ray_enabled for the SWE-Gym /run pipeline, so Gym started
Ray for the session template too and required the ray extra where gym
runs. sessions_app.py serves the same agent with ray_enabled = False and
refuses /run; the session template starts it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): harden session outcomes, MCP call records and seed refusals

- List sessions_app.py's Ray opt-out in the Ray inventory test, so core CI
  accepts MiniSWESessionsAgent's ray_enabled = False.
- Report only mcp_calls.jsonl records for the run's MCP servers; count the
  malformed or foreign lines as an mcp_call_record_invalid gap instead of
  failing collection, and read no records in a run without MCP servers.
- Leave the function calls of a response mini-SWE rejected for its format out
  of the response output; they never ran. The model call and usage stay.
- Fail a run that reached its deadline before any model call returned as a
  model transport error (Timeout), unless a rollout stop ended it.
- Report a run that close stopped as cancelled, not killed, when the
  activation returns before close cancels it.
- Refuse request tools that no MCP server can reach (422), and refuse a
  task.json that is not a JSON object or a task MCP server without a name as
  final seed errors.
- Read an existing task.json that cannot be read as a failure, not as absent.
- Keep mini-SWE's config directory in the import check's own HOME.
- Save the trajectory before each step's commands run, so a command that
  kills the runner leaves the model call; decode MCP CLI output with
  errors="replace".
- Report an MCP server whose tool listing fails like one that did not
  connect, instead of failing the whole listing.
- Require the task workdir to be disjoint from the session directory.
- Build the runtime for the real mini-SWE and MCP tests in conftest.py when
  uv is on PATH; add tests for the HTTP session lifecycle, close order,
  disconnected waiters, Harbor task transports, MCP authentication over both
  HTTP transports, background processes, and the cases above.
- README: claim Evaluation until Harness Conformance runs mini-SWE, describe
  the other mini-SWE session adapter, pairings and limits, and the new
  outcomes; list mini-SWE as a resolve_agent_timeout user in the harness docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): keep failed MCP calls, report unknown usage, scrub saved model settings

- Keep mcp_calls.jsonl records for servers the run was not granted: the MCP
  CLI records the model's call to such a server as a failed call, so it is
  part of the run rather than an invalid record.
- Report usage as unknown when mini-SWE counted more model calls than it
  saved responses (a call that a stop or a failure interrupted).
- Validate only the last request's input when building the observed
  conversation, instead of every prefix, which was quadratic in the steps.
- Leave the rollout's model URL, capture key and API key out of the saved
  trajectory, which the model's commands can read.
- Map LiteLLM's PaymentRequiredError to HTTP 402.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): preserve seed errors and deadline evidence

Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): reject unsupported response token budgets

Signed-off-by: yaoyu-33 <[email protected]>

* test(mini-swe): drop the stdlib_runner assertion that main removed

SandboxCommand lost its stdlib_runner field on main (NVIDIA-NeMo#5327); the staging test still asserted it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): type model failures by HTTP status and bound MCP evidence

- Record the HTTP status on the LiteLLM exception that ended the run and type the failure from it. LiteLLM
  1.106.0 raises APIError for a 402, 403, 409, 413 or 425 answer (typed as a transport error and retried
  before) and BadRequestError for a 422 (reported as 400); subclasses missing from the name map, such as
  ContentPolicyViolationError, were an HTTP 500.
- End the run incomplete as a context limit when mini-SWE gives up on format errors after Gym's vLLM Model
  Server answered with its empty reply marked nemo_gym_context_window_exceeded; it was failed with
  agent_invalid_output.
- Refuse a tool_choice other than auto or required with HTTP 422: the model is offered only the bash tool.
- Keep each required MCP server's connect error in the failure, and report optional servers that did not
  connect as an mcp_server_unavailable gap.
- Do not read an MCP record file over 16 MiB (an mcp_call_records_unavailable gap), and keep at most 64 KiB of
  each call's output in the response.
- Add the usage_unavailable gap whenever a model call was made, including when none saved a response.
- Correct the MCP record comment, and document that the session files are writable by the model's commands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): keep the supervisor out of pkill python and offer network_access

- Launch the runner through the runtime's interpreter linked into the session directory as bin/mini-swe. The
  supervisor's command line carries the runner's argv, so a task's `pkill -9 -f python` killed the supervisor
  itself: no receipt, a retried episode for the model's own action, and a borrowed close that never became
  final. The runner and its MCP CLI now run under that name too.
- Offer network_access for a sandbox the agent starts (restrict_sandbox_network with the Model Server and the
  MCP grant hosts), and refuse any value but inherit for a borrowed sandbox; the key was silently ignored.
- The MCP CLI now closes its server sessions on SIGTERM, which stops the stdio servers a task declares (the SDK
  starts them in sessions of their own). The runner also stops a CLI whose startup failed.
- Refuse with HTTP 422 a sandbox whose glibc is older than 2.28, which the runtime's LiteLLM wheels need; it was a
  retried HTTP 500. Export probe_sandbox_platform from nemo_gym.agents for this.
- Cap the runner error and MCP listing text in activation errors.
- Tests: the runtime tests fail loudly when uv is missing instead of skipping; new tests for each change above.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(mini-swe): honor per-call token caps and deprecate the older adapter

Start supervisor cleanup grace after TERM so a slow initial process scan cannot consume the checkpoint window. Preserve legacy configs and document task-user migration limits.

Signed-off-by: yaoyu-33 <[email protected]>

---------

Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: weijia chen <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 4297ada2 Deployed Nov 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #10762
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sandbox Sandbox providers, isolation, and sandbox runtime contracts blocked Work cannot move forward until an external dependency is cleared feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants