Repository navigation
feat(opensandbox): derive connection.protocol from a scheme in connection.domain - #3137
Merged
Merged
Conversation
Contributor
|
🌿 Preview your docs: https://nvidia-preview-hemild-opensandbox-protocol-from-domain.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
hemildesai
force-pushed
the
hemild/opensandbox-protocol-from-domain
branch
from
September 6, 2026 21:19
508f7e2 to
d7219fa
Compare
…tion.domain OpenSandboxConnectionConfig now accepts a domain that carries its scheme (https://sandbox.example). The scheme becomes connection.protocol and the bare host is what reaches the SDK, so an https endpoint no longer needs a separate ++sandbox.opensandbox.connection.protocol=https override. A scheme in the domain takes precedence over protocol (the shipped yaml always sets protocol: http). Schemes other than http/https and scheme-only domains are rejected. The SDK already lets a scheme in its own domain override protocol for its base URL, but the provider builds the PTY WebSocket URL from connection.protocol directly, so normalizing at the Gym config level keeps the SDK transport, the PTY path and cleanup_sandboxes.py consistent. Signed-off-by: Hemil Desai <[email protected]>
hemildesai
force-pushed
the
hemild/opensandbox-protocol-from-domain
branch
from
September 6, 2026 21:43
d7219fa to
3d31c04
Compare
bxyu-nvidia
marked this pull request as ready for review
September 6, 2026 22:17
Contributor
|
/ok to test 3d31c04 |
Contributor
Author
|
End-to-end check of this branch (3d31c04) on a live OpenSandbox cluster behind a self-signed
Not covered here: the PTY path (this benchmark uses the exec path), which is exercised only by the unit test asserting |
bxyu-nvidia
approved these changes
Sep 6, 2026
jkyi-nvidia
pushed a commit
that referenced
this pull request
Sep 11, 2026
…tion.domain (#3137) ## What does this PR do? Lets `sandbox.opensandbox.connection.domain` carry its scheme. When the domain is `https://sandbox.example` (or `OPENSANDBOX_DOMAIN=https://sandbox.example`), the provider now derives `connection.protocol: https` from it and hands the SDK the bare host, so an `https` endpoint no longer needs a separate `++sandbox.opensandbox.connection.protocol=https` override on top of #3104's `tls_verify`. Behaviour: - A scheme in the domain **takes precedence** over `connection.protocol`. The shipped `opensandbox.yaml` always sets `protocol: http`, so precedence the other way would make the common case (yaml default + `https://` domain) silently talk plain HTTP. - Any path prefix in the domain is kept (`https://host/prefix` → domain `host/prefix`, protocol `https`); the SDK appends `/v1` as before. - Only `scheme://host[:port][/path-prefix]` is accepted: schemes other than `http`/`https`, scheme-only domains (`https://`), and domains carrying a query string or fragment raise a `ValueError` at config time (before this change a `?token=...` in the domain reached the SDK and produced an unroutable `.../prefix?token=abc/v1`). - Surrounding whitespace is stripped from every domain, scheme or not (an `OPENSANDBOX_DOMAIN` read with a trailing newline previously reached the SDK verbatim and failed URL parsing on the first request; `cleanup_sandboxes.py` already did this). - Bare hosts are otherwise unchanged: `protocol` still applies as before. Why normalize in Gym rather than rely on the SDK: the OpenSandbox SDK already lets a scheme in *its* domain override `protocol` when it builds its own base URL, but the provider builds the PTY WebSocket URL from `connection.protocol` directly, so a scheme-in-domain config previously produced an `https` REST transport and an `http` PTY URL. Normalizing once in `OpenSandboxConnectionConfig.__post_init__` keeps the SDK transport, the PTY path and `cleanup_sandboxes.py` (which already accepted a scheme in `--domain`) consistent. Files: `provider.py` (new module-level helper `split_domain_scheme(domain) -> (domain, scheme)` used by a three-line `__post_init__`; `OpenSandboxConnectionConfig` drops `frozen=True` so it can assign its own fields — nothing hashes or replaces it), `opensandbox.yaml` (comment), `opensandbox.mdx` and `opensandbox-best-practices.mdx` (docs), `test_opensandbox_provider.py` (new tests; one existing assertion updated from pass-through to normalized form). ## Usage ```bash export OPENSANDBOX_DOMAIN=https://sandbox.example.internal # scheme included export OPENSANDBOX_API_KEY=... gym run \ --config resources_servers/swebench/configs/swebench.yaml \ --config nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml \ ++sandbox.opensandbox.connection.tls_verify=false # self-signed endpoint; default ``` Previously this also required `++sandbox.opensandbox.connection.protocol=https`. ## Testing - `pytest tests/unit_tests/test_opensandbox_provider.py` — 59 passed (3 new tests: the helper directly, normalization/precedence/whitespace/error cases, and the derived protocol reaching the SDK kwargs and the provider's PTY protocol). - Reviewed with an adversarial two-dimension pass (correctness, design); the four confirmed low-severity findings (query/fragment silently dropped, whitespace stripped only for scheme'd domains, docstring rationale, sibling docs page) are addressed in this revision. - `pre-commit run --files <changed files>` clean. - End-to-end on a live OpenSandbox cluster behind a self-signed `https://` load balancer (SWE-bench Verified, 1024 parallel, this branch): `OPENSANDBOX_DOMAIN=https://<host>`, the shipped `protocol: http`, **no** `++sandbox.opensandbox.connection.protocol=https` override. Sandbox creation: 0 failures, 0 SSL errors, 0 connection errors; rollouts progressed normally. The same launch on a tree without this change fails every create on port 80 within a minute. ## Checklist - [x] The change is focused. - [x] Tests added or updated and pass locally. - [x] Pre-commit checks pass locally. - [x] All commits have DCO sign-off. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Hemil Desai <[email protected]> Signed-off-by: Junkeun Yi <[email protected]>
lafrancef
pushed a commit
that referenced
this pull request
Sep 18, 2026
…tion.domain (#3137) ## What does this PR do? Lets `sandbox.opensandbox.connection.domain` carry its scheme. When the domain is `https://sandbox.example` (or `OPENSANDBOX_DOMAIN=https://sandbox.example`), the provider now derives `connection.protocol: https` from it and hands the SDK the bare host, so an `https` endpoint no longer needs a separate `++sandbox.opensandbox.connection.protocol=https` override on top of #3104's `tls_verify`. Behaviour: - A scheme in the domain **takes precedence** over `connection.protocol`. The shipped `opensandbox.yaml` always sets `protocol: http`, so precedence the other way would make the common case (yaml default + `https://` domain) silently talk plain HTTP. - Any path prefix in the domain is kept (`https://host/prefix` → domain `host/prefix`, protocol `https`); the SDK appends `/v1` as before. - Only `scheme://host[:port][/path-prefix]` is accepted: schemes other than `http`/`https`, scheme-only domains (`https://`), and domains carrying a query string or fragment raise a `ValueError` at config time (before this change a `?token=...` in the domain reached the SDK and produced an unroutable `.../prefix?token=abc/v1`). - Surrounding whitespace is stripped from every domain, scheme or not (an `OPENSANDBOX_DOMAIN` read with a trailing newline previously reached the SDK verbatim and failed URL parsing on the first request; `cleanup_sandboxes.py` already did this). - Bare hosts are otherwise unchanged: `protocol` still applies as before. Why normalize in Gym rather than rely on the SDK: the OpenSandbox SDK already lets a scheme in *its* domain override `protocol` when it builds its own base URL, but the provider builds the PTY WebSocket URL from `connection.protocol` directly, so a scheme-in-domain config previously produced an `https` REST transport and an `http` PTY URL. Normalizing once in `OpenSandboxConnectionConfig.__post_init__` keeps the SDK transport, the PTY path and `cleanup_sandboxes.py` (which already accepted a scheme in `--domain`) consistent. Files: `provider.py` (new module-level helper `split_domain_scheme(domain) -> (domain, scheme)` used by a three-line `__post_init__`; `OpenSandboxConnectionConfig` drops `frozen=True` so it can assign its own fields — nothing hashes or replaces it), `opensandbox.yaml` (comment), `opensandbox.mdx` and `opensandbox-best-practices.mdx` (docs), `test_opensandbox_provider.py` (new tests; one existing assertion updated from pass-through to normalized form). ## Usage ```bash export OPENSANDBOX_DOMAIN=https://sandbox.example.internal # scheme included export OPENSANDBOX_API_KEY=... gym run \ --config resources_servers/swebench/configs/swebench.yaml \ --config nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml \ ++sandbox.opensandbox.connection.tls_verify=false # self-signed endpoint; default ``` Previously this also required `++sandbox.opensandbox.connection.protocol=https`. ## Testing - `pytest tests/unit_tests/test_opensandbox_provider.py` — 59 passed (3 new tests: the helper directly, normalization/precedence/whitespace/error cases, and the derived protocol reaching the SDK kwargs and the provider's PTY protocol). - Reviewed with an adversarial two-dimension pass (correctness, design); the four confirmed low-severity findings (query/fragment silently dropped, whitespace stripped only for scheme'd domains, docstring rationale, sibling docs page) are addressed in this revision. - `pre-commit run --files <changed files>` clean. - End-to-end on a live OpenSandbox cluster behind a self-signed `https://` load balancer (SWE-bench Verified, 1024 parallel, this branch): `OPENSANDBOX_DOMAIN=https://<host>`, the shipped `protocol: http`, **no** `++sandbox.opensandbox.connection.protocol=https` override. Sandbox creation: 0 failures, 0 SSL errors, 0 connection errors; rollouts progressed normally. The same launch on a tree without this change fails every create on port 80 within a minute. ## Checklist - [x] The change is focused. - [x] Tests added or updated and pass locally. - [x] Pre-commit checks pass locally. - [x] All commits have DCO sign-off. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Hemil Desai <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Lets
sandbox.opensandbox.connection.domaincarry its scheme. When the domain ishttps://sandbox.example(orOPENSANDBOX_DOMAIN=https://sandbox.example), the provider now derivesconnection.protocol: httpsfrom it and hands the SDK the bare host, so anhttpsendpoint no longer needs a separate++sandbox.opensandbox.connection.protocol=httpsoverride on top of #3104'stls_verify.Behaviour:
connection.protocol. The shippedopensandbox.yamlalways setsprotocol: http, so precedence the other way would make the common case (yaml default +https://domain) silently talk plain HTTP.https://host/prefix→ domainhost/prefix, protocolhttps); the SDK appends/v1as before.scheme://host[:port][/path-prefix]is accepted: schemes other thanhttp/https, scheme-only domains (https://), and domains carrying a query string or fragment raise aValueErrorat config time (before this change a?token=...in the domain reached the SDK and produced an unroutable.../prefix?token=abc/v1).OPENSANDBOX_DOMAINread with a trailing newline previously reached the SDK verbatim and failed URL parsing on the first request;cleanup_sandboxes.pyalready did this).protocolstill applies as before.Why normalize in Gym rather than rely on the SDK: the OpenSandbox SDK already lets a scheme in its domain override
protocolwhen it builds its own base URL, but the provider builds the PTY WebSocket URL fromconnection.protocoldirectly, so a scheme-in-domain config previously produced anhttpsREST transport and anhttpPTY URL. Normalizing once inOpenSandboxConnectionConfig.__post_init__keeps the SDK transport, the PTY path andcleanup_sandboxes.py(which already accepted a scheme in--domain) consistent.Files:
provider.py(new module-level helpersplit_domain_scheme(domain) -> (domain, scheme)used by a three-line__post_init__;OpenSandboxConnectionConfigdropsfrozen=Trueso it can assign its own fields — nothing hashes or replaces it),opensandbox.yaml(comment),opensandbox.mdxandopensandbox-best-practices.mdx(docs),test_opensandbox_provider.py(new tests; one existing assertion updated from pass-through to normalized form).Usage
Previously this also required
++sandbox.opensandbox.connection.protocol=https.Testing
pytest tests/unit_tests/test_opensandbox_provider.py— 59 passed (3 new tests: the helper directly, normalization/precedence/whitespace/error cases, and the derived protocol reaching the SDK kwargs and the provider's PTY protocol).pre-commit run --files <changed files>clean.https://load balancer (SWE-bench Verified, 1024 parallel, this branch):OPENSANDBOX_DOMAIN=https://<host>, the shippedprotocol: http, no++sandbox.opensandbox.connection.protocol=httpsoverride. Sandbox creation: 0 failures, 0 SSL errors, 0 connection errors; rollouts progressed normally. The same launch on a tree without this change fails every create on port 80 within a minute.Checklist
🤖 Generated with Claude Code