feat(sdk): add sandbox lifecycle hook models - #1588
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7f216dff2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| lifecycle: | ||
| $ref: '#/components/schemas/SandboxLifecycle' |
There was a problem hiding this comment.
Implement server handling before advertising lifecycle hooks
Any client that sends this newly documented field to the server in this commit gets a successful sandbox without the requested hooks: server/opensandbox_server/api/schema.py:391-493 has no lifecycle field, so Pydantic ignores it, and the create route proceeds with the stripped request. This can run the user entrypoint without the advertised restore hook and never schedule checkpoints while returning 202; add the server schema and runtime transport in the same change, or defer exposing the contract.
AGENTS.md reference: specs/AGENTS.md:L49-L52
Useful? React with 👍 / 👎.
| resource_requests: ResourceLimits | Unset = UNSET | ||
| env: CreateSandboxRequestEnv | Unset = UNSET | ||
| metadata: CreateSandboxRequestMetadata | Unset = UNSET | ||
| lifecycle: SandboxLifecycle | Unset = UNSET |
There was a problem hiding this comment.
Plumb lifecycle hooks through the stable Python and Kotlin APIs
When callers use the normal Python Sandbox.create or Kotlin Sandbox/Sandboxes.createSandbox APIs, there is no lifecycle parameter, and their converters never populate this generated field (sandbox_model_converter.py:170-185,310-317 and SandboxModelConverter.kt:252-283). Consequently only direct construction of internal generated-client models can send hooks, unlike the JavaScript SDK's public create request; add stable lifecycle models, create parameters, converter mappings, and focused request tests for both SDKs.
AGENTS.md reference: sdks/AGENTS.md:L117-L123
Useful? React with 👍 / 👎.
Summary
CreateSandboxRequest.lifecyclemodel to the lifecycle API specification.preStartandperiodichooks in this phase.This is the SDK and API Spec part of OSEP-0020 (#1542) and complements the execd implementation in #1587. Server integration will be submitted separately. Docker, PATCH, and other lifecycle hooks are intentionally out of scope.
Testing
Validated:
SandboxLifecycleModelsTest: passedBreaking Changes
Checklist