Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(tasks): provision VM sandbox template when flag enabled (#62856)

Alessandro Pogliaghi40d3e88cffe4
diff --git a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py
index 2af19858e1de..048116dde65e 100644
--- a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py
+++ b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py
@@ -353,14 +353,17 @@ def create_sandbox_for_repository(input: CreateSandboxForRepositoryInput) -> Cre
f"Provisioning sandbox from {prepared.image_source_label} (image build may take a few minutes on first run)",
)
+ # The VM template bakes in Docker (and forces the VM runtime), so the agent
+ # can run nested containers; the default template has neither.
+ use_vm_sandbox = ctx.use_modal_vm_sandbox
config = SandboxConfig(
name=prepared.sandbox_name,
- template=SandboxTemplate.DEFAULT_BASE,
+ template=SandboxTemplate.VM_BASE if use_vm_sandbox else SandboxTemplate.DEFAULT_BASE,
environment_variables=prepared.environment_variables,
snapshot_id=prepared.snapshot_id,
snapshot_external_id=prepared.snapshot_external_id,
metadata={"task_id": ctx.task_id},
- vm_runtime=ctx.use_modal_vm_sandbox,
+ vm_runtime=use_vm_sandbox,
)
with StepTimer("sandbox_creation", used_snapshot=prepared.used_snapshot):