Repository navigation
improvement(sandbox): pause idle chat workbenches instead of keeping them running - #9452
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…them running - Session sandboxes now pause after a 5-minute idle lease (was: kept running for 20 minutes, then killed). Resume keeps files, packages and processes and takes well under a second; paused sandboxes are not billed and do not count toward the provider's concurrency limit. - A new cleanup-session-sandboxes cron kills workbenches paused for more than 15 minutes, so a workbench is still discarded about 20 minutes after its last use. Each kill runs under the session lock and re-checks the sandbox's own info, so a just-resumed workbench is never killed. - Streamed workbench writes and upload snapshots lease their full transfer budget so a machine cannot pause mid-transfer. - E2B Mothership sandboxes are priced at their template's 2 vCPU / 1 GiB instead of the 4 GiB Function profile.
402c17f to
bd119ea
Compare
[Medium impact] The PR appears safe to merge; no new blocking issues were found. SummaryChat workbenches now pause after their idle lease expires instead of being destroyed.
No new actionable issues were found. The earlier, unnumbered cleanup-duration thread was rechecked; the sweep now defers remaining work once its deadline expires.
|
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
cleanup-session-sandboxescron (every 5 min) kills workbenches paused for more than 15 min, so retention stays where it was: a workbench is discarded about 20 min after its last usegetInfo, because the provider's list trails resumes and kills by a few seconds.autoResume: false, so only a locked reconnect can wake a paused sandboxReplaying a day of real sandbox activity through the new policy: ~38% fewer running sandbox-hours, ~23% lower peak concurrency, and idle gaps of 5–20 min resume the same machine instead of keeping it running.
Type of Change
Testing
session-pause.live.test.tsagainst real E2B, with a realmothership-shellsandbox: auto-pause on lease expiry; reconnect resumes with a file intact; kill is refused for a too-recent pause and for a running sandbox; kill succeeds once expired. Red-checked: with kill-on-timeout instead of pause, it failslib/execution/remote-sandbox,lib/billingandlib/mothership, all passingcheck:api-validation:strict,check:unused-exports,check:comment-hygiene,check:source-conventionspass locally. Type-check and the full audit gate run in CIChecklist
test-auditauthoring gate)