Repository navigation
Conversation
360f248 to
d87fd1b
Compare
caa5866 to
0ca054d
Compare
d87fd1b to
ec2cb9b
Compare
1a7d02a to
cc5fd6c
Compare
c4e41c6 to
f444bcc
Compare
cc5fd6c to
c199385
Compare
f444bcc to
7c8a8d3
Compare
4aade10 to
ac39be0
Compare
7c8a8d3 to
b025138
Compare
ac39be0 to
8646d47
Compare
b025138 to
531e64d
Compare
|
|
||
| # Sandbox providers whose processes share the host network namespace, so a loopback model URL still resolves | ||
| # to the host. Docker only does so when the daemon runs on the host and the container uses host networking. | ||
| _HOST_NETWORK_SANDBOX_PROVIDERS = frozenset({"local"}) |
There was a problem hiding this comment.
This guard breaks existing Apptainer and Enroot users. A Slurm user running Hermes (or miniSWE) with sandbox_provider: apptainer and the default loopback model URL worked before this PR and now fails every seed with "loopback address ... cannot reach". Neither provider creates a network namespace: Apptainer starts the instance without --net (nemo_gym/sandbox/providers/apptainer/provider.py:446-462) and Enroot only mounts and sets the environment (providers/enroot/provider.py:478-504), so 127.0.0.1 inside them is the host. The guard also misses 0.0.0.0, which inside a remote sandbox is the sandbox itself. Could both be handled, and the change noted under compatibility?
Suggested fix:
_HOST_NETWORK_SANDBOX_PROVIDERS = frozenset({"local", "apptainer", "enroot"})
...
ip = ipaddress.ip_address(host)
return ip.is_loopback or ip.is_unspecified| return parts[1] | ||
|
|
||
|
|
||
| def _download_uv(version: str, target: str, destination: Path) -> None: |
There was a problem hiding this comment.
The uv download is not verified. The release archive is fetched and later executed inside the sandbox without checking the .sha256 file uv publishes next to each archive, and air-gapped compute nodes have no mirror setting. Also, the architecture check (around line 617) compares only uname -m, so on an x86_64 macOS host the Mach-O binary is reused for a Linux sandbox, and an empty probe silently falls back to the host binary. Could the download verify the checksum, accept a base-URL override, and reuse the host binary only when sys.platform == "linux" and the probe succeeded? (_host_uv_version also needs errors="replace" per CLAUDE.md.)
| workdir = body.sandbox_access.workdir | ||
|
|
||
| provider_config = resolve_provider_config(provider_ref, get_global_config_dict()) | ||
| # The runner inside the sandbox calls the Model Server itself, so a loopback URL (the default |
There was a problem hiding this comment.
Question for the Harbor path this stack opens: Hermes bounds its run by sandbox_runner_timeout_seconds (21600 s by default) and never reads the row's agent_timeout_sec, so a task with [agent].timeout_sec = 900 can run far longer than in Harbor, or until the sandbox's lifetime ends mid-episode. Terminus 2 and miniSWE already use the row's value. Could Hermes take the smaller of the two, or should the README note that this waits for RFC M19?
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Two additional, nonblocking follow-ups on concurrent downloads and setup documentation.
| version = await asyncio.to_thread(_host_uv_version, host_uv) | ||
| cached = Path(self.config.uv_cache_dir).expanduser() / version / target / "uv" | ||
| if not cached.is_file(): | ||
| await asyncio.to_thread(_download_uv, version, target, cached) |
There was a problem hiding this comment.
Nonblocking: share the initial uv download between concurrent sessions. Could we serialize cache population per version/target and recheck the file after acquiring the lock? With an empty cache, each session can pass cached.is_file() before the first download completes and start its own download. In a focused reproduction with the downloader stubbed, eight overlapping _uv_for_sandbox calls invoked it eight times. os.replace protects the completed file but does not share the download. The existing test checks sequential reuse; a concurrent test would cover this startup case.
| sandbox_install_timeout_seconds: float = Field(default=900, gt=0, allow_inf_nan=False) | ||
| sandbox_runner_timeout_seconds: float = Field(default=21600, gt=0, allow_inf_nan=False) | ||
| # Where uv builds for sandbox architectures other than the host's are cached. | ||
| uv_cache_dir: str = "~/.cache/nemo_gym/uv" |
There was a problem hiding this comment.
Nonblocking: update the Hermes setup documentation for this capability. Could we update the README's sandbox-mode requirements and configuration table alongside this change? The current requirements still require matching host/sandbox CPU architectures, and the table does not list uv_cache_dir. Please document the supported GNU/Linux targets, the cache option, and the agent host's need to reach GitHub releases when the matching binary is not cached.
8646d47 to
f2f7002
Compare
531e64d to
6436b17
Compare
Adds `resources_servers/harbor` (M2 of the Harbor tasks RFC), serving the tasksets the loader materializes: - `/seed_session` checks the row digest against the taskset mapping and the folder on disk, starts the task image as a sandbox sized from `task.toml`, creates the working directory, and returns a `SandboxAccess` for the agent. - `/verify` uploads `tests/` into the same sandbox (Harbor's shared verifier mode), runs `bash /tests/test.sh` under `[verifier]` timeout and env, and reads `/logs/verifier/reward.json` or `reward.txt` with Harbor's key rule. - `/close_session` stops the sandbox; shutdown stops what is left. Reward rule: a run of `test.sh` is a measurement, so a missing or invalid reward scores 0 with a `failure_kind`; only Gym-side failures mask the sample. Sandbox creation failures surface as 503 so the collector can retry. The generated run config now inherits the shipped `harbor_resources_server` block instead of spelling out server settings. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
The Episode Architecture stack removed `ResourcesVerifyResponse` and lets each resources server declare its own verify response. `HarborVerifyResponse` types what the Harbor verifier adds to the base fields: the parsed `reward.json`, the `test.sh` exit code and the downloaded logs folder. Without the declaration Pydantic would drop them silently. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…e event loop - shared-mode prepare runs as root so non-root images verify - /verify holds the session lock and replays its stored outcome on a retry - folder digest and archive work run in a thread, parsed tasks cached per digest - invalid reward.json falls back to reward.txt, reward files decoded with errors="replace" Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
main now requires every shipped server class to set ray_enabled. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
main now requires every resources server to describe its dataset rows. A Harbor row's only task-owned field is the folder digest the server checks against its taskset mapping; the wire key `_ng_digest` is reached by alias because pydantic forbids leading-underscore field names. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
The row's verifier_logs_dir was the configured artifacts_dir joined with the session id, relative when the config was relative. The server process runs from its own folder, so the recorded path did not resolve from the directory the run was launched in. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…bor tasks Adds `responses_api_agents/oracle_agent` (M3 of the Harbor tasks RFC). The oracle is an ordinary agent harness that runs a task's reference solution instead of a model: it borrows the sandbox the `harbor` resources server seeded, locates the task folder through that server's taskset mapping in the run config, checks the digest, uploads `solution/` and runs `solve.sh` in the task's working directory as the task's agent user. Verification then scores the result like any rollout. Tasks without `solution/solve.sh` return a response tagged `oracle=unvalidated` and are never failed. `gym dataset validate <folder | harbor:dataset> [--sandbox <provider>]` prepares the taskset, runs it with the oracle through the normal end-to-end collection (with a placeholder policy model block, since the oracle calls no model), and prints one line per task with its reward or why there is none. It exits non-zero when a validated task scores below 1.0, is masked, or fails. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
Rollout collection now stores an environment server's result as returned: the row is the verify response itself with the collector's `_ng_task_id` stamp, and an episode that failed before verification is a failures-sidecar row. `gym dataset validate` reads both. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
In-sandbox harnesses call the Gym model server from the container, where 127.0.0.1 is the container itself. The generated run config now sets use_absolute_ip for agents that run inside the sandbox unless the caller set it, so the documented command works on remote providers. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
main now requires every shipped server class to set ray_enabled. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…ugh the base hooks) main's session contract (#3784) makes the base agent own seed and close bookkeeping; an agent implements only _seed_agent_session_state and _close_agent_session_state. The oracle agent keeps its behavior (sandbox connect at seed, disconnect at close, 404 for an unseeded /v1/responses) but no longer overrides the routes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
Hermes installs its sandbox runtime by uploading the agent host's `uv` binary. When the host and the sandbox differ in CPU architecture (an aarch64 login node driving x86_64 OpenSandbox nodes) the binary cannot run and every session fails at install. Probe `uname -m` in the sandbox first; reuse the host binary when the architectures match, otherwise fetch the host's uv version for the sandbox target from the uv release archive once into `uv_cache_dir` and upload that. Part of the Harbor tasks PoC (M4): Hermes borrowing Harbor sandboxes. Signed-off-by: Adil Asif <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…up test main added test_failed_setup_retains_handle_until_cleanup_confirmed with four fake sandbox execs. M4 probes the sandbox architecture with one more exec before installing, so the sequence needs five. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
Inside a container on OpenSandbox or E2B, 127.0.0.1 is the container itself, so a Hermes run with the default model URL scores 0 without being masked. Seeding now fails with the fix named (++use_absolute_ip=true or a reachable model URL). Local Docker only warns. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
f2f7002 to
762ed7b
Compare
6436b17 to
efc6f7c
Compare
5c0a1dd to
e567c71
Compare
|
Superseded. The uv architecture fix landed on main through #4270 (shared |
What does this PR do?
M4 of the Harbor tasks RFC: let Hermes borrow Harbor sandboxes from a host whose CPU architecture differs from the sandbox's.
Rebased onto main 128eab4 (2026-10-04). The review fixes from that date are listed below.
Hermes installs its sandbox runtime by uploading the agent host's
uvbinary. On an aarch64 login node driving x86_64 OpenSandbox nodes that binary cannot run and every session fails at install. This PR probesuname -min the sandbox first. When the architectures match it reuses the host binary. Otherwise it fetches the host's uv version for the sandbox target from the uv release archive once intouv_cache_dir(default~/.cache/nemo_gym/uv) and uploads that.Review fixes (2026-10-04)
3c299caa2 test(hermes): account for the uv architecture probe in the failed-setup test:mainaddedtest_failed_setup_retains_handle_until_cleanup_confirmedwith four fake sandbox execs. The architecture probe adds one exec before install, so the sequence now has five.531e64d6b fix(hermes): refuse a loopback model URL on remote sandboxes: newis_loopback_hostandassert_model_url_reachable_from_sandboxinnemo_gym/base_responses_api_agent.py. Hermes calls the check at seed time with the resolved Model Server URL and the sandbox provider name. On a remote provider (OpenSandbox, E2B, Daytona) a loopback URL fails seeding with the fix named:++use_absolute_ip=trueor a reachable model URL. Thelocalprovider passes anddockeronly warns. Before this a run with the default URL scored 0 without being masked.Validation
pytest responses_api_agents/hermes_agent/tests(228 tests, new in this PR: same-arch reuse, cross-arch download once, unknown arch, missing uv, version parsing, archive extraction, loopback URL refused on a remote provider, loopback allowed with a warning on local Docker).pytest tests/unit_tests/test_base_responses_api_agent.py(loopback detection for IPv4, IPv6 andlocalhost, unparseable hosts, the per-provider raise, warn or pass rule).pre-commit run --files <changed files>clean.Rollouts
Hermes on
harbor:hello-worldfrom an aarch64 host to x86_64 OpenSandbox nodes: runtime installed, 3 tool calls, reward 1.0 (details in #3677).Compatibility and benchmark impact
Same-architecture hosts behave exactly as before (host binary reused, one extra
uname -mexec per session). New optional configuv_cache_dir. A Hermes session on a remote sandbox provider with a loopback Model Server URL now fails at seed instead of scoring 0.gym eval runon a Harbor target already setsuse_absolute_ipfor Hermes (#3675). Other launchers pass++use_absolute_ip=trueor a reachable model URL.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code