: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
chore(tasks): remove burstable sandbox resources flag (#66623)
Georgiy Tarasov2ab99b3144c0
diff --git a/products/tasks/backend/constants.py b/products/tasks/backend/constants.pyindex c6374bb0a540..4d98d053b379 100644--- a/products/tasks/backend/constants.py+++ b/products/tasks/backend/constants.py@@ -3,7 +3,6 @@ from typing import Literal, get_argsSANDBOX_EVENT_INGEST_FEATURE_FLAG = "tasks-cloud-runs-sandbox-event-ingest"MODAL_VM_SANDBOX_FEATURE_FLAG = "tasks-modal-vm-sandbox"MODAL_NETWORK_ALLOWLIST_FEATURE_FLAG = "tasks-modal-network-allowlist"-BURSTABLE_SANDBOX_RESOURCES_FEATURE_FLAG = "tasks-burstable-sandbox-resources"STREAM_VIA_PROXY_FEATURE_FLAG = "tasks-stream-via-proxy"ClaudePermissionMode = Literal["default", "acceptEdits", "plan", "bypassPermissions", "auto"]diff --git a/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py b/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.pyindex e6d6715367b1..a323b345ba5f 100644--- a/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py+++ b/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py@@ -12,7 +12,6 @@ from posthog.models import Teamfrom posthog.temporal.common.utils import asyncify, close_db_connectionsfrom products.tasks.backend.constants import (- BURSTABLE_SANDBOX_RESOURCES_FEATURE_FLAG,MODAL_NETWORK_ALLOWLIST_FEATURE_FLAG,MODAL_VM_SANDBOX_FEATURE_FLAG,SANDBOX_EVENT_INGEST_FEATURE_FLAG,@@ -74,9 +73,9 @@ class TaskProcessingContext:sandbox_event_ingest_enabled: bool = Falseuse_modal_vm_sandbox: bool = Falseuse_modal_network_allowlist: bool = False- # Captured at workflow start so the provisioned box's resource request is stable across- # activity retries (a mid-run flag flip can't change a live sandbox's resources anyway).- burstable_sandbox_resources_enabled: bool = False+ # Burstable by default; the per-run state can opt out to pin a fixed-size box+ # (request == limit). Captured at workflow start so it's stable across activity retries.+ burstable_sandbox_resources_enabled: bool = True@propertydef mode(self) -> str:@@ -315,11 +314,10 @@ def _is_modal_vm_sandbox_enabled(def _is_burstable_sandbox_resources_enabled(*,- distinct_id: str,- organization_id: str,run_id: str,state: dict | None = None,) -> bool:+ # Burstable by default; the per-run state can pin a fixed-size box (request == limit).state_override = (state or {}).get("burstable_sandbox_resources_enabled")if isinstance(state_override, bool):log_with_activity_context(@@ -328,28 +326,7 @@ def _is_burstable_sandbox_resources_enabled(burstable_sandbox_resources_enabled=state_override,)return state_override-- try:- enabled = bool(- posthoganalytics.feature_enabled(- BURSTABLE_SANDBOX_RESOURCES_FEATURE_FLAG,- distinct_id=distinct_id,- groups={"organization": organization_id},- group_properties={"organization": {"id": organization_id}},- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception as e:- log_with_activity_context("burstable_sandbox_resources_flag_check_failed", run_id=run_id, error=str(e))- return False-- log_with_activity_context(- "burstable_sandbox_resources_flag_checked",- run_id=run_id,- burstable_sandbox_resources_enabled=enabled,- )- return enabled+ return Truedef _is_modal_network_allowlist_enabled(@@ -518,8 +495,6 @@ def get_task_processing_context(input: GetTaskProcessingContextInput) -> TaskProf"use_modal_network_allowlist: {use_modal_network_allowlist} for this task run",)burstable_sandbox_resources_enabled = _is_burstable_sandbox_resources_enabled(- distinct_id=distinct_id,- organization_id=organization_id,run_id=run_id,state=state,)diff --git a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.pyindex adff0aef64b7..3caa057addad 100644--- a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py+++ b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py@@ -416,8 +416,10 @@ def create_sandbox_for_repository(input: CreateSandboxForRepositoryInput) -> Cre**ctx.sandbox_resource_overrides(),)- # Request a small slice and let the box burst up to the configured size. The decision is- # captured once in the context at workflow start, so it's stable across activity retries.+ # Request a small slice and let the box burst up to the configured size. Burstable by+ # default, but the per-run state can opt out to pin a fixed-size box (request == limit).+ # The decision is captured once in the context at workflow start, so it's stable across+ # activity retries.if ctx.burstable_sandbox_resources_enabled:config.burstable_resources = Trueemit_agent_log(diff --git a/products/tasks/backend/temporal/process_task/activities/tests/test_get_task_processing_context.py b/products/tasks/backend/temporal/process_task/activities/tests/test_get_task_processing_context.pyindex 3a09ad970eca..0cd0f701baaf 100644--- a/products/tasks/backend/temporal/process_task/activities/tests/test_get_task_processing_context.py+++ b/products/tasks/backend/temporal/process_task/activities/tests/test_get_task_processing_context.py@@ -8,11 +8,7 @@ from asgiref.sync import async_to_syncfrom posthog.models import OrganizationMembership, Userfrom posthog.models.user_integration import UserIntegration-from products.tasks.backend.constants import (- BURSTABLE_SANDBOX_RESOURCES_FEATURE_FLAG,- MODAL_VM_SANDBOX_FEATURE_FLAG,- SANDBOX_EVENT_INGEST_FEATURE_FLAG,-)+from products.tasks.backend.constants import MODAL_VM_SANDBOX_FEATURE_FLAG, SANDBOX_EVENT_INGEST_FEATURE_FLAGfrom products.tasks.backend.exceptions import TaskInvalidStateError, TaskRunNotReadyErrorfrom products.tasks.backend.models import SandboxEnvironment, Taskfrom products.tasks.backend.temporal.process_task.activities.get_task_processing_context import (@@ -495,66 +491,16 @@ class TestGetTaskProcessingContextActivity:assert _vm_sandbox_allowed_origin_products(payload) == expected@pytest.mark.parametrize(- "flag_value,expected",+ "state,expected",[- (True, True),- (False, False),- (None, False),+ (None, True),+ ({}, True),+ ({"burstable_sandbox_resources_enabled": True}, True),+ ({"burstable_sandbox_resources_enabled": False}, False),],)- def test_burstable_sandbox_resources_flag_uses_organization_rollout(self, flag_value, expected):- with patch(- "products.tasks.backend.temporal.process_task.activities.get_task_processing_context.posthoganalytics.feature_enabled",- return_value=flag_value,- ) as feature_enabled_mock:- assert (- _is_burstable_sandbox_resources_enabled(- distinct_id="distinct-id",- organization_id="organization-id",- run_id="run-id",- )- is expected- )-- feature_enabled_mock.assert_called_once_with(- BURSTABLE_SANDBOX_RESOURCES_FEATURE_FLAG,- distinct_id="distinct-id",- groups={"organization": "organization-id"},- group_properties={"organization": {"id": "organization-id"}},- only_evaluate_locally=False,- send_feature_flag_events=False,- )-- def test_burstable_sandbox_resources_flag_fails_closed(self):- with patch(- "products.tasks.backend.temporal.process_task.activities.get_task_processing_context.posthoganalytics.feature_enabled",- side_effect=RuntimeError("flag service failed"),- ):- assert (- _is_burstable_sandbox_resources_enabled(- distinct_id="distinct-id",- organization_id="organization-id",- run_id="run-id",- )- is False- )-- def test_burstable_sandbox_resources_state_override_skips_flag_check(self):- with patch(- "products.tasks.backend.temporal.process_task.activities.get_task_processing_context.posthoganalytics.feature_enabled",- return_value=True,- ) as feature_enabled_mock:- assert (- _is_burstable_sandbox_resources_enabled(- distinct_id="distinct-id",- organization_id="organization-id",- run_id="run-id",- state={"burstable_sandbox_resources_enabled": False},- )- is False- )-- feature_enabled_mock.assert_not_called()+ def test_burstable_sandbox_resources_defaults_true_and_respects_state(self, state, expected):+ assert _is_burstable_sandbox_resources_enabled(run_id="run-id", state=state) is expected@pytest.mark.django_db(transaction=True)def test_get_task_processing_context_uses_sandbox_event_ingest_state_override(