Repository navigation
fix(cloud-agent-next): skip sandbox delete cleanup when container is stopped - #8147
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change scopes the stopped-container cleanup skip to Files Reviewed (2 files)
Previous Review Summary (commit c28f0d9)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit c28f0d9)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe stopped-container fast path correctly avoids wakes, but it also skips workspace and session-home cleanup for Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Reviewed by deepseek-v4.1-flash-1017 · Input: 35K · Output: 3.6K · Cached: 306.4K Review guidance: REVIEW.md from base branch |
Summary
Retention cleanup for a session on a shared sandbox ran
rm -rfinside the sandbox, waking a stopped container once per expired session. With thousands of expired sessions per shared sandbox, each TTL cohort kept containers awake with no active work.CloudflareAgentSandbox.deletenow reuses the existing non-wakingisSandboxContainerRunningprobe beforegetSession,cleanupWorkspace, ordeleteSession. When the container is confirmed stopped, cleanup is skipped and logged assandbox_delete_cleanup_skippedwith the sandbox ID and deletion reason. Unknown state stays fail-safe and keeps the existing cleanup path. Therecoverybranch is unchanged.Tests
delete('retention-expired')does not callgetSession,cleanupWorkspace(viaexec), ordeleteSession.deleteSessionstill run.Verified with:
pnpm exec vitest run src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.test.ts --config vitest.config.tspnpm run typecheckoxfmt --checkandoxlinton the changed filesOut of scope
SandboxContainers).SESSION_TTL_MS.