Skip to content

feat(volume): add host and pvc volume types to OpenAPI spec#166

Merged
ninan-nn merged 10 commits intoalibaba:mainfrom
hittyt:feat/volume-openspec
Feb 6, 2026
Merged

feat(volume): add host and pvc volume types to OpenAPI spec#166
ninan-nn merged 10 commits intoalibaba:mainfrom
hittyt:feat/volume-openspec

Conversation

@hittyt
Copy link
Copy Markdown
Collaborator

@hittyt hittyt commented Feb 3, 2026

Summary

Implements the OpenSpec definition for host and pvc volume backends as described in OSEP-0003. This includes:

  • OpenAPI schema definitions for Volume, HostBackend, PVCBackend, AccessMode
  • Server-side Pydantic models with validation
  • Comprehensive validator functions for volume configurations
  • Volume-related error codes
  • Auto-generated SDK models

The proposal status is updated to 'implementing'.

Refs: OSEP-0003

Testing

  • Not run (explain why)
  • Unit tests
  • Integration tests
  • e2e / manual verification

Breaking Changes

  • None
  • Yes (describe impact and migration path)

Checklist

  • Linked Issue or clearly described motivation need mount a local file directory #110
  • Added/updated docs (if needed)
  • Added/updated tests (if needed)
  • Security impact considered
  • Backward compatibility considered

Implements the OpenSpec definition for host and pvc volume backends
as described in OSEP-0003. This includes:

- OpenAPI schema definitions for Volume, HostBackend, PVCBackend, AccessMode
- Server-side Pydantic models with validation
- Comprehensive validator functions for volume configurations
- Volume-related error codes
- Unit tests for schema models and validators (73 tests)
- Auto-generated SDK models

The proposal status is updated to 'implementing'.

Refs: OSEP-0003
@Pangjiping Pangjiping added documentation Improvements or additions to documentation feature New feature or request component/k8s For kubernetes runtime labels Feb 3, 2026
@hittyt hittyt mentioned this pull request Feb 4, 2026
11 tasks
Add retry mechanism and initialization delay to reduce flaky test
failures in multi-language context tests:

- Add run_with_retry helper with exponential backoff (max 3 retries)
- Add 0.2s delay after context creation for kernel initialization
- Apply retry logic to test_06 cross-language execution tests

This addresses intermittent failures where execution returns empty
results due to kernel not being fully ready.
Improve test stability by catching and retrying on network errors:

- Add exception handling for RemoteProtocolError, connection reset, etc.
- Add create_context_with_retry helper for context creation
- Increase initial retry delay to 2s for better recovery
- Add cleanup retry in managed_ctx to handle server disconnects
- Detect retryable errors by checking error message keywords

This addresses CI failures where the server disconnects mid-request.
Increase sleep from 5ms to 2000ms to allow NetworkPolicy sidecar
to fully initialize before testing egress rules.

The previous 5ms delay was insufficient for the sidecar to be ready,
causing curl to github.com to succeed when it should have been blocked.
Comment thread specs/sandbox-lifecycle.yml Outdated
Comment thread server/src/services/validators.py Outdated
Comment thread server/src/services/validators.py
Comment thread specs/sandbox-lifecycle.yml Outdated
Implement high-level volume support in all three SDKs:

Python SDK:
- Add HostBackend, PVCBackend, Volume domain models with validation
- Add model_validator for exactly-one-backend constraint
- Update Sandbox.create() with volumes parameter
- Add unit tests for Volume models

Kotlin SDK:
- Add AccessMode, HostBackend, PVCBackend, Volume domain models
- Add Volume.Builder with validation
- Update Sandbox.Builder with volume() and volumes() methods
- Add VolumeModelsTest unit tests

JavaScript/TypeScript SDK:
- Add AccessMode, HostBackend, PVCBackend, Volume type definitions
- Update SandboxCreateOptions with volumes parameter
- Export new types from index.ts

CI:
- Add sdk-unit-tests.yml workflow for SDK unit tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread sdks/sandbox/javascript/src/sandbox.ts
hittyt and others added 4 commits February 5, 2026 19:02
API Changes:
- Rename HostBackend -> Host, PVCBackend -> PVC (remove Backend suffix)
- Replace accessMode enum (RW/RO) with readOnly boolean (default false)

Validation Improvements:
- Simplify host path validation: remove os.path.normpath usage
- Directly reject path traversal (..) and non-normalized paths (//)
- Clearer error messages

Updates across:
- OpenAPI spec (sandbox-lifecycle.yml)
- Server schema and validators
- Python, Kotlin, JavaScript SDKs
- OSEP design document
- All related tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Add volumes=None to test calls that were missing the new required parameter.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add missing volumes parameter to:
- SandboxSync.create()
- SandboxesSync protocol
- SandboxesAdapterSync.create_sandbox()

This fixes the E2E test failures where the sync SDK was missing
the volumes parameter that was added to the async SDK.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pangjiping
Pangjiping previously approved these changes Feb 6, 2026
Copy link
Copy Markdown
Collaborator

@Pangjiping Pangjiping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Regenerate OpenAPI types with Volume, Host, PVC definitions
- Add mutual exclusivity validation for volume backends in Sandbox.create()

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Collaborator

@ninan-nn ninan-nn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ninan-nn ninan-nn merged commit 7bc1675 into alibaba:main Feb 6, 2026
10 checks passed
@hittyt hittyt deleted the feat/volume-openspec branch February 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/k8s For kubernetes runtime documentation Improvements or additions to documentation feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants