Bound sandbox resources and lifetime to cut provisioned-memory cost - #44
Conversation
eve defaults the Vercel sandbox to a 30-minute wall-clock timeout and no resource cap. The timeout is not idle-based (confirmed against the Vercel Sandbox SDK docs): a VM bills provisioned memory for the full window regardless of activity, so a 2-minute task still holds its sandbox for ~30 minutes. evolve was the 2nd-heaviest project on Sandbox Provisioned Memory (95.6 GB-Hrs/cycle). Pin vcpus: 1 (2048 MB) and timeout: 15 min, guarded to hosted Vercel only so local `eve dev` keeps the default docker/bash backend. Both are env-tunable (EVOLVE_SANDBOX_VCPUS / EVOLVE_SANDBOX_TIMEOUT_MS). Sessions survive a stopped VM via persistent + resume; the only exposure is a single sandbox command longer than the timeout, and evolve's commands run well under a minute (15 min also leaves headroom for start_background). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10a8cf2f9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| backend: vercel({ | ||
| timeout: SANDBOX_TIMEOUT_MS, | ||
| resources: { vcpus: SANDBOX_VCPUS }, |
There was a problem hiding this comment.
Reapply sandbox caps on resumed sessions
For conversations whose persistent Vercel sandbox already exists before this deploy, these vercel() create options are never applied: Eve's Vercel backend forwards them only to fresh Sandbox.create, while the resume path uses Sandbox.get and only updates tags. Those ongoing sessions therefore keep the old 30-minute/default-resource settings, and later env-only limit changes have the same problem, so the cost cap won't cover resumed production work unless the caps are also applied via onSession({ use })/sandbox.update or the old sessions are forced to recreate.
Useful? React with 👍 / 👎.
Problem
evolve was the 2nd-heaviest project on Sandbox Provisioned Memory (95.6 GB-Hrs/cycle, 25.3%) — high for an agent doing small file-edit tasks. Root cause (confirmed against the Vercel Sandbox SDK docs): eve's sandbox
timeoutis a wall-clock ceiling (default 30 min), not idle. eve never callsextendTimeout, so a VM bills provisioned memory for the whole 30-min window regardless of activity — a 2-min task still holds its sandbox ~30 min. eve also sets noresources, so each sandbox takes the platform default (≥2048 MB/vCPU).Fix
In
agent/sandbox.ts, pinvcpus: 1(2048 MB) andtimeout: 15 min, guarded to hosted Vercel only (process.env.VERCEL) so localeve devkeeps eve's default docker/bash backend and never provisions a real hosted sandbox. Both values are env-tunable (EVOLVE_SANDBOX_VCPUS,EVOLVE_SANDBOX_TIMEOUT_MS) — limits can change without a code edit.Safety
persistent: true+ resume (filesystem restored on next command).start_backgroundjobs.revalidationKey+git config safe.directorybootstrap (issue [agent] Sandbox repository checkout fails: dubious ownership in /workspace #3) untouched.Test
npm run typecheckcleannpm run buildsucceeds (local build takes the default-backend branch)start_backgroundtask, confirm completion + no OOM at 2 GB, and confirmsandbox.vcpus/memory= 1 / 2048.Permissions untouched — agent capabilities unchanged.