Conversation
195ef2e to
8ed3a0c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ed3a0ccf7
ℹ️ 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".
| requireNotNull(this.image) { | ||
| "Sandbox image is missing from API response. Snapshot-based sandbox responses are not supported by this SDK yet." | ||
| }.toImageSpec(), |
There was a problem hiding this comment.
Handle snapshot-backed sandboxes in converter
The new lifecycle spec allows Sandbox responses that include snapshotId without image, but toSandboxInfo() now unconditionally throws when image is null. In that case getSandboxInfo fails, and listSandboxes will also fail for the entire page as soon as it encounters one snapshot-restored sandbox, which makes the Kotlin SDK unable to interoperate once snapshot restores are used. The converter should map this new response shape instead of hard-failing on missing image.
Useful? React with 👍 / 👎.
| $ref: '#/components/schemas/SnapshotState' | ||
| style: form | ||
| explode: true | ||
| - name: page |
There was a problem hiding this comment.
In Kubernetes, pagination is not supported via label selectors. Does this require support from external storage?
| - `GET /sandboxes/{sandboxId}` - 获取完整沙箱详情(包含镜像与 entrypoint) | ||
| - `GET /sandboxes/{sandboxId}` - 获取完整沙箱详情(包含启动来源与 entrypoint) | ||
| - `DELETE /sandboxes/{sandboxId}` - 删除沙箱 | ||
| - `POST /sandboxes/{sandboxId}/snapshots` - 从沙箱创建快照 |
There was a problem hiding this comment.
POST /sandboxes/{sandboxId}/snapshots - 从沙箱创建快照
POST /sandboxes - 从镜像或快照创建沙箱,设置超时与资源限制
区别是啥?
There was a problem hiding this comment.
第一个是创建快照的接口,第二个是基于快照创建沙箱的接口(其实就是原来创建沙箱的接口,只不过额外支持了基于snapshot来创建出一个新沙箱)
| The command to execute as the sandbox's entry process. | ||
|
|
||
| Required when `image` is provided. Must be omitted when `snapshotId` | ||
| is provided because the restored snapshot carries its startup process. |
There was a problem hiding this comment.
That is incorrect. A snapshot at the rootfs level is merely an image; it does not contain any process information.
There was a problem hiding this comment.
这个可能有点理解偏差,这个image是正常沙箱创建的镜像参数(和本次变更其实没啥关系)。针对snapshot场景,sdk用户只感知到他创建了一个snapshot,获取到了一个snapshotId,然后可以直接基于这个snapshotId创建沙箱(就不用传递原来正常创建时候的image参数了)。至于这个snapshotId对应的runtime config 是啥要渲染怎么样的crd,是在server持久化维护的。

Summary
POST /sandboxes/{sandboxId}/snapshotscreates a snapshot and returns its snapshot id.GET /snapshotslists snapshots with optionalsandboxIdfiltering and pagination.DELETE /snapshots/{snapshotId}deletes a snapshot.POST /sandboxesso a sandbox can be created either fromimageor restored fromsnapshotId.imageorsnapshotIdmust be provided.entrypointis required for image-based creation.entrypointmust be omitted for snapshot-based creation because the snapshot carries the startup process.Sandboxresponse shape so the startup source can be represented by eitherimageorsnapshotId.Testing
Breaking Changes
Checklist
Notes:
imagexorsnapshotId, andentrypointonly for image-based creation).oneOfis intentionally avoided to keep generated SDK models simple, especially for Kotlin.SandboxManager, including creating a snapshot from a sandbox, listing snapshots, deleting snapshots, and creating/restoring a sandbox fromsnapshotId.snapshotIdto snapshot runtime configuration mapping so restore requests can resolve the correct runtime artifact/configuration.