: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tasks): lower the dev-stack sandbox cpu request floor to 2 cores (#120955)
Alessandro Pogliaghi1607cd2366c6
diff --git a/docs/published/handbook/engineering/ai/sandboxed-agents.md b/docs/published/handbook/engineering/ai/sandboxed-agents.mdindex 17f7fe580c06..034322aa0c93 100644--- a/docs/published/handbook/engineering/ai/sandboxed-agents.md+++ b/docs/published/handbook/engineering/ai/sandboxed-agents.md@@ -526,7 +526,7 @@ the agent up. The in-sandbox script (`start-dev-stack-preview.sh`) runs `pnpm indev-stack process fails the preview instead of publishing a half-working one, and each click on thelink re-probes Django and Vite inside the sandbox before redirecting. Startup peaks around 19 GB, sothese runs default to 32 GB rather than the standard VM memory size; the core limit stays at the-VM default, but a box that actually boots the dev-stack image reserves 4 cores instead of the+VM default, but a box that actually boots the dev-stack image reserves 2 cores instead of theburstable 0.5 floor (a fallback to the plain base image keeps the plain floor), and a per-task`sandbox_resources` override still wins. The launcher starts with a scrubbedenvironment (`env -i`, fixed PATH), so the stack and its containers never inherit the run'sdiff --git a/products/tasks/backend/logic/services/sandbox_config.py b/products/tasks/backend/logic/services/sandbox_config.pyindex 604af522e3df..aef5405adbeb 100644--- a/products/tasks/backend/logic/services/sandbox_config.py+++ b/products/tasks/backend/logic/services/sandbox_config.py@@ -20,4 +20,4 @@ MAX_SANDBOX_MEMORY_GB = 64MAX_SANDBOX_TTL_SECONDS = SANDBOX_TTL_SECONDSDEV_STACK_MEMORY_GB = 64.0-DEV_STACK_CPU_REQUEST_CORES = 4.0+DEV_STACK_CPU_REQUEST_CORES = 2.0diff --git a/products/tasks/backend/logic/services/tests/test_modal_sandbox.py b/products/tasks/backend/logic/services/tests/test_modal_sandbox.pyindex 42709c0cf7f7..187df4340363 100644--- a/products/tasks/backend/logic/services/tests/test_modal_sandbox.py+++ b/products/tasks/backend/logic/services/tests/test_modal_sandbox.py@@ -2016,7 +2016,7 @@ class TestModalSandboxCreateImageFallback:):sandbox = ModalSandbox.create(config)- assert cpu_requests == [(4.0, 8.0), (0.5, 8.0)]+ assert cpu_requests == [(2.0, 8.0), (0.5, 8.0)]assert sandbox.config.image_fallback is not Noneassert sandbox.config.effective_cpu_request_cores == 0.5@@ -2716,7 +2716,7 @@ class TestResourceCreateKwargs:@pytest.mark.parametrize("config_kwargs, expected_cpu, expected_memory",[- ({"vm_runtime": True, "custom_image_name": "posthog-dev-stack"}, (4.0, 8.0), (65536, 65536)),+ ({"vm_runtime": True, "custom_image_name": "posthog-dev-stack"}, (2.0, 8.0), (65536, 65536)),({"vm_runtime": True, "custom_image_name": "posthog-dev-stack", "cpu_request_cores": 6},(6.0, 8.0),@@ -2731,17 +2731,17 @@ class TestResourceCreateKwargs:({"custom_image_name": "posthog-dev-stack"}, (0.5, 8.0), (1024, 16384)),({"template": SandboxTemplate.VM_BASE, "custom_image_name": "posthog-dev-stack"},- (4.0, 8.0),+ (2.0, 8.0),(65536, 65536),),({"vm_runtime": True, "custom_image_name": "posthog-dev-stack", "memory_gb": 16},- (4.0, 8.0),+ (2.0, 8.0),(65536, 65536),),({"vm_runtime": True, "custom_image_name": "posthog-dev-stack", "memory_gb": 80},- (4.0, 8.0),+ (2.0, 8.0),(81920, 81920),),(