Skip to content

feat(sandbox): validate OpenSandbox provider_options via a frozen dataclass - #1713

Merged
kajalj22 merged 1 commit into
ansubramania/sandbox-provider-entry-pointsfrom
ansubramania/sandbox-provider-options-dataclass
Jun 30, 2026
Merged

feat(sandbox): validate OpenSandbox provider_options via a frozen dataclass#1713
kajalj22 merged 1 commit into
ansubramania/sandbox-provider-entry-pointsfrom
ansubramania/sandbox-provider-options-dataclass

Conversation

@ananthsub

@ananthsub ananthsub commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on top of #1712. Addresses the open review thread on #1377 (here) asking whether the individual provider options should be frozen dataclasses so the supported options + validation are discoverable.

Represents the recognized per-sandbox create options (SandboxSpec.provider_options) as a frozen OpenSandboxProviderOptions dataclass with a validating from_mapping:

  • Supported options and their types now live in one place (platform, snapshot_id, volumes, skip_health_check, extensions).
  • Unknown keys and wrong types are rejected with clear errors.
  • The create path reads typed attributes instead of scattered provider_options.get(...) lookups, replacing the ad-hoc _spec_extensions / _provider_option_bool / _spec_volumes helpers.

Design note

SDK-owned nested structures (platform, volumes) are kept as pass-through mappings rather than strictly-typed sub-dataclasses, so their inner fields stay validated by the OpenSandbox SDK and we don't over-constrain options we don't own.

Refs #1377

Test plan

  • uv run pytest tests/unit_tests/test_opensandbox_provider.py tests/unit_tests/test_sandbox.py responses_api_agents/mini_swe_agent_2/tests/test_app.py (40 passed, 11 skipped)
  • uv run ruff check + ruff format --check clean
  • Create-path behavior (platform passthrough, image-pull-policy extensions, skip_health_check) preserved under the fake-SDK tests

@ananthsub
ananthsub requested a review from hemildesai June 24, 2026 09:59
@hemildesai
hemildesai force-pushed the ansubramania/sandbox-provider-options-dataclass branch from d8bd80e to 1c9c9d2 Compare June 26, 2026 22:13
@copy-pr-bot

copy-pr-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

hemildesai
hemildesai previously approved these changes Jun 27, 2026
@hemildesai
hemildesai force-pushed the ansubramania/sandbox-provider-options-dataclass branch from 1c9c9d2 to 0f2fca2 Compare June 27, 2026 05:22
hemildesai
hemildesai previously approved these changes Jun 27, 2026
@hemildesai
hemildesai disabled the stack merge June 29, 2026 16:50
@hemildesai
hemildesai force-pushed the ansubramania/sandbox-provider-options-dataclass branch from 0f2fca2 to f858e6d Compare June 29, 2026 16:50
hemildesai added a commit that referenced this pull request Jun 29, 2026
Signed-off-by: Hemil Desai <hemild@nvidia.com>
hemildesai
hemildesai previously approved these changes Jun 29, 2026
@kajalj22
kajalj22 disabled the stack merge June 30, 2026 16:17
…aclass

Represent the recognized per-sandbox create options (spec.provider_options)
as a frozen OpenSandboxProviderOptions dataclass with a validating
from_mapping, so the supported options and their types are discoverable in
one place and unknown keys are rejected with a clear error. The create path
now reads typed attributes instead of scattered dict lookups.

SDK-owned nested structures (platform, volumes) stay pass-through mappings
so their inner fields remain validated by the OpenSandbox SDK rather than
over-constrained here.

Refs #1377

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
@kajalj22
kajalj22 force-pushed the ansubramania/sandbox-provider-options-dataclass branch from 20e44fb to 3886e93 Compare June 30, 2026 16:25
@kajalj22
kajalj22 merged commit 2508218 into main Jun 30, 2026
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants