Skip to content

fix(daytona): resume dormant managed sandboxes - #7828

Open
wilbeibi wants to merge 1 commit into
omnigent-ai:mainfrom
wilbeibi:fix/daytona-resumable-sandboxes
Open

wilbeibi wants to merge 1 commit into
omnigent-ai:mainfrom
wilbeibi:fix/daytona-resumable-sandboxes

Conversation

@wilbeibi

@wilbeibi wilbeibi commented Sep 19, 2026

Copy link
Copy Markdown

Related issue

Part of #4676

Summary

  • Daytona keeps a sandbox's files when it is stopped or archived, but Omnigent currently treats that sandbox as non-resumable. A later message can therefore replace it with an empty sandbox.
  • Mark Daytona sandboxes as resumable and start the recorded sandbox ID. Wait if Daytona is already starting, stopping, restoring, or archiving it.
  • Create a replacement only when Daytona reports that the sandbox is gone. API failures leave the existing binding alone so the user can retry.

ELI5: if a workspace is asleep, wake it up. Build a new one only if the old one was deleted.

next message -> stopped / archived -> start the same sandbox
             -> deleted            -> create a new sandbox
             -> API unavailable     -> keep the binding and return an error

Start review in omnigent/onboarding/sandboxes/daytona.py; the remaining changes are focused tests and the Daytona README update.

This does not add the separate park operation requested in #4676, so the issue should remain open.

Test Plan

  • uv run --group test pytest tests/onboarding/sandboxes/test_daytona.py tests/server/test_managed_hosts.py -q -k 'test_daytona or resume_managed_host or run_managed_wake_recreates_a_definitively_gone_sandbox'
    • 42 passed, 356 deselected
  • uv run --group dev pre-commit run --all-files
    • All hooks passed.
  • Live Daytona check with a disposable sandbox:
    • Wrote a sentinel file, stopped the sandbox, and resumed it under the same ID. The file remained.
    • Stopped and archived the sandbox, then resumed it under the same ID. The file remained.
    • Deleted the sandbox afterward.

Demo

  • Visual demo attached below
  • Non-visual evidence provided below or in Test Plan
  • Not applicable — no behavioral change
STOPPED -> STARTED: same ID, sentinel present
ARCHIVING -> ARCHIVED -> STARTED: same ID, sentinel present
cleanup: sandbox deleted

Type of change

  • Bug fix
  • Feature
  • UI / frontend change
  • Refactor / chore
  • Docs
  • Test / CI
  • Breaking change

Test coverage

  • Unit tests added / updated
  • Integration tests added / updated
  • E2E tests added / updated
  • Manual verification completed
  • Existing tests cover this change
  • Not applicable

Coverage notes

The tests cover archived resume, a wake racing an archive, deleted sandboxes, and temporary API failures. The live check used the real Daytona API and confirmed that both the sandbox ID and its file survived stop and archive. No credential is stored in the repository or test fixtures.

Changelog

Daytona managed sessions now keep their workspace when a stopped or archived sandbox resumes.

@github-actions github-actions Bot added P2-medium Priority: bug with workaround, important feature request size/M Pull request size: M waiting-for-review labels Sep 19, 2026
@github-actions
github-actions Bot requested a review from TomeHirata September 19, 2026 02:30
@github-actions github-actions Bot removed the P2-medium Priority: bug with workaround, important feature request label Sep 19, 2026
@wilbeibi
wilbeibi force-pushed the fix/daytona-resumable-sandboxes branch from 7d96828 to 896b718 Compare September 19, 2026 02:35
A managed wake could replace a stopped or archived Daytona sandbox, discarding its persisted workspace. Wakes could also race provider-owned stop/archive transitions, while temporary lookup failures risked being confused with definitive deletion.

Resume the recorded sandbox under the same ID, wait through transitional states with an archive-aware timeout, and reserve SandboxGoneError for confirmed deletion. Ordinary provider failures keep the existing binding for a later retry.

Part of omnigent-ai#4676. A non-destructive park operation remains out of scope.

Verified with 42 targeted launcher and shared-wake tests, the complete pre-commit suite, and a live Daytona stop/archive/resume smoke that preserved a sentinel under the same sandbox ID.

Signed-off-by: Hongyi Shen <[email protected]>
@wilbeibi
wilbeibi force-pushed the fix/daytona-resumable-sandboxes branch from 896b718 to 08455a0 Compare September 19, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Pull request size: M waiting-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants