Skip to content

fix: persist Daytona sandbox IDs for audit and cleanup#563

Open
ElegantLin wants to merge 1 commit into
mainfrom
fix/554-persist-sandbox-id
Open

fix: persist Daytona sandbox IDs for audit and cleanup#563
ElegantLin wants to merge 1 commit into
mainfrom
fix/554-persist-sandbox-id

Conversation

@ElegantLin
Copy link
Copy Markdown

@ElegantLin ElegantLin commented May 26, 2026

Summary

  • Daytona runs now write sandbox.json immediately after sandbox creation, ensuring the provider-side sandbox ID survives process interruptions.
  • result.json also includes sandbox_id for completed runs, linking rollout artifacts to provider-side resources.
  • Adds a sandbox_id property to BaseSandbox (returns None by default), overridden in DaytonaSandbox to return self._sandbox.id.
  • Uses isinstance(sandbox_id, str) checks to safely handle mocked environments in tests.

Closes #554

Test plan

  • test_persist_sandbox_info_writes_sandbox_json — verifies sandbox.json is written with correct ID and provider
  • test_persist_sandbox_info_skips_when_no_sandbox_id — Docker backends produce no sandbox.json
  • test_persist_sandbox_info_skips_when_no_rollout_dir — no crash on None rollout_dir
  • test_result_json_includes_sandbox_id — sandbox_id appears in result.json
  • test_result_json_sandbox_id_null_for_docker — sandbox_id is null when not provided
  • Full test suite passes (1371 passed, 9 pre-existing failures unrelated)

🤖 Generated with Claude Code


Open in Devin Review

Daytona runs now write sandbox.json immediately after sandbox creation,
ensuring the provider-side sandbox ID survives interruptions. The ID is
also included in result.json for completed runs. Adds a sandbox_id
property to BaseSandbox (None by default, overridden in DaytonaSandbox).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines +80 to +82
"""Guards the fix from PR #555 for issue #554: Daytona sandbox IDs must
be persisted immediately after creation so interrupted runs can be
audited and cleaned up."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Regression test docstrings reference wrong PR number ("PR #555" instead of "PR #563")

Per AGENTS.md: "Regression tests must name the PR/commit they guard in the docstring." The two new regression tests (test_persist_sandbox_info_writes_sandbox_json and test_result_json_includes_sandbox_id) both state "Guards the fix from PR #555" but the actual fix (the _persist_sandbox_info function, the sandbox_id parameter, etc.) is introduced in this PR #563. PR #555 does not appear in the git history. The issue number is #554, so "PR #555" appears to be a typo/hallucination — neither matching the PR number (#563) nor the issue number (#554).

Suggested change
"""Guards the fix from PR #555 for issue #554: Daytona sandbox IDs must
be persisted immediately after creation so interrupted runs can be
audited and cleaned up."""
"""Guards the fix from PR #563 for issue #554: Daytona sandbox IDs must
be persisted immediately after creation so interrupted runs can be
audited and cleaned up."""
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +115 to +117
"""Guards the fix from PR #555 for issue #554: result.json should include
the sandbox_id for completed runs so post-mortem cleanup can reconcile
Daytona sandboxes against rollout artifacts."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Second regression test docstring also references wrong PR number

Same issue as the other test: test_result_json_includes_sandbox_id references "PR #555" instead of "PR #563", violating the AGENTS.md convention that regression tests must name the PR they guard.

Suggested change
"""Guards the fix from PR #555 for issue #554: result.json should include
the sandbox_id for completed runs so post-mortem cleanup can reconcile
Daytona sandboxes against rollout artifacts."""
"""Guards the fix from PR #563 for issue #554: result.json should include
the sandbox_id for completed runs so post-mortem cleanup can reconcile
Daytona sandboxes against rollout artifacts."""
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Daytona runs do not persist sandbox ids, making interrupted sandbox cleanup unauditable

1 participant