feat(backend/copilot): enable E2B auto_resume and reduce safety-net timeout - #12397
Conversation
…imeout Add auto_resume: True to E2B sandbox lifecycle config so paused sandboxes wake transparently on SDK activity. Reduce the safety-net timeout from 3 hours to 5 minutes — safe because the explicit per-turn pause_sandbox call is the primary mechanism, and auto_resume ensures reliable wake-up even with the shorter timeout. This reduces worst-case billing from 3 hours to 5 minutes when the explicit pause call fails (process crash, network issue, etc.).
🔍 PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. 🔴 Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
🟢 Low Risk — File Overlap OnlyThese PRs touch the same files but different sections (click to expand)
Summary: 1 conflict(s), 0 medium risk, 12 low risk (out of 13 PRs with file overlap) Auto-generated on push. Ignores: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
WalkthroughThis PR updates the e2b sandbox timeout configuration from 3 hours to 5 minutes, introduces SandboxLifecycle object construction for lifecycle management, enables auto_resume behavior based on timeout strategy, and upgrades the e2b dependency from version 2.0 to 2.15.2. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
10 minutes gives more headroom for users thinking between messages while still being a 18x improvement over the previous 3-hour default.
e2b 2.15.2 introduces the lifecycle parameter (SandboxLifecycle TypedDict) on AsyncSandbox.create(). Use the proper type instead of a plain dict to satisfy pyright.
auto_resume has no cost and no downside — always enable it when on_timeout is 'pause'. Removes the config field and uses SandboxLifecycle constructor directly.
…imeout (#12397) Enable E2B `auto_resume` lifecycle option and reduce the safety-net timeout from 3 hours to 5 minutes. Currently, if the explicit per-turn `pause_sandbox_direct()` call fails (process crash, network issue, fire-and-forget task cancellation), the sandbox keeps running for up to **3 hours** before the safety-net timeout fires. With this change, worst-case billing drops to **5 minutes**. ### Changes - Add `auto_resume: True` to sandbox lifecycle config — paused sandboxes wake transparently on SDK activity - Reduce `e2b_sandbox_timeout` default from 10800s (3h) → 300s (5min) - Add `e2b_sandbox_auto_resume` config field (default: `True`) - Guard: `auto_resume` only added when `on_timeout == "pause"` ### What doesn't change - Explicit per-turn `pause_sandbox_direct()` remains the primary mechanism - `connect()` / `_try_reconnect()` flow unchanged - Redis key management unchanged - No latency impact (resume is ~1-2s regardless of trigger) ### Risk Very low — `auto_resume` is additive. If it doesn't work as advertised, `connect()` still resumes paused sandboxes exactly as before. Ref: https://e2b.dev/docs/sandbox/auto-resume Linear: SECRT-2118 --- Co-authored-by: Zamil Majdy (@majdyz) <zamil.majdy@agpt.co>
…imeout (Significant-Gravitas#12397) Enable E2B `auto_resume` lifecycle option and reduce the safety-net timeout from 3 hours to 5 minutes. Currently, if the explicit per-turn `pause_sandbox_direct()` call fails (process crash, network issue, fire-and-forget task cancellation), the sandbox keeps running for up to **3 hours** before the safety-net timeout fires. With this change, worst-case billing drops to **5 minutes**. ### Changes - Add `auto_resume: True` to sandbox lifecycle config — paused sandboxes wake transparently on SDK activity - Reduce `e2b_sandbox_timeout` default from 10800s (3h) → 300s (5min) - Add `e2b_sandbox_auto_resume` config field (default: `True`) - Guard: `auto_resume` only added when `on_timeout == "pause"` ### What doesn't change - Explicit per-turn `pause_sandbox_direct()` remains the primary mechanism - `connect()` / `_try_reconnect()` flow unchanged - Redis key management unchanged - No latency impact (resume is ~1-2s regardless of trigger) ### Risk Very low — `auto_resume` is additive. If it doesn't work as advertised, `connect()` still resumes paused sandboxes exactly as before. Ref: https://e2b.dev/docs/sandbox/auto-resume Linear: SECRT-2118 --- Co-authored-by: Zamil Majdy (@majdyz) <zamil.majdy@agpt.co>
Enable E2B
auto_resumelifecycle option and reduce the safety-net timeout from 3 hours to 5 minutes.Currently, if the explicit per-turn
pause_sandbox_direct()call fails (process crash, network issue, fire-and-forget task cancellation), the sandbox keeps running for up to 3 hours before the safety-net timeout fires. With this change, worst-case billing drops to 5 minutes.Changes
auto_resume: Trueto sandbox lifecycle config — paused sandboxes wake transparently on SDK activitye2b_sandbox_timeoutdefault from 10800s (3h) → 300s (5min)e2b_sandbox_auto_resumeconfig field (default:True)auto_resumeonly added whenon_timeout == "pause"What doesn't change
pause_sandbox_direct()remains the primary mechanismconnect()/_try_reconnect()flow unchangedRisk
Very low —
auto_resumeis additive. If it doesn't work as advertised,connect()still resumes paused sandboxes exactly as before.Ref: https://e2b.dev/docs/sandbox/auto-resume
Linear: SECRT-2118
Co-authored-by: Zamil Majdy (@majdyz) zamil.majdy@agpt.co