You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 051e634
Browse filesBrowse the repository at this point in the historyBrowse files
feat(workspaces): name sandboxd sessions and Daytona sandboxes (#120)
## Problem
When a run had no ref, the provider always named its session. An
application that keys a sandbox on its own record (a conversation, a
user) therefore had to store each ref before a second run could find the
same files, and two first runs of one conversation opened two sessions.
AgenticOS needs this to move its sandboxd and Daytona workspaces onto
this release (vstorm-co/agenticos#2003, decision 1: "who names a
session"). Before 0.2.30, `RemoteSandbox(session_id=..., reuse=True)`
did exactly this.
## What changes
- **`SandboxdWorkspace(session_name=...)`**: with no ref, the first
operation sends `session_id=<name>` with `reuse`. The service opens the
session or attaches to the open one or to its kept files. A `409`
("Session is opening", from a concurrent open of the same name) is
retried until `request_timeout`, so both runs end up in one session.
Names the service would reject fail at construction.
- **`DaytonaWorkspace(sandbox_name=...)`**: looks the sandbox up by
name, starting a stopped one, or creates it with `name=` added to a copy
of `create_params`. A `DaytonaConflictError` from a concurrent create
attaches instead. The ref carries the name, which `get` accepts.
- **Both:** a ref stays attach-only, so a session purged in the meantime
surfaces as `WorkspaceUnavailableError` rather than an empty directory.
`get_workspace` leaves a ref naming another session to another
capability, as `DockerWorkspace(container_name=...)` does since 0.2.31.
- Docs (`remote.md`, `daytona.md`) and a CHANGELOG `[Unreleased]` entry.
## Verification
- `make test`: 1334 passed, 100% coverage
- `make lint`, `make typecheck` (pyright, 0 errors), `make
typecheck-mypy`: clean
- sandboxd: tested against the real service in-process (uvicorn over
HTTP). Covered: opening under the name, a second client in the same
session, kept files found by name after the session closed, a purged
session behind a ref being unavailable, name validation, routing, the
409 retry, and a 409 that never clears.
- Daytona: the SDK fake learns names. Covered: create under the name
with the caller's params left untouched, attach to and start an existing
one, a conflict, a destroyed one, a ref staying attach-only, routing.
## Limitations
Daytona is not checked against a live account here, the same as the rest
of `DaytonaWorkspace`.
0 commit comments