: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
feat(tasks): let a task pick its sandbox image template (19/22) (#86283)
Andrew Maguire244016092dd7
diff --git a/.github/workflows/cd-sandbox-base-image.yml b/.github/workflows/cd-sandbox-base-image.ymlindex 32026a5839eb..41a52fe6ae0a 100644--- a/.github/workflows/cd-sandbox-base-image.yml+++ b/.github/workflows/cd-sandbox-base-image.yml@@ -443,6 +443,20 @@ jobs:build-args: |BASE_IMAGE=ghcr.io/posthog/posthog-sandbox-base:${{ github.sha }}+ - name: Build and push container image (autoresearch)+ id: build-autoresearch+ uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0+ with:+ project: vpl2362h0x # tasks-sandbox-images+ context: . # use local checkout (includes downloaded artifact)+ file: ./products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearch+ buildx-fallback: false # the fallback is so slow it's better to just fail+ push: ${{ github.event_name == 'pull_request' || vars.CD_DEPLOY_ENABLED == 'true' }}+ tags: ${{ github.ref == 'refs/heads/master' && format('ghcr.io/posthog/posthog-sandbox-autoresearch:master,ghcr.io/posthog/posthog-sandbox-autoresearch:{0}', github.sha) || format('ghcr.io/posthog/posthog-sandbox-autoresearch:{0}', github.sha) }}+ platforms: linux/arm64,linux/amd64+ build-args: |+ BASE_IMAGE=ghcr.io/posthog/posthog-sandbox-base:${{ github.sha }}+- name: Build and push container image (vm)id: build-vmuses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0diff --git a/docs/published/handbook/engineering/ai/sandboxed-agents.md b/docs/published/handbook/engineering/ai/sandboxed-agents.mdindex 6c05d1f8b34e..534c69d545cf 100644--- a/docs/published/handbook/engineering/ai/sandboxed-agents.md+++ b/docs/published/handbook/engineering/ai/sandboxed-agents.md@@ -90,20 +90,21 @@ task = Task.create_and_run(### Parameters-| Parameter | Required | Description |-| ------------------------ | -------- | -------------------------------------------------------------------------- |-| `team` | Yes | The team this task belongs to |-| `title` | Yes | Human-readable task title |-| `description` | Yes | Detailed description of what the agent should do |-| `origin_product` | Yes | Which product created this task (see `Task.OriginProduct` choices) |-| `user_id` | Yes | User ID — used for feature flag validation and creating the scoped API key |-| `repository` | Yes | GitHub repo in `org/repo` format (e.g., `posthog/posthog-js`) |-| `posthog_mcp_scopes` | No | Scope preset or explicit scope list (default: `"full"`) |-| `create_pr` | No | Whether the agent should create a PR (default: `True`) |-| `mode` | No | Execution mode (default: `"background"`) |-| `slack_thread_context` | No | Slack thread context for agents triggered from Slack |-| `start_workflow` | No | Whether to start the Temporal workflow immediately (default: `True`) |-| `sandbox_environment_id` | No | ID of a `SandboxEnvironment` to apply network restrictions (see below) |+| Parameter | Required | Description |+| ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `team` | Yes | The team this task belongs to |+| `title` | Yes | Human-readable task title |+| `description` | Yes | Detailed description of what the agent should do |+| `origin_product` | Yes | Which product created this task (see `Task.OriginProduct` choices) |+| `user_id` | Yes | User ID — used for feature flag validation and creating the scoped API key |+| `repository` | Yes | GitHub repo in `org/repo` format (e.g., `posthog/posthog-js`) |+| `posthog_mcp_scopes` | No | Scope preset or explicit scope list (default: `"full"`) |+| `create_pr` | No | Whether the agent should create a PR (default: `True`) |+| `mode` | No | Execution mode (default: `"background"`) |+| `slack_thread_context` | No | Slack thread context for agents triggered from Slack |+| `start_workflow` | No | Whether to start the Temporal workflow immediately (default: `True`) |+| `sandbox_environment_id` | No | ID of a `SandboxEnvironment` to apply network restrictions (see below) |+| `sandbox_template` | No | Image the sandbox boots from, as a `SandboxTemplate` value (default: `"default_base"`). `"autoresearch_base"` adds pandas, numpy, scikit-learn and pyarrow, and runs on Modal and Docker only (a non-default template keeps the run off hogland). `"vm_base"` cannot be requested; VM routing selects it server-side. Later runs of the task keep the first run's template |### Adding a new origin productdiff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.pyindex aea8d091e27d..a9f62f7a8119 100644--- a/products/tasks/backend/facade/api.py+++ b/products/tasks/backend/facade/api.py@@ -2495,6 +2495,8 @@ _PROTECTED_RUN_STATE_KEYS = frozenset("wizard_head_branch","use_modal_directory_resume_snapshots","use_modal_vm_sandbox",+ # The image a run boots from; a PATCHed value would pick an image the task never asked for.+ "sandbox_template",# Rollout stamps written once at dispatch by _capture_run_feature_flags or at run# creation; a PATCHable value would let a task controller bypass the org feature flags# (for telemetry, that means injecting the internal OTLP capture token into theirdiff --git a/products/tasks/backend/logic/services/docker_sandbox.py b/products/tasks/backend/logic/services/docker_sandbox.pyindex 3dadbcf9470a..51b471034646 100644--- a/products/tasks/backend/logic/services/docker_sandbox.py+++ b/products/tasks/backend/logic/services/docker_sandbox.py@@ -75,6 +75,7 @@ logger = logging.getLogger(__name__)DEFAULT_IMAGE_NAME = "posthog-sandbox-base"NOTEBOOK_IMAGE_NAME = "posthog-sandbox-notebook"PI_IMAGE_NAME = "posthog-sandbox-pi"+AUTORESEARCH_IMAGE_NAME = "posthog-sandbox-autoresearch"STREAMLIT_IMAGE_NAME = "posthog-sandbox-streamlit"SLIM_IMAGE_NAME = "posthog-sandbox-slim"@@ -412,6 +413,18 @@ class DockerSandbox(AgentServerLaunchMixin):)return PI_IMAGE_NAME+ if template == SandboxTemplate.AUTORESEARCH_BASE:+ autoresearch_dockerfile = os.path.join(+ settings.BASE_DIR, "products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearch"+ )+ DockerSandbox._build_image_if_needed(+ AUTORESEARCH_IMAGE_NAME,+ autoresearch_dockerfile,+ build_args={"BASE_IMAGE": DEFAULT_IMAGE_NAME},+ needs_skills=False, # the base image already carries them+ )+ return AUTORESEARCH_IMAGE_NAME+local_monorepo_root = DockerSandbox._get_local_posthog_code_root()if local_monorepo_root:DockerSandbox._build_local_image(local_monorepo_root)@@ -619,6 +632,7 @@ class DockerSandbox(AgentServerLaunchMixin):SandboxTemplate.DEFAULT_BASE,SandboxTemplate.VM_BASE,SandboxTemplate.PI_BASE,+ SandboxTemplate.AUTORESEARCH_BASE,}:return Nonesource = os.environ.get("POSTHOG_DESKTOP_SKILLS")diff --git a/products/tasks/backend/logic/services/modal_sandbox.py b/products/tasks/backend/logic/services/modal_sandbox.pyindex 0d97f0c39a79..9e6ea9ca6906 100644--- a/products/tasks/backend/logic/services/modal_sandbox.py+++ b/products/tasks/backend/logic/services/modal_sandbox.py@@ -126,6 +126,7 @@ SANDBOX_BASE_IMAGE = "ghcr.io/posthog/posthog-sandbox-base"SANDBOX_NOTEBOOK_IMAGE = "ghcr.io/posthog/posthog-sandbox-notebook"SANDBOX_VM_IMAGE = "ghcr.io/posthog/posthog-sandbox-vm"SANDBOX_STREAMLIT_IMAGE = "ghcr.io/posthog/posthog-sandbox-streamlit"+SANDBOX_AUTORESEARCH_IMAGE = "ghcr.io/posthog/posthog-sandbox-autoresearch"SANDBOX_IMAGE = SANDBOX_BASE_IMAGE# SLIM_BASE has no registry image and no CD publish pipeline — it's built inline by Modal@@ -341,6 +342,7 @@ LOCAL_MODAL_DOCKERFILES = {SandboxTemplate.NOTEBOOK_BASE: Path("products/tasks/backend/sandbox/images/Dockerfile.sandbox-notebook"),SandboxTemplate.VM_BASE: Path("products/tasks/backend/sandbox/images/Dockerfile.sandbox-vm"),SandboxTemplate.STREAMLIT_BASE: Path("products/tasks/backend/sandbox/images/Dockerfile.sandbox-streamlit"),+ SandboxTemplate.AUTORESEARCH_BASE: Path("products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearch"),}LOCAL_MODAL_INSTALL_SKILLS_SCRIPT = Path("products/tasks/backend/sandbox/images/install-skills.sh")LOCAL_MODAL_GIT_GUARD_SCRIPT = Path("products/tasks/backend/sandbox/images/git-guard.sh")@@ -355,7 +357,8 @@ LOCAL_MODAL_CPU_BILLING_SAMPLER = Path("products/tasks/backend/sandbox/images/cpLOCAL_MODAL_AGENT_SHADOW_DIR = Path("products/desktop/packages/agent-shadow")-_image_ref_cache: TTLCache = TTLCache(maxsize=3, ttl=300)+# One entry per registry-backed template, so a worker serving every template evicts nothing.+_image_ref_cache: TTLCache = TTLCache(maxsize=8, ttl=300)_image_ref_lock = threading.Lock()@@ -448,7 +451,9 @@ def _get_sandbox_image_reference(image: str = SANDBOX_IMAGE) -> str:# Templates whose image bundles the agent-server at /scripts and can therefore# take a live local dist overlay in DEBUG. Add new agent-server-bearing templates here.-AGENT_SERVER_TEMPLATES = frozenset({SandboxTemplate.DEFAULT_BASE, SandboxTemplate.VM_BASE})+AGENT_SERVER_TEMPLATES = frozenset(+ {SandboxTemplate.DEFAULT_BASE, SandboxTemplate.VM_BASE, SandboxTemplate.AUTORESEARCH_BASE}+)@dataclass(frozen=True)@@ -612,7 +617,8 @@ def _build_canvas_template_image() -> modal.Image:)-_template_image_cache: TTLCache = TTLCache(maxsize=4, ttl=300)+# One entry per template, so a worker serving every template evicts nothing.+_template_image_cache: TTLCache = TTLCache(maxsize=8, ttl=300)_template_image_lock = threading.Lock()@@ -631,6 +637,7 @@ def get_template_base_image(template: SandboxTemplate) -> modal.Image:SandboxTemplate.NOTEBOOK_BASE: SANDBOX_NOTEBOOK_IMAGE,SandboxTemplate.VM_BASE: SANDBOX_VM_IMAGE,SandboxTemplate.STREAMLIT_BASE: SANDBOX_STREAMLIT_IMAGE,+ SandboxTemplate.AUTORESEARCH_BASE: SANDBOX_AUTORESEARCH_IMAGE,}.get(template)if registry_image is None:raise ValueError(f"Unknown template: {template}")@@ -663,6 +670,7 @@ def resolve_template_base_image_reference(template: SandboxTemplate) -> str | NoSandboxTemplate.NOTEBOOK_BASE: SANDBOX_NOTEBOOK_IMAGE,SandboxTemplate.VM_BASE: SANDBOX_VM_IMAGE,SandboxTemplate.STREAMLIT_BASE: SANDBOX_STREAMLIT_IMAGE,+ SandboxTemplate.AUTORESEARCH_BASE: SANDBOX_AUTORESEARCH_IMAGE,}.get(template)if registry_image is None:raise ValueError(f"Template does not use a registry image: {template}")diff --git a/products/tasks/backend/logic/services/sandbox.py b/products/tasks/backend/logic/services/sandbox.pyindex 39230cc330fb..4cd2c584b685 100644--- a/products/tasks/backend/logic/services/sandbox.py+++ b/products/tasks/backend/logic/services/sandbox.py@@ -70,6 +70,7 @@ class SandboxTemplate(str, Enum):DEFAULT_BASE = "default_base"NOTEBOOK_BASE = "notebook_base"PI_BASE = "pi_base"+ AUTORESEARCH_BASE = "autoresearch_base"VM_BASE = "vm_base"STREAMLIT_BASE = "streamlit_base"@@ -80,6 +81,28 @@ class SandboxTemplate(str, Enum):CANVAS_BUILD = "canvas_build"+# Templates whose image hosts the task agent server, so a task can ask for them. The+# notebook, streamlit, slim and canvas images omit the server on purpose, pi has no Modal+# image, and VM_BASE bakes in Docker and forces the VM runtime, which only the server-side+# VM routing gate may select.+TASK_AGENT_TEMPLATES: frozenset[SandboxTemplate] = frozenset(+ {SandboxTemplate.DEFAULT_BASE, SandboxTemplate.AUTORESEARCH_BASE}+)+++def parse_requested_sandbox_template(value: str | None) -> SandboxTemplate:+ """Resolve a template a caller asked for on a task; anything outside ``TASK_AGENT_TEMPLATES`` is refused."""+ if value is None:+ return SandboxTemplate.DEFAULT_BASE+ try:+ template = SandboxTemplate(value)+ except ValueError:+ raise ValueError(f"Unknown sandbox template: {value!r}")+ if template not in TASK_AGENT_TEMPLATES:+ raise ValueError(f"Sandbox template {value!r} cannot be requested per task")+ return template++class SandboxWorkload(str, Enum):"""Which provider-side project a sandbox is booked against, independent of its image.diff --git a/products/tasks/backend/models.py b/products/tasks/backend/models.pyindex 1c1ea332831f..b0f11da643b4 100644--- a/products/tasks/backend/models.py+++ b/products/tasks/backend/models.py@@ -350,6 +350,7 @@ class Task(DeletedMetaFields, models.Model):# Unlike the others (which indicate direct creation from that product, e.g. a "fix this error" button),# signal report tasks originate indirectly via signals from other products.SIGNAL_REPORT = "signal_report", "Signal Report"+ AUTORESEARCH = "autoresearch", "Autoresearch"# Headless Signals scout — proactively explores a project and emits signals.SIGNALS_SCOUT = "signals_scout", "Signals Scout"# Headless scan that pre-computes the "Suggested for this project" scout batch@@ -793,12 +794,34 @@ class Task(DeletedMetaFields, models.Model):if state.get("claude_model_access") == "own-subscription":state["claude_subscription_user_id"] = acting_user_id or task.created_by_idstate.setdefault("repositories", task.repositories or ([task.repository] if task.repository else []))+ carry_config_snapshot = (+ task.origin_product == Task.OriginProduct.WORKFLOW and "config_snapshot" not in state+ )+ if state.get("sandbox_template") is None:+ # A null is "no choice", the same as an absent key, so it must not block the carry.+ state.pop("sandbox_template", None)+ carry_sandbox_template = "sandbox_template" not in state+ if not carry_sandbox_template:+ from products.tasks.backend.logic.services.sandbox import parse_requested_sandbox_template++ # Unknown and VM templates are refused here, before the run row exists.+ parse_requested_sandbox_template(state["sandbox_template"])+ previous_state: dict = {}+ if carry_config_snapshot or carry_sandbox_template:+ # Only the newest run's state; ``latest_run`` would load every run of the task.+ previous_state = (+ task.runs.filter(team_id=task.team_id)+ .order_by("-created_at", "-id")+ .values_list("state", flat=True)+ .first()+ or {}+ )# A workflow task's later runs must keep the connector allowlist selected by the workflow.- if task.origin_product == Task.OriginProduct.WORKFLOW and "config_snapshot" not in state:- previous = task.latest_run- previous_snapshot = previous.state.get("config_snapshot") if previous else None- if previous_snapshot:- state["config_snapshot"] = previous_snapshot+ if carry_config_snapshot and previous_state.get("config_snapshot"):+ state["config_snapshot"] = previous_state["config_snapshot"]+ # Later runs keep the image the task was first provisioned with.+ if carry_sandbox_template and previous_state.get("sandbox_template"):+ state["sandbox_template"] = previous_state["sandbox_template"]# Every run creation flows through here, so this is where team/user default AI run# preferences apply when the caller didn't pin a runtime selection.task._apply_ai_run_defaults(state, acting_user_id)@@ -1007,6 +1030,7 @@ class Task(DeletedMetaFields, models.Model):reasoning_effort: str | None = None,service_tier: str | None = None,initial_permission_mode: str | None = None,+ sandbox_template: str | None = None,sandbox_resources: "SandboxResources | None" = None,sandbox_timeout_seconds: int | None = None,inactivity_timeout_seconds: int | None = None,@@ -1038,7 +1062,15 @@ class Task(DeletedMetaFields, models.Model):]repository = resolved_repositories[0] if resolved_repositories else None- from products.tasks.backend.logic.services.sandbox import is_public_sandbox_repo+ from products.tasks.backend.logic.services.sandbox import (+ is_public_sandbox_repo,+ parse_requested_sandbox_template,+ )++ # Validated before the Task row exists, so a bad template leaves nothing behind.+ requested_template = (+ parse_requested_sandbox_template(sandbox_template) if sandbox_template is not None else None+ )from products.tasks.backend.temporal.process_task.utils import (PrAuthorshipMode,RunSource,@@ -1048,13 +1080,14 @@ class Task(DeletedMetaFields, models.Model):user_github_integration_is_usable,)- # A repo-less signals task must carry no GitHub credential at all — team or personal.- # Provisioning injects whatever integration is attached, and these runs read text any- # member can write, so an attached token turns planted text into repository access.+ # A repo-less signals or autoresearch task must carry no GitHub credential at all — team+ # or personal. Provisioning injects whatever integration is attached, and these runs read+ # text any member can write, so an attached token turns planted text into repository access.github_resolution_allowed = bool(repository) or origin_product not in (Task.OriginProduct.SIGNALS_CHAT,Task.OriginProduct.SIGNAL_REPORT,Task.OriginProduct.SIGNALS_SCOUT_SUGGESTIONS,+ Task.OriginProduct.AUTORESEARCH,)github_integration = Noneif github_resolution_allowed:@@ -1221,6 +1254,9 @@ class Task(DeletedMetaFields, models.Model):if initial_permission_mode:extra_state["initial_permission_mode"] = initial_permission_mode+ if requested_template is not None:+ extra_state["sandbox_template"] = requested_template.value+# Optional per-task sandbox compute/timeout overrides. Read back into# SandboxConfig at provision time (see TaskProcessingContext); unset# fields keep the SandboxConfig defaults.@@ -1368,6 +1404,7 @@ class Task(DeletedMetaFields, models.Model):reasoning_effort: str | None = None,service_tier: str | None = None,initial_permission_mode: str | None = None,+ sandbox_template: str | None = None,sandbox_resources: "SandboxResources | None" = None,sandbox_timeout_seconds: int | None = None,inactivity_timeout_seconds: int | None = None,@@ -1392,6 +1429,15 @@ class Task(DeletedMetaFields, models.Model):)from products.tasks.backend.temporal.client import _normalize_slack_context+ # extra_run_state overwrites the derived run state below, so the template it carries is+ # the one provisioning reads. Route it through the same validation as the parameter; a+ # null is "no choice", as on later runs, and must not replace the parameter.+ if extra_run_state and "sandbox_template" in extra_run_state:+ extra_run_state = dict(extra_run_state)+ carried_template = extra_run_state.pop("sandbox_template")+ if carried_template is not None:+ sandbox_template = carried_template+task, extra_state = Task._build_task(team=team,title=title,@@ -1419,6 +1465,7 @@ class Task(DeletedMetaFields, models.Model):reasoning_effort=reasoning_effort,service_tier=service_tier,initial_permission_mode=initial_permission_mode,+ sandbox_template=sandbox_template,sandbox_resources=sandbox_resources,sandbox_timeout_seconds=sandbox_timeout_seconds,inactivity_timeout_seconds=inactivity_timeout_seconds,diff --git a/products/tasks/backend/presentation/serializers.py b/products/tasks/backend/presentation/serializers.pyindex d76e2a60c1a3..ab6e496f9c63 100644--- a/products/tasks/backend/presentation/serializers.py+++ b/products/tasks/backend/presentation/serializers.py@@ -907,6 +907,9 @@ class TaskWriteSerializer(serializers.Serializer):tasks_facade.TaskOriginProduct.SIGNALS_SCOUT,tasks_facade.TaskOriginProduct.SIGNALS_SCOUT_SUGGESTIONS,tasks_facade.TaskOriginProduct.SUPPORT_REPLY,+ # Only the autoresearch training loop creates these, in-process. Nothing legitimately+ # sets the origin from outside, so reserve it before anything starts depending on it.+ tasks_facade.TaskOriginProduct.AUTORESEARCH,# Routes the run's LLM traffic to the unbilled `onboarding` gateway product, so a# forged origin would be free model access. Only create_wizard_cloud_run sets it,# behind its own rate limits and daily cap.diff --git a/products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearch b/products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearchnew file mode 100644index 000000000000..423e868a26a1--- /dev/null+++ b/products/tasks/backend/sandbox/images/Dockerfile.sandbox-autoresearch@@ -0,0 +1,27 @@+# Dockerfile for the autoresearch sandbox image: the agent-capable base image plus the+# Python ML libraries the autoresearch training loop needs. The base image hosts the+# agent server (agentsh, @posthog/agent, skills); the notebook image ships the ML libs+# but cannot host the agent — autoresearch needs both, so we layer the libs onto base.+# Kept deliberately minimal (no torch/autogluon yet); extend here when heavier models land.+ARG BASE_IMAGE=ghcr.io/posthog/posthog-sandbox-base:master+FROM ${BASE_IMAGE}++# Installed at system site (not a venv) so the agent's plain `python3` resolves them.+# The training prompt promises a pre-equipped sandbox and forbids `pip install` at run+# time, so these must be present on the default interpreter path. PEP 668 marks the+# system environment as externally managed; --break-system-packages is the documented+# escape hatch for purpose-built images like this one.+# Pinned to the versions in the repo's uv.lock, so the sandbox trains on the same libraries+# the worker's own fit path runs, and a rebuild cannot change the training environment.+RUN pip install --break-system-packages --no-cache-dir \+ numpy==2.3.5 \+ pandas==2.3.3 \+ scikit-learn==1.7.2 \+ pyarrow==23.0.1 \+ scipy==1.16.3+# xgboost is on the recipe allowlist. Its Linux wheel declares nvidia-nccl-cu12 (322 MB) for+# multi-GPU training; training runs on CPU, so install it without dependencies (numpy and scipy+# are already present), the same way pyproject.toml overrides its metadata.+RUN pip install --break-system-packages --no-cache-dir --no-deps xgboost==3.2.0++CMD ["/bin/bash"]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 1c856507c259..f3d7d642eb3b 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@@ -59,6 +59,7 @@ from products.tasks.backend.logic.services.network_policy import (NetworkPolicyValidationError,compile_network_policy,)+from products.tasks.backend.logic.services.sandbox import SandboxTemplatefrom products.tasks.backend.logic.services.sandbox_config import (MAX_SANDBOX_CPU_CORES,MAX_SANDBOX_MEMORY_GB,@@ -662,6 +663,22 @@ class VmSandboxDecision:default_custom_image: str | None = None+def _require_template_compatible_with_custom_image(state: dict, custom_image_name: str | None, *, run_id: str) -> None:+ """A custom image is VM-only and a custom template is gVisor-only, so the two cannot compose.++ Failing here keeps the run from booting the template without the tooling the environment's+ image promised, which is what silently dropping the image would do.+ """+ requested_template = state.get("sandbox_template")+ if custom_image_name is None or requested_template in (None, SandboxTemplate.DEFAULT_BASE.value):+ return+ raise TaskInvalidStateError(+ f"Sandbox template {requested_template!r} cannot be combined with custom image {custom_image_name!r}",+ {"run_id": run_id, "sandbox_template": requested_template, "custom_image_name": custom_image_name},+ cause=ValueError("custom sandbox template with a custom image"),+ )++def _resolve_modal_vm_sandbox(*,distinct_id: str,@@ -683,6 +700,17 @@ def _resolve_modal_vm_sandbox()return VmSandboxDecision(use_vm_sandbox=False)+ requested_template = (state or {}).get("sandbox_template")+ if requested_template not in (None, SandboxTemplate.DEFAULT_BASE.value):+ # The VM image carries none of a custom template's tooling, so a rollout that names+ # the run's origin must not move it off the template it asked for.+ log_with_activity_context(+ "modal_vm_sandbox_skipped_custom_template",+ run_id=run_id,+ use_modal_vm_sandbox=False,+ )+ return VmSandboxDecision(use_vm_sandbox=False)+# A trusted, server-set per-run override (image builders) forces the runtime# decision without consulting the flag; any non-bool value is ignored.raw_state_override = (state or {}).get("use_modal_vm_sandbox")@@ -933,12 +961,13 @@ def _resolve_sandbox_backend() -> str:"""Pick the sandbox provider for this run.- Hogland only takes plain golden-template ACP runs. A user/environment custom image- or the Pi runtime are hard incapabilities — hogland runs only its own golden, so- those force Modal even with the flag on. The Modal VM-sandbox / network-allowlist- flags and the org *default* image are runtime preferences, not incapabilities: a- run the hogland flag (or override) selects wins hogland over them, and the caller- forces them off so the run provisions on hogland's golden. Egress stays enforced+ Hogland only takes plain golden-template ACP runs. A user/environment custom image,+ the Pi runtime or a non-default sandbox template are hard incapabilities — hogland+ runs only its own golden, so those force Modal even with the flag on. The Modal+ VM-sandbox / network-allowlist flags and the org *default* image are runtime+ preferences, not incapabilities: a run the hogland flag (or override) selects wins+ hogland over them, and the caller forces them off so the run provisions on hogland's+ golden. Egress stays enforcedin-box by agentsh via the run's allowed_domains. Fails closed to Modal."""raw_override = (state or {}).get("sandbox_backend")@@ -959,11 +988,15 @@ def _resolve_sandbox_backend(# Hogland runs in the US only; EU runs stay on Modal regardless of flag/override state.if getattr(settings, "CLOUD_DEPLOYMENT", None) == "EU":return "modal"- # Hard hogland incapabilities: a user/environment custom image or the Pi runtime- # cannot run on hogland's golden, so keep those on Modal even when the flag is on.- # The org default image (default_custom_image) is NOT gated here — hogland serves- # its golden equivalent — nor are the Modal VM-sandbox / network-allowlist flags; a- # flagged run wins hogland over all of them (the caller forces them off).+ # Hard hogland incapabilities: a user/environment custom image, the Pi runtime or a+ # non-default sandbox template cannot run on hogland's golden, so keep those on Modal+ # even when the flag is on. The org default image (default_custom_image) is NOT gated+ # here — hogland serves its golden equivalent — nor are the Modal VM-sandbox /+ # network-allowlist flags; a flagged run wins hogland over all of them (the caller+ # forces them off).+ requested_template = (state or {}).get("sandbox_template")+ if requested_template not in (None, SandboxTemplate.DEFAULT_BASE.value):+ return "modal"if has_user_custom_image or task_runtime == Task.Runtime.PI:return "modal"@@ -1343,6 +1376,7 @@ def get_task_processing_context(input: GetTaskProcessingContextInput) -> TaskProcause=error,) from error+ _require_template_compatible_with_custom_image(state, environment_custom_image_name, run_id=run_id)vm_sandbox_decision = _resolve_modal_vm_sandbox(distinct_id=distinct_id,organization_id=organization_id,diff --git a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.pyindex 4df0fb25b80d..62b227e69007 100644--- a/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py+++ b/products/tasks/backend/temporal/process_task/activities/provision_sandbox.py@@ -55,6 +55,7 @@ from products.tasks.backend.logic.services.sandbox import (get_sandbox_class_for_run_backend,get_sandbox_class_for_sandbox_id,needs_full_history,+ parse_requested_sandbox_template,sandbox_repo_path,workload_for_origin_product,)@@ -616,6 +617,35 @@ def _build_sandbox_tags(return {key: str(value) for key, value in tags.items() if value is not None}+def _requested_sandbox_template(value: str | None) -> SandboxTemplate:+ """The template the run's state asks for. Unknown values and ``VM_BASE`` are fatal."""+ try:+ return parse_requested_sandbox_template(value)+ except ValueError as e:+ raise TaskInvalidStateError(+ f"Invalid sandbox template {value!r}",+ {"sandbox_template": value},+ cause=e,+ )+++def _effective_sandbox_template(*, use_vm_sandbox: bool, requested: SandboxTemplate) -> SandboxTemplate:+ """VM routing forces ``VM_BASE``, which carries none of a custom template's tooling.++ Silently dropping the requested template would provision an agent without the+ libraries its task depends on, so the combination fails instead.+ """+ if not use_vm_sandbox:+ return requested+ if requested != SandboxTemplate.DEFAULT_BASE:+ raise TaskInvalidStateError(+ f"Sandbox template {requested.value!r} cannot run on the VM runtime",+ {"sandbox_template": requested.value},+ cause=ValueError("custom sandbox template on a VM-routed run"),+ )+ return SandboxTemplate.VM_BASE++@activity.defn@asyncifydef prepare_sandbox_for_repository(input: PrepareSandboxForRepositoryInput) -> PrepareSandboxForRepositoryOutput:@@ -627,6 +657,8 @@ def prepare_sandbox_for_repository(input: PrepareSandboxForRepositoryInput) -> P):has_repo = bool(ctx.repositories)repository = ctx.repository+ run_state = parse_run_state(ctx.state)+ sandbox_template = _requested_sandbox_template(run_state.sandbox_template)snapshot = Noneused_snapshot = False@@ -634,9 +666,10 @@ def prepare_sandbox_for_repository(input: PrepareSandboxForRepositoryInput) -> Psnapshot_kind = SNAPSHOT_KIND_FILESYSTEMsnapshot_mount_path: str | None = None# Repo-setup snapshots come from default-base sandboxes; restoring one would silently- # drop the custom base image. Resume snapshots were taken from this task's own sandbox.+ # drop a custom base image or a non-default template. Resume snapshots were taken from+ # this task's own sandbox.snapshot_integration_id = _repository_snapshot_integration_id(ctx, has_repo=has_repo)- if snapshot_integration_id is not None:+ if snapshot_integration_id is not None and sandbox_template == SandboxTemplate.DEFAULT_BASE:with StepTimer("snapshot_lookup",origin_product=ctx.origin_product,@@ -677,7 +710,6 @@ def prepare_sandbox_for_repository(input: PrepareSandboxForRepositoryInput) -> Penvironment_variables = _build_environment_variables(ctx, task, github_token, access_token)- run_state = parse_run_state(ctx.state)# VM and gVisor both resume from snapshots. A run's stored snapshot kind# determines the restore mechanism; the rollout flag only chooses the# kind of new snapshot created after this run.@@ -792,9 +824,15 @@ def _create_sandbox_for_repository(input: CreateSandboxForRepositoryInput) -> Cr# can run nested containers; the default template has neither.use_vm_sandbox = ctx.use_modal_vm_sandboxresource_overrides = ctx.sandbox_resource_overrides()+ # Read from the run context, not the prepare output: a prepare activity claimed by an+ # older worker during a rolling deploy would hand over an output without the template.+ template = _effective_sandbox_template(+ use_vm_sandbox=use_vm_sandbox,+ requested=_requested_sandbox_template(parse_run_state(ctx.state).sandbox_template),+ )config = SandboxConfig(name=prepared.sandbox_name,- template=SandboxTemplate.VM_BASE if use_vm_sandbox else SandboxTemplate.DEFAULT_BASE,+ template=template,workload=workload_for_origin_product(ctx.origin_product),custom_image_name=ctx.custom_image_name if use_vm_sandbox else None,environment_variables=prepared.environment_variables,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 c6e5b5b453ba..50bdb372bfbc 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@@ -46,6 +46,7 @@ from products.tasks.backend.temporal.process_task.activities.get_task_processing_is_pr_babysit_snapshot_enabled,_is_rtk_enabled,_is_sandbox_event_ingest_enabled,+ _require_template_compatible_with_custom_image,_resolve_claude_model_access,_resolve_modal_vm_sandbox,_resolve_sandbox_backend,@@ -1343,6 +1344,27 @@ class TestGetTaskProcessingContextActivity:assert decision.use_vm_sandbox is True+ def test_modal_vm_sandbox_custom_template_forces_gvisor_over_default_base(self):+ # A rollout that names the run's origin cannot move a custom-template run onto the VM+ # image, which carries none of the template's tooling; the flag is not consulted.+ with patch(+ VM_FLAG_PAYLOAD_TARGET,+ return_value='{"default_base_origin_products": ["autoresearch"]}',+ ) as payload_mock:+ assert (+ _resolve_modal_vm_sandbox(+ distinct_id="distinct-id",+ organization_id="organization-id",+ run_id="run-id",+ origin_product="autoresearch",+ allowed_domains=None,+ state={"sandbox_template": "autoresearch_base"},+ ).use_vm_sandbox+ is False+ )++ payload_mock.assert_not_called()+def test_modal_vm_sandbox_false_state_override_forces_gvisor_over_default_base(self):# A trusted server-set use_modal_vm_sandbox=False forces gVisor even when the org's payload# would place this origin on the VM base; the bool override also skips the flag fetch.@@ -1663,6 +1685,24 @@ class TestGetTaskProcessingContextActivity:assert result.initial_permission_mode is None+ "state, custom_image_name, compatible",+ [+ ({"sandbox_template": "autoresearch_base"}, "org-image", False),+ ({"sandbox_template": "autoresearch_base"}, None, True),+ ({"sandbox_template": "default_base"}, "org-image", True),+ ({}, "org-image", True),+ ],+ ids=["template_and_image", "template_only", "default_template_and_image", "image_only"],+)+def test_a_custom_template_cannot_compose_with_a_custom_image(state, custom_image_name, compatible):+ if compatible:+ _require_template_compatible_with_custom_image(state, custom_image_name, run_id="run-1")+ else:+ with pytest.raises(TaskInvalidStateError):+ _require_template_compatible_with_custom_image(state, custom_image_name, run_id="run-1")++_HOGLAND_SETTINGS = {"HOGLAND_API_URL": "https://hogland.example", "HOGLAND_API_TOKEN": "hog-tok"}@@ -1696,13 +1736,14 @@ class TestResolveSandboxBackend:[{"has_user_custom_image": True},{"task_runtime": "pi"},+ {"state": {"sandbox_template": "autoresearch_base"}},],- ids=["user_custom_image", "pi_runtime"],+ ids=["user_custom_image", "pi_runtime", "custom_sandbox_template"],)@override_settings(**_HOGLAND_SETTINGS)def test_hard_incapabilities_fall_back_to_modal_even_with_the_flag_on(self, overrides):- # A real user/environment custom image or the Pi runtime cannot run on hogland's- # golden, so they force Modal even with the flag on. The Modal VM-sandbox /+ # A real user/environment custom image, the Pi runtime or a non-default sandbox template+ # cannot run on hogland's golden, so they force Modal even with the flag on. The Modal VM-sandbox /# network-allowlist preferences and the org default image are deliberately not# gated here — a flagged run wins hogland over them (covered by the caller# force-off test).@@ -1759,14 +1800,17 @@ class TestResolveSandboxBackend:[{"has_user_custom_image": True},{"task_runtime": "pi"},+ {"state": {"sandbox_template": "autoresearch_base"}},],- ids=["user_custom_image", "pi_runtime"],+ ids=["user_custom_image", "pi_runtime", "custom_sandbox_template"],)@override_settings(**_HOGLAND_SETTINGS)def test_hogland_override_cannot_defeat_hard_incapabilities(self, overrides):# A stale or forged hogland override surviving a cloud resume must not route a- # user-custom-image or Pi run to hogland — the capability gates sit ahead of the override.- assert self._resolve_with_flag(True, state={"sandbox_backend": "hogland"}, **overrides) == "modal"+ # user-custom-image, Pi or custom-template run to hogland — the capability gates sit+ # ahead of the override.+ state = {"sandbox_backend": "hogland", **overrides.pop("state", {})}+ assert self._resolve_with_flag(True, state=state, **overrides) == "modal"@override_settings(**_HOGLAND_SETTINGS)def test_modal_override_still_wins_even_when_hogland_is_available(self):diff --git a/products/tasks/backend/temporal/process_task/activities/tests/test_provision_sandbox.py b/products/tasks/backend/temporal/process_task/activities/tests/test_provision_sandbox.pyindex 0e887fb50b12..bb2546c56a66 100644--- a/products/tasks/backend/temporal/process_task/activities/tests/test_provision_sandbox.py+++ b/products/tasks/backend/temporal/process_task/activities/tests/test_provision_sandbox.py@@ -18,7 +18,7 @@ from products.tasks.backend.exceptions import (SandboxRateLimitedError,)from products.tasks.backend.logic.services.docker_sandbox import DockerSandbox-from products.tasks.backend.logic.services.sandbox import ExecutionResult+from products.tasks.backend.logic.services.sandbox import ExecutionResult, SandboxTemplatefrom products.tasks.backend.models import Taskfrom products.tasks.backend.temporal.metrics import modal_sandbox_backend_label, resume_mode_labelfrom products.tasks.backend.temporal.process_task.activities import provision_sandbox as provision_sandbox_module@@ -616,3 +616,36 @@ def test_a_failure_after_create_destroys_the_fresh_sandbox(mocker, failing_step:sandbox.destroy.assert_called_once_with()task_run.clear_sandbox_connection_state_atomic.assert_called_once_with("run-id", "sandbox-id")+++def test_create_reads_the_sandbox_template_from_the_run_context(mocker):+ # The prepare output carries no template on purpose: a prepare activity claimed by an+ # older worker during a rolling deploy returns the old shape.+ context = TaskProcessingContext(+ task_id="task-id",+ run_id="run-id",+ team_id=1,+ team_uuid="team-uuid",+ organization_id="organization-id",+ github_integration_id=123,+ repository="posthog/posthog",+ distinct_id="distinct-id",+ state={"await_user_message": True, "sandbox_template": "autoresearch_base"},+ )+ create = mocker.Mock(+ side_effect=SandboxRateLimitedError("Sandbox control plane is rate limited", {"operation": "create"})+ )+ mocker.patch.object(+ provision_sandbox_module, "get_sandbox_class_for_run_backend", return_value=mocker.Mock(create=create)+ )+ mocker.patch.object(provision_sandbox_module, "emit_agent_log")+ mocker.patch.object(provision_sandbox_module, "_emit_image_source_log")+ mocker.patch.object(provision_sandbox_module, "_apply_modal_network_policy")+ mocker.patch.object(provision_sandbox_module, "_build_sandbox_tags", return_value={})++ with pytest.raises(SandboxRateLimitedError):+ async_to_sync(provision_sandbox_module._create_sandbox_for_repository)(+ CreateSandboxForRepositoryInput(context=context, prepared=_prepared_for_create())+ )++ assert create.call_args.args[0].template == SandboxTemplate.AUTORESEARCH_BASEdiff --git a/products/tasks/backend/temporal/process_task/tests/test_provision_sandbox.py b/products/tasks/backend/temporal/process_task/tests/test_provision_sandbox.pyindex 1af1684a5194..965689ee5345 100644--- a/products/tasks/backend/temporal/process_task/tests/test_provision_sandbox.py+++ b/products/tasks/backend/temporal/process_task/tests/test_provision_sandbox.py@@ -7,8 +7,13 @@ from unittest.mock import MagicMock, patchfrom django.test import override_settingsfrom products.tasks.backend.constants import TASK_SIGNALS_CLONING_BLOBLESS_FEATURE_FLAG-from products.tasks.backend.exceptions import SandboxNetworkPolicyError-from products.tasks.backend.logic.services.sandbox import ExecutionResult, SandboxConfig, needs_full_history+from products.tasks.backend.exceptions import SandboxNetworkPolicyError, TaskInvalidStateError+from products.tasks.backend.logic.services.sandbox import (+ ExecutionResult,+ SandboxConfig,+ SandboxTemplate,+ needs_full_history,+)from products.tasks.backend.models import Taskfrom products.tasks.backend.temporal.process_task.activities.get_task_processing_context import TaskProcessingContextfrom products.tasks.backend.temporal.process_task.activities.provision_sandbox import (@@ -18,7 +23,9 @@ from products.tasks.backend.temporal.process_task.activities.provision_sandbox i_apply_modal_network_policy,_build_environment_variables,_build_sandbox_tags,+ _effective_sandbox_template,_is_blobless_signals_clone_enabled,+ _requested_sandbox_template,_to_modal_domain_allowlist,checkout_branch_in_sandbox,)@@ -472,3 +479,30 @@ def test_build_environment_variables_forwards_run_context_to_token_minting(_api,out = _build_environment_variables(ctx, task, "", "access-token")env.assert_called_once_with(ctx, task)assert out["AI_GATEWAY_TOKEN"] == "phe"+++ "value,expected",+ [(None, SandboxTemplate.DEFAULT_BASE), ("autoresearch_base", SandboxTemplate.AUTORESEARCH_BASE)],+)+def test_requested_sandbox_template_resolves_what_a_task_may_ask_for(value, expected):+ assert _requested_sandbox_template(value) == expected++[email protected]("value", ["vm_base", "streamlit_base", "not-a-template"])+def test_requested_sandbox_template_rejects_what_cannot_host_the_agent(value):+ with pytest.raises(TaskInvalidStateError):+ _requested_sandbox_template(value)+++def test_effective_sandbox_template_only_swaps_the_default_for_the_vm_image():+ assert (+ _effective_sandbox_template(use_vm_sandbox=True, requested=SandboxTemplate.DEFAULT_BASE)+ == SandboxTemplate.VM_BASE+ )+ assert (+ _effective_sandbox_template(use_vm_sandbox=False, requested=SandboxTemplate.AUTORESEARCH_BASE)+ == SandboxTemplate.AUTORESEARCH_BASE+ )+ with pytest.raises(TaskInvalidStateError):+ _effective_sandbox_template(use_vm_sandbox=True, requested=SandboxTemplate.AUTORESEARCH_BASE)diff --git a/products/tasks/backend/temporal/process_task/utils.py b/products/tasks/backend/temporal/process_task/utils.pyindex 8b464eabf514..79f0cad6bd90 100644--- a/products/tasks/backend/temporal/process_task/utils.py+++ b/products/tasks/backend/temporal/process_task/utils.py@@ -356,6 +356,7 @@ class RunState(BaseModel, extra="allow"):slack_thread_url: str | None = Noneinteraction_origin: str | None = Noneslack_sent_relay_ids: list[str] | None = None+ sandbox_template: str | None = Nonedef resume_snapshot_kind(self) -> SnapshotKind:if self.snapshot_kind == SNAPSHOT_KIND_DIRECTORY:diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex a5c98ceb16a7..77243e9f4086 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -6468,6 +6468,7 @@ class TestTaskRunAPI(BaseTaskAPITest):"inactivity_timeout_seconds": 600,"use_modal_directory_resume_snapshots": True,"use_modal_vm_sandbox": False,+ "sandbox_template": "default_base","agent_otel_telemetry_enabled": False,"sandbox_event_ingest_enabled": False,"agent_proxy_keep_stream_open": False,@@ -6538,6 +6539,8 @@ class TestTaskRunAPI(BaseTaskAPITest):"wizard_config": {},"use_modal_directory_resume_snapshots": False,"use_modal_vm_sandbox": True,+ # a VM template here would boot a Docker-capable box past the VM gate+ "sandbox_template": "vm_base","agent_otel_telemetry_enabled": True,"sandbox_event_ingest_enabled": True,"agent_proxy_keep_stream_open": True,@@ -6612,6 +6615,7 @@ class TestTaskRunAPI(BaseTaskAPITest):assert "wizard_config" not in run.state # caller cannot mark a run as a wizard runassert run.state["use_modal_directory_resume_snapshots"] is Trueassert run.state["use_modal_vm_sandbox"] is False+ assert run.state["sandbox_template"] == "default_base"assert run.state["agent_otel_telemetry_enabled"] is Falseassert run.state["sandbox_event_ingest_enabled"] is Falseassert run.state["agent_proxy_keep_stream_open"] is Falsediff --git a/products/tasks/backend/tests/test_models.py b/products/tasks/backend/tests/test_models.pyindex d65062596e03..e685cf5569da 100644--- a/products/tasks/backend/tests/test_models.py+++ b/products/tasks/backend/tests/test_models.py@@ -221,6 +221,108 @@ class TestTask(TestCase):self.assertEqual(task.runtime, Task.Runtime.PI)self.assertEqual(task.origin_product, Task.OriginProduct.SLACK)+ @parameterized.expand(+ [+ ("unknown", {"sandbox_template": "no_such_template"}),+ ("vm", {"sandbox_template": "vm_base"}),+ ("vm_via_extra_run_state", {"extra_run_state": {"sandbox_template": "vm_base"}}),+ ]+ )+ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_create_and_run_rejects_a_template_a_caller_may_not_select(self, _name, kwargs, mock_execute_workflow):+ user = User.objects.create(email="[email protected]")+ Integration.objects.create(team=self.team, kind="github", config={})++ with self.assertRaises(ValueError):+ Task.create_and_run(+ team=self.team,+ title="Slack Task",+ description="Slack Description",+ origin_product=Task.OriginProduct.SLACK,+ user_id=user.id,+ repository="posthog/posthog",+ **kwargs,+ )++ mock_execute_workflow.assert_not_called()+ self.assertEqual(Task.objects.count(), 0)++ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_create_and_run_keeps_the_template_when_extra_run_state_carries_null(self, mock_execute_workflow):+ user = User.objects.create(email="[email protected]")+ Integration.objects.create(team=self.team, kind="github", config={})++ with self.captureOnCommitCallbacks(execute=True):+ Task.create_and_run(+ team=self.team,+ title="Slack Task",+ description="Slack Description",+ origin_product=Task.OriginProduct.SLACK,+ user_id=user.id,+ repository="posthog/posthog",+ sandbox_template="autoresearch_base",+ extra_run_state={"sandbox_template": None},+ )++ state = TaskRun.objects.get(id=mock_execute_workflow.call_args.kwargs["run_id"]).state+ self.assertEqual(state["sandbox_template"], "autoresearch_base")++ @parameterized.expand(+ [+ (Task.OriginProduct.SIGNALS_CHAT,),+ (Task.OriginProduct.SIGNAL_REPORT,),+ (Task.OriginProduct.SIGNALS_SCOUT_SUGGESTIONS,),+ (Task.OriginProduct.AUTORESEARCH,),+ ]+ )+ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_create_and_run_attaches_no_github_integration_to_a_repo_less_restricted_origin(+ self, origin_product, mock_execute_workflow+ ):+ user = User.objects.create(email="[email protected]")+ Integration.objects.create(team=self.team, kind="github", config={})++ with self.captureOnCommitCallbacks(execute=True):+ task = Task.create_and_run(+ team=self.team,+ title="Repo-less task",+ description="No repository",+ origin_product=origin_product,+ user_id=user.id,+ )++ self.assertIsNone(task.github_integration)+ self.assertIsNone(task.github_user_integration)++ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_create_run_keeps_the_previous_template_and_refuses_a_forbidden_one(self, mock_execute_workflow):+ user = User.objects.create(email="[email protected]")+ Integration.objects.create(team=self.team, kind="github", config={})++ with self.captureOnCommitCallbacks(execute=True):+ task = Task.create_and_run(+ team=self.team,+ title="Slack Task",+ description="Slack Description",+ origin_product=Task.OriginProduct.SLACK,+ user_id=user.id,+ repository="posthog/posthog",+ sandbox_template="autoresearch_base",+ )+ first_run = TaskRun.objects.get(id=mock_execute_workflow.call_args.kwargs["run_id"])+ self.assertEqual(first_run.state["sandbox_template"], "autoresearch_base")++ with self.captureOnCommitCallbacks(execute=True):+ later_run = task.create_run()+ null_run = task.create_run(extra_state={"sandbox_template": None})++ self.assertEqual(later_run.state["sandbox_template"], "autoresearch_base")+ self.assertEqual(null_run.state["sandbox_template"], "autoresearch_base")++ with self.assertRaises(ValueError):+ task.create_run(extra_state={"sandbox_template": "vm_base"})+ self.assertEqual(TaskRun.objects.filter(task=task).count(), 3)+@patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")def test_create_and_run_threads_attribution_stamps_into_state(self, mock_execute_workflow):user = User.objects.create(email="[email protected]")diff --git a/products/tasks/frontend/generated/api.schemas.ts b/products/tasks/frontend/generated/api.schemas.tsindex b1a57531a2d4..14eec86e4033 100644--- a/products/tasks/frontend/generated/api.schemas.ts+++ b/products/tasks/frontend/generated/api.schemas.ts@@ -1999,6 +1999,7 @@ export interface PaginatedTaskListItemListApi {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -2025,6 +2026,7 @@ export const TaskOriginProductEnumApi = {PosthogAi: 'posthog_ai',Experiments: 'experiments',SignalReport: 'signal_report',+ Autoresearch: 'autoresearch',SignalsScout: 'signals_scout',ScoutSuggestions: 'scout_suggestions',SupportReply: 'support_reply',@@ -2083,6 +2085,7 @@ export interface TaskCreateApi {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -2304,6 +2307,7 @@ export interface TaskWriteApi {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -2437,6 +2441,7 @@ export interface PatchedTaskWriteApi {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -5663,6 +5668,7 @@ export type TasksListParams = {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -5803,6 +5809,7 @@ export const TasksListExcludeOriginProduct = {PosthogAi: 'posthog_ai',Experiments: 'experiments',SignalReport: 'signal_report',+ Autoresearch: 'autoresearch',SignalsScout: 'signals_scout',ScoutSuggestions: 'scout_suggestions',SupportReply: 'support_reply',diff --git a/products/tasks/frontend/generated/api.zod.ts b/products/tasks/frontend/generated/api.zod.tsindex de86a5e18ab8..6c36881b13db 100644--- a/products/tasks/frontend/generated/api.zod.ts+++ b/products/tasks/frontend/generated/api.zod.ts@@ -1289,6 +1289,7 @@ export const TasksCreateBody = /* @__PURE__ */ zod.object({'posthog_ai','experiments','signal_report',+ 'autoresearch','signals_scout','scout_suggestions','support_reply',@@ -1303,11 +1304,11 @@ export const TasksCreateBody = /* @__PURE__ */ zod.object({'space_setup',]).describe(- '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup').optional().describe(- 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'),repository: zod.string()@@ -1478,6 +1479,7 @@ export const TasksUpdateBody = /* @__PURE__ */ zod.object({'posthog_ai','experiments','signal_report',+ 'autoresearch','signals_scout','scout_suggestions','support_reply',@@ -1492,11 +1494,11 @@ export const TasksUpdateBody = /* @__PURE__ */ zod.object({'space_setup',]).describe(- '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup').optional().describe(- 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'),repository: zod.string()@@ -1631,6 +1633,7 @@ export const TasksPartialUpdateBody = /* @__PURE__ */ zod.object({'posthog_ai','experiments','signal_report',+ 'autoresearch','signals_scout','scout_suggestions','support_reply',@@ -1645,11 +1648,11 @@ export const TasksPartialUpdateBody = /* @__PURE__ */ zod.object({'space_setup',]).describe(- '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup').optional().describe(- 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'),repository: zod.string()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex abbf7f61cebd..5c33da6b782e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -76626,6 +76626,7 @@ export namespace Schemas {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -76653,6 +76654,7 @@ export namespace Schemas {PosthogAi: 'posthog_ai',Experiments: 'experiments',SignalReport: 'signal_report',+ Autoresearch: 'autoresearch',SignalsScout: 'signals_scout',ScoutSuggestions: 'scout_suggestions',SupportReply: 'support_reply',@@ -76711,6 +76713,7 @@ export namespace Schemas {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -95447,6 +95450,7 @@ export namespace Schemas {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -97037,6 +97041,7 @@ export namespace Schemas {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -113825,6 +113830,7 @@ export namespace Schemas {* * `posthog_ai` - PostHog AI* * `experiments` - Experiments* * `signal_report` - Signal Report+ * * `autoresearch` - Autoresearch* * `signals_scout` - Signals Scout* * `scout_suggestions` - Signals Scout Suggestions* * `support_reply` - Support Reply@@ -113968,6 +113974,7 @@ export namespace Schemas {PosthogAi: 'posthog_ai',Experiments: 'experiments',SignalReport: 'signal_report',+ Autoresearch: 'autoresearch',SignalsScout: 'signals_scout',ScoutSuggestions: 'scout_suggestions',SupportReply: 'support_reply',diff --git a/services/mcp/src/generated/tasks/api.ts b/services/mcp/src/generated/tasks/api.tsindex d1fb2cd149ba..9ba5815899f3 100644--- a/services/mcp/src/generated/tasks/api.ts+++ b/services/mcp/src/generated/tasks/api.ts@@ -926,6 +926,7 @@ export const TasksListQueryParams = () => zod.object({'posthog_ai','experiments','signal_report',+ 'autoresearch','signals_scout','scout_suggestions','support_reply',@@ -941,7 +942,7 @@ export const TasksListQueryParams = () => zod.object({]).optional().describe(- 'Exclude tasks with this origin product from the results\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ 'Exclude tasks with this origin product from the results\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'),hog_flow_id: zod.string()@@ -1057,6 +1058,7 @@ export const TasksCreateBody = () => zod.object({'posthog_ai','experiments','signal_report',+ 'autoresearch','signals_scout','scout_suggestions','support_reply',@@ -1071,11 +1073,11 @@ export const TasksCreateBody = () => zod.object({'space_setup',]).describe(- '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ '\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup').optional().describe(- 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'+ 'PostHog product or surface that created this task (e.g. error_tracking, slack, user_created). Origins reserved for server-created agents cannot be set through this API.\n\n\* `onboarding` - Onboarding\n\* `error_tracking` - Error Tracking\n\* `eval_clusters` - Eval Clusters\n\* `user_created` - User Created\n\* `slack` - Slack\n\* `support_queue` - Support Queue\n\* `session_summaries` - Session Summaries\n\* `posthog_ai` - PostHog AI\n\* `experiments` - Experiments\n\* `signal_report` - Signal Report\n\* `autoresearch` - Autoresearch\n\* `signals_scout` - Signals Scout\n\* `scout_suggestions` - Signals Scout Suggestions\n\* `support_reply` - Support Reply\n\* `hogdesk` - HogDesk\n\* `review_hog` - ReviewHog\n\* `image_builder` - Image Builder\n\* `loop` - Loop\n\* `mcp_analytics` - MCP Analytics\n\* `signals_chat` - Signals Chat\n\* `task_analysis` - Task Analysis\n\* `workflow` - Workflow\n\* `space_setup` - Space Setup'),repository: zod.string()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.jsonindex 1e873368909e..7e0895bfe3e1 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/tasks-list.json@@ -39,7 +39,7 @@"type": "number"},"exclude_origin_product": {- "description": "Exclude tasks with this origin product from the results\n\n* `onboarding` - Onboarding\n* `error_tracking` - Error Tracking\n* `eval_clusters` - Eval Clusters\n* `user_created` - User Created\n* `slack` - Slack\n* `support_queue` - Support Queue\n* `session_summaries` - Session Summaries\n* `posthog_ai` - PostHog AI\n* `experiments` - Experiments\n* `signal_report` - Signal Report\n* `signals_scout` - Signals Scout\n* `scout_suggestions` - Signals Scout Suggestions\n* `support_reply` - Support Reply\n* `hogdesk` - HogDesk\n* `review_hog` - ReviewHog\n* `image_builder` - Image Builder\n* `loop` - Loop\n* `mcp_analytics` - MCP Analytics\n* `signals_chat` - Signals Chat\n* `task_analysis` - Task Analysis\n* `workflow` - Workflow\n* `space_setup` - Space Setup",+ "description": "Exclude tasks with this origin product from the results\n\n* `onboarding` - Onboarding\n* `error_tracking` - Error Tracking\n* `eval_clusters` - Eval Clusters\n* `user_created` - User Created\n* `slack` - Slack\n* `support_queue` - Support Queue\n* `session_summaries` - Session Summaries\n* `posthog_ai` - PostHog AI\n* `experiments` - Experiments\n* `signal_report` - Signal Report\n* `autoresearch` - Autoresearch\n* `signals_scout` - Signals Scout\n* `scout_suggestions` - Signals Scout Suggestions\n* `support_reply` - Support Reply\n* `hogdesk` - HogDesk\n* `review_hog` - ReviewHog\n* `image_builder` - Image Builder\n* `loop` - Loop\n* `mcp_analytics` - MCP Analytics\n* `signals_chat` - Signals Chat\n* `task_analysis` - Task Analysis\n* `workflow` - Workflow\n* `space_setup` - Space Setup","enum": ["onboarding","error_tracking",@@ -51,6 +51,7 @@"posthog_ai","experiments","signal_report",+ "autoresearch","signals_scout","scout_suggestions","support_reply",