Repository navigation
feat(opensandbox): add connection.tls_verify (default off) to the OpenSandbox provider - #3104
Conversation
|
🌿 Preview your docs: https://nvidia-preview-hemild-opensandbox-insecure-tls.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
cc6e1e7 to
af69635
Compare
…nSandbox provider Add connection.tls_verify to the OpenSandbox provider and apply it to every connection the provider opens: the httpx transport, the httpx-aiohttp bridge transport, and the aiohttp client behind each PTY session. It defaults to false, so https endpoints whose certificate the client cannot verify (for example a validation cell behind a self-signed load balancer) work without extra setup; set tls_verify: true for endpoints with a verifiable certificate. The cleanup_sandboxes.py helper mirrors the setting with --tls-verify and reads tls_verify from --connection-config. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Hemil Desai <[email protected]>
af69635 to
b4c7a33
Compare
|
/claude review |
|
/ok to test b4c7a33 |
|
SHIP WITH CARE — the One thing to be deliberate about, not a blocker: RISK — default flips TLS verification from on to off.
No changes required to merge. |
|
Validation run of this branch (
🤖 Generated with Claude Code |
…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]>
…nSandbox provider (#3104) ## Summary Make the OpenSandbox provider usable against an `https://` endpoint whose certificate the client cannot verify, such as the cell-3 validation cluster behind a self-signed load balancer, with a config key only (no environment variable). - New `connection.tls_verify` on the provider, **default `false`**, applied to every connection it opens: the httpx transport, the httpx-aiohttp bridge transport (`transport_backend: aiohttp`, the shipped default), and the aiohttp client behind each PTY WebSocket session. - Set `tls_verify: true` for endpoints with a verifiable certificate. Pair `https` endpoints with `connection.protocol: https`. - `cleanup_sandboxes.py` mirrors the setting: `--tls-verify` flag, or `tls_verify` from `--connection-config`; verification is off by default there too. - Docs and the shipped yaml gain the setting. Note the default: with this change the provider does **not** verify server certificates unless `tls_verify: true` is set. That is the intended behavior for the current deployments (internal endpoints, self-signed certificates); flip the yaml default if the project prefers verification on. ## Usage with an `https://` endpoint Two settings are required for an `https://` endpoint: `connection.protocol=https` (the shipped default is `http`, and without this override nothing works) and `connection.tls_verify=false` (the default) when the certificate is self-signed or otherwise unverifiable. Minimal form, as overrides on the shipped provider config: ```bash gym env start \ --config responses_api_agents/opencode_sandboxed_agent/configs/opencode_sandboxed_agent.yaml \ --config nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml \ --config responses_api_models/vllm_model/configs/vllm_model.yaml \ ++sandbox.opensandbox.connection.domain=https://sandbox.example.internal \ ++sandbox.opensandbox.connection.protocol=https \ ++sandbox.opensandbox.connection.tls_verify=false ``` Or as an override config layered on top of the shipped one (`--config configs/opensandbox_https.yaml` in place of the three `++` lines): ```yaml # configs/opensandbox_https.yaml sandbox: opensandbox: connection: domain: https://sandbox.example.internal # or ${oc.env:OPENSANDBOX_DOMAIN,...} api_key: ${oc.env:OPENSANDBOX_API_KEY} protocol: https # required: the shipped default is http tls_verify: false # default; set true when the certificate chain is verifiable ``` The cleanup helper follows the same setting: ```bash python nemo_gym/sandbox/providers/opensandbox/cleanup_sandboxes.py \ --connection-config configs/opensandbox_https.yaml --run-id <slurm-job-id> --user <user> # protocol and tls_verify from the config python nemo_gym/sandbox/providers/opensandbox/cleanup_sandboxes.py \ --domain https://sandbox.example.internal --protocol https --api-key "$OPENSANDBOX_API_KEY" --tls-verify \ --run-id <slurm-job-id> --user <user> # verification on ``` ## Why Every cell-3 run so far has run from side branches that carried an env-var opt-out; `main` has no way to reach an https endpoint with an unverifiable certificate, so a stock checkout cannot run there. This is the smallest upstreamable piece, expressed as Hydra config so it composes like the other connection settings. ## Test plan - [x] `pytest tests/unit_tests/test_opensandbox_provider.py tests/unit_tests/test_opensandbox_cleanup.py` in a fresh worktree venv with `opensandbox`, `httpx-aiohttp`, `tenacity` installed: 107 passed. New tests: `CERT_NONE` by default and `CERT_REQUIRED` with `tls_verify: true` on both the httpx and bridge transports, the PTY client's connector `ssl` flag following the setting, and the cleanup script's connector with and without `--tls-verify`. - [x] `pre-commit run --files ...` on the changed files. - [x] SWE-bench Verified from this branch against an https endpoint with a self-signed certificate: 1475 rows / 0.7159 mean reward / 1056 resolved at the 2 h wall, no TLS or sandbox errors (details in the comment below). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Hemil Desai <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]> Signed-off-by: Junkeun Yi <[email protected]>
…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]>
## What does this PR do? With `connection.keepalive_expiry_s: null` and `connection.tls_verify: false`, the OpenSandbox provider omitted its configured transport. The SDK then verified certificates anyway, so requests to self-signed HTTPS endpoints failed even though PTY connections honored the same TLS setting. Keep the shared provider transport when certificate verification is disabled, including when keepalive is unset. Preserve the SDK-default path when verification is enabled and pooling remains enabled. This completes the TLS configuration support from #3104 without changing the current TLS default. Adds a 16-case regression matrix across TLS verification, HTTP backend, and pooling settings, and documents when the SDK-default transport is used. ## Validation - Focused sandbox/docs suite: **336 passed, 3 skipped**, plus 20 passing subtests. The regression matrix fails in the two affected cases before the fix. - Real OpenSandbox SDK requests against a local self-signed HTTPS server: all six checks behaved as expected. Both HTTP backends succeed with verification disabled after the fix; verification enabled still rejects the certificate; unchanged main reproduces the failure with verification disabled. - `pre-commit run --all-files`: passed. - `make docs-check`: zero errors; the redirect check is skipped without Fern authentication. - Full core run on macOS in CPU mode: **4,832 passed, 107 skipped, 1 failed**. Unchanged main (`676cf1f4e`) gives **4,816 passed, 107 skipped, 1 failed** with the same Enroot `/proc` failure (`test_create_start_timeout_cleans_up`) and the same **93.07%** aggregate coverage, below the configured gate. The 16 additional tests pass; the changed OpenSandbox provider has **97.90%** coverage. The full-suite checkbox remains unchecked. - Public lint, copyright, secret-scanning and DCO checks passed. Full test CI has not started; per `CONTRIBUTING.md`, an NVIDIA-NeMo member can authorize it with `/ok to test 5fe5bd3`. ## Checklist - [x] I have read the [contributing guidelines](https://docs.nvidia.com/nemo/gym/latest/contribute/development-setup). - [x] The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs. - [ ] Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable). - [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so CI lint/format/copyright pass). - [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check passes). Signed-off-by: Stephen Ge <[email protected]>
…nSandbox provider (#3104) ## Summary Make the OpenSandbox provider usable against an `https://` endpoint whose certificate the client cannot verify, such as the cell-3 validation cluster behind a self-signed load balancer, with a config key only (no environment variable). - New `connection.tls_verify` on the provider, **default `false`**, applied to every connection it opens: the httpx transport, the httpx-aiohttp bridge transport (`transport_backend: aiohttp`, the shipped default), and the aiohttp client behind each PTY WebSocket session. - Set `tls_verify: true` for endpoints with a verifiable certificate. Pair `https` endpoints with `connection.protocol: https`. - `cleanup_sandboxes.py` mirrors the setting: `--tls-verify` flag, or `tls_verify` from `--connection-config`; verification is off by default there too. - Docs and the shipped yaml gain the setting. Note the default: with this change the provider does **not** verify server certificates unless `tls_verify: true` is set. That is the intended behavior for the current deployments (internal endpoints, self-signed certificates); flip the yaml default if the project prefers verification on. ## Usage with an `https://` endpoint Two settings are required for an `https://` endpoint: `connection.protocol=https` (the shipped default is `http`, and without this override nothing works) and `connection.tls_verify=false` (the default) when the certificate is self-signed or otherwise unverifiable. Minimal form, as overrides on the shipped provider config: ```bash gym env start \ --config responses_api_agents/opencode_sandboxed_agent/configs/opencode_sandboxed_agent.yaml \ --config nemo_gym/sandbox/providers/opensandbox/configs/opensandbox.yaml \ --config responses_api_models/vllm_model/configs/vllm_model.yaml \ ++sandbox.opensandbox.connection.domain=https://sandbox.example.internal \ ++sandbox.opensandbox.connection.protocol=https \ ++sandbox.opensandbox.connection.tls_verify=false ``` Or as an override config layered on top of the shipped one (`--config configs/opensandbox_https.yaml` in place of the three `++` lines): ```yaml # configs/opensandbox_https.yaml sandbox: opensandbox: connection: domain: https://sandbox.example.internal # or ${oc.env:OPENSANDBOX_DOMAIN,...} api_key: ${oc.env:OPENSANDBOX_API_KEY} protocol: https # required: the shipped default is http tls_verify: false # default; set true when the certificate chain is verifiable ``` The cleanup helper follows the same setting: ```bash python nemo_gym/sandbox/providers/opensandbox/cleanup_sandboxes.py \ --connection-config configs/opensandbox_https.yaml --run-id <slurm-job-id> --user <user> # protocol and tls_verify from the config python nemo_gym/sandbox/providers/opensandbox/cleanup_sandboxes.py \ --domain https://sandbox.example.internal --protocol https --api-key "$OPENSANDBOX_API_KEY" --tls-verify \ --run-id <slurm-job-id> --user <user> # verification on ``` ## Why Every cell-3 run so far has run from side branches that carried an env-var opt-out; `main` has no way to reach an https endpoint with an unverifiable certificate, so a stock checkout cannot run there. This is the smallest upstreamable piece, expressed as Hydra config so it composes like the other connection settings. ## Test plan - [x] `pytest tests/unit_tests/test_opensandbox_provider.py tests/unit_tests/test_opensandbox_cleanup.py` in a fresh worktree venv with `opensandbox`, `httpx-aiohttp`, `tenacity` installed: 107 passed. New tests: `CERT_NONE` by default and `CERT_REQUIRED` with `tls_verify: true` on both the httpx and bridge transports, the PTY client's connector `ssl` flag following the setting, and the cleanup script's connector with and without `--tls-verify`. - [x] `pre-commit run --files ...` on the changed files. - [x] SWE-bench Verified from this branch against an https endpoint with a self-signed certificate: 1475 rows / 0.7159 mean reward / 1056 resolved at the 2 h wall, no TLS or sandbox errors (details in the comment below). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Hemil Desai <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
…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]>
Summary
Make the OpenSandbox provider usable against an
https://endpoint whose certificate the client cannot verify, such as the cell-3 validation cluster behind a self-signed load balancer, with a config key only (no environment variable).connection.tls_verifyon the provider, defaultfalse, applied to every connection it opens: the httpx transport, the httpx-aiohttp bridge transport (transport_backend: aiohttp, the shipped default), and the aiohttp client behind each PTY WebSocket session.tls_verify: truefor endpoints with a verifiable certificate. Pairhttpsendpoints withconnection.protocol: https.cleanup_sandboxes.pymirrors the setting:--tls-verifyflag, ortls_verifyfrom--connection-config; verification is off by default there too.Note the default: with this change the provider does not verify server certificates unless
tls_verify: trueis set. That is the intended behavior for the current deployments (internal endpoints, self-signed certificates); flip the yaml default if the project prefers verification on.Usage with an
https://endpointTwo settings are required for an
https://endpoint:connection.protocol=https(the shipped default ishttp, and without this override nothing works) andconnection.tls_verify=false(the default) when the certificate is self-signed or otherwise unverifiable. Minimal form, as overrides on the shipped provider config:Or as an override config layered on top of the shipped one (
--config configs/opensandbox_https.yamlin place of the three++lines):The cleanup helper follows the same setting:
Why
Every cell-3 run so far has run from side branches that carried an env-var opt-out;
mainhas no way to reach an https endpoint with an unverifiable certificate, so a stock checkout cannot run there. This is the smallest upstreamable piece, expressed as Hydra config so it composes like the other connection settings.Test plan
pytest tests/unit_tests/test_opensandbox_provider.py tests/unit_tests/test_opensandbox_cleanup.pyin a fresh worktree venv withopensandbox,httpx-aiohttp,tenacityinstalled: 107 passed. New tests:CERT_NONEby default andCERT_REQUIREDwithtls_verify: trueon both the httpx and bridge transports, the PTY client's connectorsslflag following the setting, and the cleanup script's connector with and without--tls-verify.pre-commit run --files ...on the changed files.🤖 Generated with Claude Code