Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions agent/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import { defineSandbox } from "eve/sandbox";
import { vercel } from "eve/sandbox/vercel";

// eve defaults the Vercel sandbox to a 30-minute wall-clock timeout and no
// resource cap. The timeout is not idle-based: a sandbox bills provisioned
// memory for the whole window regardless of activity, so a 2-minute task still
// holds its VM for ~30 minutes. Bound both to cut cost. Sessions survive a
// stopped VM (persistent + resume), so the only exposure is a single sandbox
// command longer than the timeout — evolve's commands are well under a minute,
// leaving a wide margin (15 min also keeps headroom for start_background jobs).
// Both are env-tunable so limits can change without a code edit + redeploy.
const SANDBOX_TIMEOUT_MS =
Number(process.env.EVOLVE_SANDBOX_TIMEOUT_MS) || 15 * 60 * 1000;
const SANDBOX_VCPUS = Number(process.env.EVOLVE_SANDBOX_VCPUS) || 1;

export default defineSandbox({
// Pin the Vercel backend (with the caps) only on hosted Vercel. Locally, omit
// it so eve's default backend (docker/bash) runs — otherwise `eve dev` would
// try to create real hosted sandboxes.
...(process.env.VERCEL
? {
backend: vercel({
timeout: SANDBOX_TIMEOUT_MS,
resources: { vcpus: SANDBOX_VCPUS },
Comment on lines +22 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

}),
}
: {}),
revalidationKey: () => "safe-directory-v1",
// eve's channel-managed GitHub checkout runs git in /workspace, whose
// directory ownership differs from the sandbox user, so git aborts every
Expand Down