Skip to content

feat(e2b): add sandbox refresh endpoint#512

Open
vishwas-droid wants to merge 1 commit into
openkruise:masterfrom
vishwas-droid:feat/e2b-refresh-endpoint
Open

feat(e2b): add sandbox refresh endpoint#512
vishwas-droid wants to merge 1 commit into
openkruise:masterfrom
vishwas-droid:feat/e2b-refresh-endpoint

Conversation

@vishwas-droid

Copy link
Copy Markdown

Fixes #506

Summary

This change adds support for the E2B-compatible sandbox refresh endpoint:

POST /sandboxes/{sandboxID}/refreshes

The endpoint allows clients to refresh a sandbox's TTL without modifying other lifecycle operations.

What Changed

  • Added RefreshSandboxRequest model with duration field.
  • Added RefreshSandbox handler.
  • Registered the new /sandboxes/{sandboxID}/refreshes route.
  • Reused existing timeout utilities to keep refresh behavior consistent with the rest of the E2B lifecycle implementation.
  • Preserved existing never-timeout sandbox behavior.
  • Applied ExtendOnly timeout updates to avoid shortening an existing longer deadline.

Tests

Added coverage for:

  • Invalid duration requests.
  • Refreshing a non-existent sandbox.
  • Refreshing a running sandbox updates its timeout.
  • Never-timeout sandboxes remain unchanged after refresh.

Validation

CGO_ENABLED=0 go test ./pkg/servers/e2b/...

@kruise-bot kruise-bot requested a review from AiRanthem June 6, 2026 08:59
@kruise-bot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zmberg for approval by writing /assign @zmberg in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kruise-bot kruise-bot requested a review from zmberg June 6, 2026 08:59
@kruise-bot

Copy link
Copy Markdown

Welcome @vishwas-droid! It looks like this is your first PR to openkruise/agents 🎉

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.55556% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.63%. Comparing base (96be268) to head (f18086c).

Files with missing lines Patch % Lines
pkg/servers/e2b/refresh.go 80.00% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #512   +/-   ##
=======================================
  Coverage   78.63%   78.63%           
=======================================
  Files         181      182    +1     
  Lines       12879    12915   +36     
=======================================
+ Hits        10127    10156   +29     
- Misses       2374     2379    +5     
- Partials      378      380    +2     
Flag Coverage Δ
unittests 78.63% <80.55%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vishwas-droid

vishwas-droid commented Jun 6, 2026

Copy link
Copy Markdown
Author

CC-@furykerry @zmberg @AiRanthem PTAL!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add missing E2B-compatible sandbox lifecycle APIs

2 participants