Skip to content

fix: SDK API compatibility, port range, and empty string form handling#1

Open
hjpinheiro wants to merge 3 commits into
daytona:mainfrom
hjpinheiro:fix/sdk-compat-and-bugfixes
Open

fix: SDK API compatibility, port range, and empty string form handling#1
hjpinheiro wants to merge 3 commits into
daytona:mainfrom
hjpinheiro:fix/sdk-compat-and-bugfixes

Conversation

@hjpinheiro

Copy link
Copy Markdown

Summary

Three bug fixes that prevent the plugin from working correctly with the current Daytona SDK (0.187.0).

1. Credential validation broken — list() API change

The Daytona SDK changed the list() signature:

# Old (broken with SDK ≥0.187.0):
daytona.list(limit=1)  # TypeError: unexpected keyword argument "limit"

# Fixed:
list(daytona.list(query=ListSandboxesQuery(limit=1)))

This causes credential validation to fail on every new install.

2. Unpinned SDK dependency

daytona>=0.1.0 has no upper bound and silently installs incompatible SDK versions. Pinned to >=0.187.0,<0.188.0 to match the tested API surface.

3. Port range restriction (3000–9999 → 1–65535)

get_preview_url rejected valid ports outside the arbitrary 3000–9999 range, blocking common services (port 80, 443, etc.).

4. Empty string form values crash create_sandbox

Dify form inputs send empty strings ("") when fields are left blank, not None. The previous is None checks missed this, causing ValueError: invalid literal for int() with base 10: "" when cpu, memory, disk, or auto_stop_interval were empty.

Testing

  • YAML files validated with yaml.safe_load()
  • Python files validated with py_compile
  • SDK list() signature verified against installed daytona==0.187.0

Files changed

File Change
provider/daytona.py list(limit=1)list(query=ListSandboxesQuery(limit=1))
requirements.txt daytona>=0.1.0daytona>=0.187.0,<0.188.0
pyproject.toml Same version pin
tools/get_preview_url.py Port range 3000-99991-65535
tools/get_preview_url.yaml Updated llm_description port range
tools/create_sandbox.py Handle "" same as None for numeric params

The Daytona SDK changed the list() signature from list(limit=N) to
list(query=ListSandboxesQuery). The old call caused credential
validation to fail on every new install with the current SDK (0.187.0).

Also pin daytona>=0.187.0,<0.188.0 to match the tested API surface.
The previous daytona>=0.1.0 had no upper bound, silently installing
incompatible SDK versions.
The previous 3000-9999 restriction blocked valid services running on
common ports (80, 443, 8000, etc.). Use the full valid TCP port range.
Dify form inputs send empty strings (not None) when fields are left
blank. The previous code only checked for None, causing ValueError on
int("") when cpu/memory/disk/auto_stop_interval were empty.

Treat empty strings the same as None for all numeric resource parameters.
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