You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sandboxed-gym): frame rollout responses and honour an offline environment
Two fixes landed on NeMo-RL's fork of this code while the branch that deletes that
fork sat unmerged. Neither exists here, so completing that consolidation would drop
both -- the exact drift consolidating is meant to end.
Response framing. `/rollouts/run` emits a whitespace heartbeat while a batch runs,
because the body can take minutes and the status line has to leave first. The body
went out under HTTP/1.0 with neither a length nor chunking, delimited only by the
connection closing -- and the OpenSandbox proxy does not wait for that close. It
returned 200 with the lone " " heartbeat as the finished response, and the caller
failed with `JSONDecodeError: Expecting value: line 1 column 1 (char 0)`. Chunked
framing is the delimiter and it is 1.1-only, so the handler moves to 1.1 and takes
only that half: `parse_request` declines connection reuse, which this server gains
nothing from -- a rollout runs for minutes, so a handshake per request rounds to
zero -- and which would cost a real hazard, because an unread request body (the 413
path declines to read one on purpose) is what the server would otherwise parse as
the next request line. Every response is now explicitly framed through one of
`_send_empty`, `_send_body`, `_send_json` or the chunked path. A 1.0 caller cannot
parse chunks, so it gets the batch buffered behind a Content-Length instead: a late
answer is a loud failure where a truncated one is a wrong reward.
Offline environments. `nmp/rl`'s grpo_config already sets `environment_offline` on a
manifest whose wheelhouse is a complete closure, and this package had no such field.
`NemoGymSandboxedConfig` is `extra="forbid"`, so that key does not pass through
unnoticed -- it fails validation, and a sandboxed run with an offline environment
could not start once NeMo-RL consumes this package. The field now exists on both the
caller dialect and the serve config, reaches the host as `NMP_ENVIRONMENT_OFFLINE`,
and sets `UV_OFFLINE` alongside the wheelhouse's `UV_FIND_LINKS`. Index fallback is
otherwise retained, which is a liability only when an index is configured but
unreachable: uv then fails to resolve `uv venv --seed` rather than falling back to
`--find-links`. Not derivable from the package format -- a wheels-v1 package can
ship wheels and still need an index for its agent -- so the caller decides, and an
operator's own `UV_OFFLINE` wins.
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
0 commit comments