Skip to content

feat: sandbox auto-pause interval support in SDKs and CLI#58

Open
MDzaja wants to merge 5 commits into
mainfrom
feat/sandbox-auto-pause
Open

feat: sandbox auto-pause interval support in SDKs and CLI#58
MDzaja wants to merge 5 commits into
mainfrom
feat/sandbox-auto-pause

Conversation

@MDzaja

@MDzaja MDzaja commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

  • All SDKs (TypeScript, Python sync/async, Go, Java, Ruby):
    • autoPauseInterval / auto_pause_interval create parameter
    • setAutoPauseInterval() / set_auto_pause_interval() on the Sandbox object (Ruby: auto_pause_interval=)
    • autoPauseInterval exposed on sandbox DTO mappings
    • Client-side validation: non-negative integer; mutually exclusive with autoStopInterval (at most one non-zero)
  • CLI: daytona sandbox create --auto-pause <minutes> (mutually exclusive with --auto-stop); interval flags are now only sent when explicitly set, so server-side class-aware defaults apply (pause-capable classes default to auto-pause 60 min, containers keep auto-stop 15 min). MCP create_sandbox tool gets autoPauseInterval too.
  • Generated clients: openapi-specs/api.json updated + all api-client* regenerated (new setAutoPauseInterval operation).

Behavior notes

  • Only pause-supporting sandbox classes (linux-vm, windows) may enable auto-pause; server returns 422 otherwise.
  • Setting both intervals to non-zero fails fast client-side with the same message the server uses.

Summary by cubic

Adds auto-pause interval support across SDKs and the CLI so sandboxes can automatically pause after idle time. Introduces create-time autoPauseInterval, a per-sandbox setAutoPauseInterval endpoint/method, enforces exclusivity with auto-stop, and blocks auto-pause for ephemeral sandboxes.

  • New Features

    • SDKs (TypeScript, Python sync/async, Go, Java, Ruby): autoPauseInterval in create params; setAutoPauseInterval() (Ruby: auto_pause_interval=); exposed on sandbox models and list items; validation (non‑negative; mutually exclusive with autoStopInterval; disallowed for ephemeral).
    • CLI: daytona sandbox create --auto-pause <minutes>; mutually exclusive with --auto-stop; only sends interval flags when set; blocks auto-pause for ephemeral. MCP create_sandbox adds autoPauseInterval.
    • Defaults: pause-capable classes default to auto-pause 60 min; container-only classes keep auto-stop 15 min when neither interval is provided.
    • API/Clients: OpenAPI adds setAutoPauseInterval; all api-client* variants regenerated.
  • Bug Fixes

    • Ruby SDK: always force auto_delete_interval to 0 for ephemeral sandboxes.

Written for commit 1422b2d. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 91 files

Not reviewed (too large): openapi-specs/api.json (~3,618 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread cli/mcp/tools/create_sandbox.go
Comment thread cli/cmd/sandbox/create.go
Comment thread sdk-go/pkg/daytona/sandbox.go
Comment thread sdk-python/src/daytona/_sync/sandbox.py
Comment thread artifacts/sdk-docs/python-sdk/sync/daytona.mdx Outdated
Comment thread sdk-go/pkg/types/types.go Outdated
Comment thread artifacts/sdk-docs/go-sdk/types.mdx Outdated
Comment thread artifacts/sdk-docs/python-sdk/async/async-daytona.mdx Outdated
Comment thread artifacts/sdk-docs/go-sdk/types.mdx Outdated
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅ Thank you!
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 20 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread cli/mcp/tools/create_sandbox.go
@MDzaja

MDzaja commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 10, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3 issues found across 29 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="sdk-ruby/lib/daytona/daytona.rb">

<violation number="1" location="sdk-ruby/lib/daytona/daytona.rb:212">
P2: Ruby still allows the documented `ephemeral: true, auto_pause_interval: 60` path through this validation because `ephemeral: true` does not set `auto_delete_interval` to `0` when that field is omitted. Checking `params.ephemeral` here as well would make the new client-side guard match the added spec and the Python behavior.</violation>
</file>

<file name="sdk-go/pkg/daytona/client.go">

<violation number="1" location="sdk-go/pkg/daytona/client.go:460">
P2: Linked sandbox creates can still send a non-zero `AutoPauseInterval` without being rejected client-side, because this check only recognizes ephemeral sandboxes via an explicit `AutoDeleteInterval == 0`. Since `LinkedSandbox` is documented as requiring an ephemeral sandbox, considering it in the same validation would keep the SDK fail-fast behavior consistent for that create path.</violation>
</file>

<file name="cli/cmd/sandbox/create.go">

<violation number="1" location="cli/cmd/sandbox/create.go:91">
P2: `daytona sandbox create --auto-delete 0` can still bypass this validation because the new check only runs when `--auto-pause` is explicitly provided. For ephemeral sandboxes, consider handling `autoDeleteFlag == 0` outside the `Changed("auto-pause")` branch so implicit server auto-pause defaults are disabled or rejected consistently.</violation>
</file>

Tip: instead of fixing issues one by one fix them all with cubic
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread cli/cmd/sandbox/create.go
Comment thread sdk-java/src/main/java/io/daytona/sdk/Daytona.java
Comment thread sdk-ruby/lib/daytona/daytona.rb
Comment thread sdk-go/pkg/daytona/client.go
@MDzaja MDzaja force-pushed the feat/sandbox-auto-pause branch from 2bf89ae to 84d88ff Compare July 10, 2026 12:06
fabjanvucina
fabjanvucina previously approved these changes Jul 10, 2026
MDzaja added 5 commits July 13, 2026 07:16
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
…d MCP

Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
…andboxes

Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
Signed-off-by: MDzaja <mirkodzaja0@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants