Skip to content

feat(vm-events): enhance VM event handling and introduce sandbox evic…#3314

Merged
pedrofrxncx merged 1 commit intomainfrom
handle-sandbox-eviction
May 8, 2026
Merged

feat(vm-events): enhance VM event handling and introduce sandbox evic…#3314
pedrofrxncx merged 1 commit intomainfrom
handle-sandbox-eviction

Conversation

@pedrofrxncx
Copy link
Copy Markdown
Collaborator

@pedrofrxncx pedrofrxncx commented May 8, 2026

…tion logic

  • Updated event types in vm-events.ts to include new daemon events.
  • Added STALE_CLAIM_DETECTION_MS for improved stale sandbox detection.
  • Implemented writeSse function for consistent SSE event writing.
  • Enhanced UI to handle "sandbox-evicted" phase, prompting users to start a new sandbox.
  • Updated EnvContent and PreviewContent components to reflect new eviction logic and reset SSE connection on retries.
  • Refactored VmEventsProvider to manage SSE connection resets after terminal failures.

What is this contribution about?

Describe your changes and why they're needed.

Screenshots/Demonstration

Add screenshots or a Loom video if your changes affect the UI.

How to Test

Provide step-by-step instructions for reviewers to test your changes:

  1. Step one
  2. Step two
  3. Expected outcome

Migration Notes

If this PR requires database migrations, configuration changes, or other setup steps, document them here. Remove this section if not applicable.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Adds fast sandbox eviction detection and a clearer recovery flow. The app now surfaces a “Sandbox was removed” state and reconnects SSE cleanly after starting a new sandbox.

  • New Features

    • Detects stale sandboxes in 30s when a prior claim exists, emitting a terminal phase with reason "sandbox-evicted" (or gone for self-heal cases).
    • Env and Preview UIs treat evicted state as idle and show “Start new sandbox”; logs link is hidden for this case.
    • VmEventsProvider exposes resetConnection() and the UI calls it on retries to re-establish SSE after terminal failures.
    • Expands daemon SSE support to log|status|scripts|tasks|intent|phases|branch-status|transition.
    • Adds @decocms/sandbox/daemon types; UI consumes UpstreamStatus, branch status, and daemon events from there.
  • Refactors

    • Consolidated SSE writes with writeSse() and unified error emission.
    • Handles runner-kind mismatches when cleaning stale entries; avoids orphaned state.
    • Removes legacy processes/reload handling in favor of tasks and event-driven transitions.
    • Adds sandbox-evicted to ClaimFailureReason; bumps @decocms/sandbox to 0.4.3 and exports ./daemon.

Written for commit 059db3a. Summary will update on new commits.

…tion logic

- Updated event types in `vm-events.ts` to include new daemon events.
- Added `STALE_CLAIM_DETECTION_MS` for improved stale sandbox detection.
- Implemented `writeSse` function for consistent SSE event writing.
- Enhanced UI to handle "sandbox-evicted" phase, prompting users to start a new sandbox.
- Updated `EnvContent` and `PreviewContent` components to reflect new eviction logic and reset SSE connection on retries.
- Refactored `VmEventsProvider` to manage SSE connection resets after terminal failures.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Release Options

Suggested: Minor (2.311.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.310.9-alpha.1
🎉 Patch 2.310.9
❤️ Minor 2.311.0
🚀 Major 3.0.0

Current version: 2.310.8

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 10 files

@pedrofrxncx pedrofrxncx merged commit 76a9187 into main May 8, 2026
17 of 18 checks passed
@pedrofrxncx pedrofrxncx deleted the handle-sandbox-eviction branch May 8, 2026 05:21
pedrofrxncx added a commit that referenced this pull request May 8, 2026
Reverts 76a9187 — enhanced VM event handling and sandbox eviction logic.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
pedrofrxncx added a commit that referenced this pull request May 8, 2026
* revert: back to 76a9187 (pre upstream-status changes and release bump)

Reverts:
- fix(upstream-status): redefine UpstreamStatus type to include specific states (3fe3c0a)
- [release]: bump to 2.310.9 (59d8046)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* revert: undo feat(vm-events) from PR #3314

Reverts 76a9187 — enhanced VM event handling and sandbox eviction logic.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* Bump version from 0.4.2 to 0.4.4

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.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.

1 participant