agentscope-ai / agentscope-ai/agentscope-java
DaytonaSandboxClient: Using snapshot to create sandbox fails because cpu/memory/disk default values are always sent
- 主要語言
- Java
- 星號
- 5.6k
- 分支
- 1.3k
- 平均合併
- 4 天 12 小時
- 30 天內合併 PR
- 77
描述
## Bug Description
When using `DaytonaHttp#createSandbox` with a `snapshot` parameter, the Daytona API returns a 400 error:
```
Cannot specify Sandbox resources when using a snapshot
```
The root cause is that `DaytonaSandboxClientOptions` defines non-null default values for `cpu`, `memory`, and `disk`, which are always included in the request body — even when a `snapshot` is specified. The Daytona API does not allow specifying resource parameters together with a snapshot.
## Steps to Reproduce
1. Create a `DaytonaSandboxClientOptions` with a `snapshot` value
2. Call `DaytonaHttp#createSandbox(options)`
3. The request fails with 400 Bad Request
## Expected Behavior
When `snapshot` is specified, the request body should NOT include `cpu`, `memory`, and `disk` fields.
## Actual Behavior
The request body always includes `cpu: 1`, `memory: 1`, `disk: 3` (the default values), causing the API to reject the request.
## Root Cause Analysis
In `DaytonaSandboxClientOptions`:
```java
private Integer cpu = 1;
private Integer memory = 1;
private Integer disk = 3;
```
In `DaytonaHttp#createSandbox`, these fields are always included when non-null. Since defaults are non-null, they are always serialized.
## Suggested Fix
**Option A**: Skip resource fields when `snapshot` is specified.
**Option B**: Change default values to `null`.
## Environment
- Library: `agentscope-extensions-sandbox-daytona`
- Daytona API: `https://app.daytona.io/api/sandbox`
貢獻指南
評估
這個 Issue 還沒有評估資料。