agentscope-ai / agentscope-ai/agentscope-java

DaytonaSandboxClient: Using snapshot to create sandbox fails because cpu/memory/disk default values are always sent

Abierto
#2,421 2 comentarios 0 reacciones 0 asignados Ver en GitHub
area/build area/core/memory area/extensions bug
Lenguaje dominante
Java
Estrellas
5.6k
Forks
1.3k
Merge medio
4 d 12 h
PR fusionados (30 d)
77

Descripción

## 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`

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.