: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): add pi task runtime (#71541)
Jonathan Mielooa441b9ce3372
diff --git a/ee/api/conversation.py b/ee/api/conversation.pyindex 4cb341c1b123..e3c9e1e92a34 100644--- a/ee/api/conversation.py+++ b/ee/api/conversation.py@@ -213,6 +213,14 @@ class SandboxAttachedContextItemSerializer(serializers.Serializer):value = serializers.CharField(required=False, help_text="Free-text content. Only for `text` attachments.")+def _validate_sandbox_task(task_id: uuid.UUID, team_id: int, user_id: int | None) -> None:+ runtime = tasks_facade.task_runtime(task_id, team_id, user_id)+ if runtime is None:+ raise serializers.ValidationError("Task not found or not accessible.")+ if runtime == tasks_facade.TaskRuntime.PI:+ raise serializers.ValidationError("Pi tasks cannot be opened in PostHog AI.")++class SandboxOpenSerializer(serializers.Serializer):"""Request body for `POST /conversations/{id}/open/`. A string `content` processes a turn; anull/absent `content` warms a sandbox that idles awaiting the first message."""@@ -258,8 +266,7 @@ class SandboxOpenSerializer(serializers.Serializer):"""team = self.context["team"]user = self.context["user"]- if not tasks_facade.task_visible(value, team.id, user.id):- raise serializers.ValidationError("Task not found or not accessible.")+ _validate_sandbox_task(value, team.id, user.id)return value@@ -680,7 +687,7 @@ class ConversationViewSet(responses={200: SandboxMessageResponseSerializer,204: OpenApiResponse(description="Warm request that provisioned nothing (pool full / released)."),- 400: OpenApiResponse(description="Conversation is not on the sandbox runtime."),+ 400: OpenApiResponse(description="Conversation or task uses an unsupported runtime."),},description=("Create-or-resume a sandbox conversation — the single sandbox session opener. With `content`, "@@ -702,6 +709,9 @@ class ConversationViewSet(conversation, created = self._get_or_create_sandbox_conversation(request, bind_task=serializer.validated_data.get("task_id"))+ if conversation.task_id is not None:+ _validate_sandbox_task(conversation.task_id, self.team.id, request.user.id)+has_content = bool(serializer.validated_data.get("content"))convert_to_acp, resumed_context = self._compute_sandbox_conversion(request, conversation, has_content)diff --git a/ee/api/tests/test_conversation.py b/ee/api/tests/test_conversation.pyindex 5fed1f03bced..9254166e4eaa 100644--- a/ee/api/tests/test_conversation.py+++ b/ee/api/tests/test_conversation.py@@ -1381,6 +1381,58 @@ class TestConversationSandboxRoute(APIBaseTest):self.assertEqual(passed_conversation.task_id, task.id)self.mock_select_repo.assert_not_awaited()+ def test_open_rejects_binding_a_pi_task(self):+ task = Task.objects.create(+ team=self.team,+ title="t",+ description="d",+ origin_product=Task.OriginProduct.POSTHOG_AI,+ runtime=Task.Runtime.PI,+ created_by=self.user,+ )+ conversation_id = str(uuid.uuid4())++ with (+ patch("ee.api.conversation.has_sandbox_mode_feature_flag", return_value=True),+ patch("ee.api.conversation.SandboxSession") as m_session,+ ):+ response = self.client.post(+ f"/api/environments/{self.team.id}/conversations/{conversation_id}/open/",+ {"content": "continue this task", "trace_id": str(uuid.uuid4()), "task_id": str(task.id)},+ format="json",+ )++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertFalse(Conversation.objects.filter(id=conversation_id).exists())+ m_session.return_value.open.assert_not_called()++ def test_open_rejects_existing_pi_task_conversation(self):+ task = Task.objects.create(+ team=self.team,+ title="t",+ description="d",+ origin_product=Task.OriginProduct.POSTHOG_AI,+ runtime=Task.Runtime.PI,+ created_by=self.user,+ )+ conversation = Conversation.objects.create(+ user=self.user,+ team=self.team,+ type=Conversation.Type.ASSISTANT,+ agent_runtime=Conversation.AgentRuntime.SANDBOX,+ task=task,+ )++ with patch("ee.api.conversation.SandboxSession") as m_session:+ response = self.client.post(+ f"/api/environments/{self.team.id}/conversations/{conversation.id}/open/",+ {"content": "continue this task", "trace_id": str(uuid.uuid4())},+ format="json",+ )++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ m_session.return_value.open.assert_not_called()+def test_open_rejects_task_id_from_another_team(self):# IDOR guard: a Task from another team isn't visible, so the serializer rejects it (400) and# no conversation row is created.diff --git a/ee/hogai/api/serializers.py b/ee/hogai/api/serializers.pyindex 1e19477b37dc..428c1e348b31 100644--- a/ee/hogai/api/serializers.py+++ b/ee/hogai/api/serializers.py@@ -188,6 +188,11 @@ class TaskSerializer(DataclassSerializer):latest_run = TaskRunDetailSerializer(allow_null=True, required=False, help_text="Latest run details for this task")created_by = TaskUserBasicInfoSerializer(allow_null=True, required=False)+ runtime = serializers.ChoiceField(+ choices=tasks_facade.TaskRuntime.choices,+ read_only=True,+ help_text="Agent protocol and harness used for this task's runs.",+ )class Meta:dataclass = TaskDetailDTO@@ -199,6 +204,7 @@ class TaskSerializer(DataclassSerializer):"title_manually_set","description","origin_product",+ "runtime","repository","github_integration","github_user_integration",diff --git a/ee/hogai/api/tests/test_serializers.py b/ee/hogai/api/tests/test_serializers.pyindex 75bafea291e1..13fa9c939f06 100644--- a/ee/hogai/api/tests/test_serializers.py+++ b/ee/hogai/api/tests/test_serializers.py@@ -343,6 +343,7 @@ class TestConversationSerializerTaskField(APIBaseTest):title_manually_set=False,description="d",origin_product=Task.OriginProduct.POSTHOG_AI,+ runtime=Task.Runtime.ACP,repository=None,github_integration=None,github_user_integration=None,@@ -362,6 +363,7 @@ class TestConversationSerializerTaskField(APIBaseTest):data = TaskSerializer(task_dto).dataassert task_dto.latest_run is not None+ self.assertEqual(data["runtime"], Task.Runtime.ACP)self.assertEqual(data["latest_run"]["id"], str(task_dto.latest_run.id))def test_conversation_task_serializer_outputs_latest_run_id(self):diff --git a/frontend/src/scenes/inbox/components/detail/AgentRunDetail.tsx b/frontend/src/scenes/inbox/components/detail/AgentRunDetail.tsxindex 38037c7b9cef..4da6ab051dbb 100644--- a/frontend/src/scenes/inbox/components/detail/AgentRunDetail.tsx+++ b/frontend/src/scenes/inbox/components/detail/AgentRunDetail.tsx@@ -23,7 +23,8 @@ import { urls } from 'scenes/urls'import { isTerminalRunStatus } from 'products/posthog_ai/frontend/api/logics'import { TaskRunStatusDot } from 'products/posthog_ai/frontend/api/primitives'import { ReadonlyRunSurface } from 'products/posthog_ai/frontend/api/readableRun'-import { Task, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'+import { isPiTaskRuntime, Task, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'+import type { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'import { SignalCard } from '../../SignalCard'@@ -225,10 +226,22 @@ function TaskLogBody({* open a new tab, carrying the bind via the `bind_task` URL param. Gated to a terminal run — the live* Task log already covers an in-progress run, and taking over a running automation run is out of scope.*/-export function OpenTaskButton({ taskId, runStatus }: { taskId: string; runStatus?: TaskRunStatus }): JSX.Element {+export function OpenTaskButton({+ taskId,+ runStatus,+ runtime,+}: {+ taskId: string+ runStatus?: TaskRunStatus+ runtime: RuntimeEnumApi+}): JSX.Element | null {const { openSidePanelMaxWithTaskBind } = useActions(maxGlobalLogic)const isTerminal = isTerminalRunStatus(runStatus)+ if (isPiTaskRuntime(runtime)) {+ return null+ }+return (<LemonButtonsize="small"@@ -283,7 +296,7 @@ function TaskLogSection({ report }: { report: SignalReport }): JSX.Element {}))}/>)}- <OpenTaskButton taskId={task.id} runStatus={runStatus} />+ <OpenTaskButton taskId={task.id} runStatus={runStatus} runtime={task.runtime} /></div>) : nulldiff --git a/frontend/src/scenes/inbox/inboxSceneLogic.test.ts b/frontend/src/scenes/inbox/inboxSceneLogic.test.tsindex f0997bf4dba9..1f606a253619 100644--- a/frontend/src/scenes/inbox/inboxSceneLogic.test.ts+++ b/frontend/src/scenes/inbox/inboxSceneLogic.test.ts@@ -1,4 +1,5 @@import { OriginProduct, Task, TaskRun, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'import { mergeSignalRuns } from './inboxSceneLogic'import { SignalScoutRunSummary } from './types'@@ -30,6 +31,7 @@ function signalTask(overrides: Partial<Task> = {}): Task {title: 'Crash on login',description: '',origin_product: OriginProduct.SIGNAL_REPORT,+ runtime: RuntimeEnumApi.Acp,repository: null,github_integration: null,signal_report: 'report-1',diff --git a/frontend/src/scenes/max/Thread.tsx b/frontend/src/scenes/max/Thread.tsxindex 7884d04ca420..dbc70d3fcb6c 100644--- a/frontend/src/scenes/max/Thread.tsx+++ b/frontend/src/scenes/max/Thread.tsx@@ -21,6 +21,7 @@ import {IconX,} from '@posthog/icons'import {+ LemonBanner,LemonButton,LemonButtonPropsBase,LemonCheckbox,@@ -76,6 +77,7 @@ import {ThreadView,} from 'products/posthog_ai/frontend/api/primitives'import { LogEntry } from 'products/posthog_ai/frontend/lib/parse-logs'+import { isPiTaskRuntime } from 'products/posthog_ai/frontend/types/taskTypes'import { LangGraphActivity, ShimmeringContent } from './components/Activity'import { FeedbackDisplay } from './components/FeedbackDisplay'@@ -120,12 +122,17 @@ function isErrorMessage(message: ThreadMessage): boolean {export function Thread({ className }: { className?: string }): JSX.Element | null {const { conversation, sandboxConversationKey, isConvertedConversation } = useValues(maxThreadLogic)const isSandboxRuntime = conversation?.agent_runtime === 'sandbox'+ const isPiTask = isPiTaskRuntime(conversation?.task?.runtime)const containerClassName = cn('@container/thread flex flex-col items-stretch w-full max-w-180 self-center gap-1.5 grow mx-auto',className)+ if (isPiTask) {+ return <LemonBanner type="info">Pi session logs aren't available in PostHog yet.</LemonBanner>+ }+// Born-sandbox conversation (no legacy history): render only the sandbox thread.if (isSandboxRuntime && !isConvertedConversation) {if (!sandboxConversationKey) {diff --git a/frontend/src/scenes/max/components/SidebarQuestionInput.tsx b/frontend/src/scenes/max/components/SidebarQuestionInput.tsxindex c2bb9eded9d4..a97ebdc2d75c 100644--- a/frontend/src/scenes/max/components/SidebarQuestionInput.tsx+++ b/frontend/src/scenes/max/components/SidebarQuestionInput.tsx@@ -10,6 +10,8 @@ import { LemonButton } from '@posthog/lemon-ui'import { useAnimatedPresence } from 'lib/hooks/useAnimatedPresence'import { cn } from 'lib/utils/css-classes'+import { isPiTaskRuntime } from 'products/posthog_ai/frontend/types/taskTypes'+import { SuggestionGroup, maxLogic } from '../maxLogic'import { maxThreadLogic } from '../maxThreadLogic'import { InputFormArea, SandboxModeBadge } from './InputFormArea'@@ -21,7 +23,7 @@ export function SidebarQuestionInput({}: {isSticky?: booleansidePanel?: boolean-}): JSX.Element {+}): JSX.Element | null {const { focusCounter, threadVisible } = useValues(maxLogic)// Use raw state values instead of selector to ensure re-renders on state changes@@ -32,6 +34,7 @@ export function SidebarQuestionInput({pendingApprovalsData,resolvedApprovalStatuses,pendingSandboxPermissionRequest,+ conversation,} = useValues(maxThreadLogic)// A pending sandbox request only originates from the sandbox stream, so its presence alone is// enough — gating on `agent_runtime` would strand approvals on as-yet-unresolved conversations.@@ -64,6 +67,10 @@ export function SidebarQuestionInput({}}, [focusCounter]) // Update focus when focusCounter changes+ if (isPiTaskRuntime(conversation?.task?.runtime)) {+ return null+ }+// Show form area directly when there's a pending form/approval (even if showInput is false)if (activeMultiQuestionForm || hasApprovalToShow || hasSandboxPermissionToShow) {return (diff --git a/frontend/src/scenes/max/maxThreadLogic.test.ts b/frontend/src/scenes/max/maxThreadLogic.test.tsindex f4eb656f0fcc..faa83e5bcd1c 100644--- a/frontend/src/scenes/max/maxThreadLogic.test.ts+++ b/frontend/src/scenes/max/maxThreadLogic.test.ts@@ -31,6 +31,7 @@ import { initKeaTests } from '~/test/init'import { Conversation, ConversationDetail, ConversationStatus, ConversationType } from '~/types'import { attachedContextLogic, runStreamLogic } from 'products/posthog_ai/frontend/api/logics'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'import { EnhancedToolCall, TOOL_DEFINITIONS } from './max-constants'import { maxContextLogic } from './maxContextLogic'@@ -713,6 +714,22 @@ describe('maxThreadLogic', () => {featureFlagLogic.unmount()})+ it('does not queue prompts for a Pi task', async () => {+ const enqueueSpy = jest.spyOn(api.conversations.queue, 'enqueue')+ const conversation: ConversationDetail = {+ ...MOCK_IN_PROGRESS_CONVERSATION,+ agent_runtime: 'sandbox',+ task: { id: 'pi-task', latest_run: 'pi-run', runtime: RuntimeEnumApi.Pi },+ }++ logic.actions.setConversation(conversation)+ await new Promise((resolve) => setTimeout(resolve, 0))+ logic.actions.askMax('Queued prompt')+ await new Promise((resolve) => setTimeout(resolve, 0))++ expect(enqueueSpy).not.toHaveBeenCalled()+ })+it('queues prompts while loading and omits null fields', async () => {const enqueueSpy = jest.spyOn(api.conversations.queue, 'enqueue').mockResolvedValue({messages: [],@@ -1675,7 +1692,10 @@ describe('maxThreadLogic', () => {const SANDBOX_TASK_ID = 'task-abc'const SANDBOX_RUN_ID = 'run-abc'- function sandboxConversation(currentRunId: string | null): ConversationDetail {+ function sandboxConversation(+ currentRunId: string | null,+ runtime: RuntimeEnumApi = RuntimeEnumApi.Acp+ ): ConversationDetail {return {id: MOCK_CONVERSATION_ID,status: ConversationStatus.InProgress,@@ -1685,7 +1705,7 @@ describe('maxThreadLogic', () => {updated_at: new Date().toISOString(),type: ConversationType.Assistant,agent_runtime: 'sandbox',- task: { id: SANDBOX_TASK_ID, latest_run: currentRunId },+ task: { id: SANDBOX_TASK_ID, latest_run: currentRunId, runtime },messages: [],}}@@ -1714,6 +1734,25 @@ describe('maxThreadLogic', () => {expect(streamSpy).not.toHaveBeenCalled()})+ it('does not bootstrap a Pi task run', async () => {+ logic.unmount()+ const conversation = sandboxConversation(SANDBOX_RUN_ID, RuntimeEnumApi.Pi)+ jest.spyOn(api.conversations, 'get').mockResolvedValue(conversation)+ const logsSpy = jest.spyOn(api.tasks.runs, 'getLogEntries')+ const streamSpy = mockStream()++ logic = maxThreadLogic({+ conversationId: MOCK_CONVERSATION_ID,+ panelId: 'test',+ conversation,+ })+ logic.mount()+ await new Promise((resolve) => setTimeout(resolve, 0))++ expect(logsSpy).not.toHaveBeenCalled()+ expect(streamSpy).not.toHaveBeenCalled()+ })+it('does not bootstrap a sandbox run without a latest_run', async () => {logic.unmount()jest.spyOn(api.conversations, 'get').mockResolvedValue(sandboxConversation(null))@@ -3530,6 +3569,38 @@ describe('maxThreadLogic', () => {delete (globalThis as any).EventSource})+ it('does not open a sandbox conversation bound to a Pi task', async () => {+ maxLogicInstance.actions.setPendingBindTaskId('pi-task')+ const taskSpy = jest+ .spyOn(api.tasks, 'get')+ .mockResolvedValue({ id: 'pi-task', runtime: RuntimeEnumApi.Pi } as any)+ const openSpy = jest.spyOn(api.conversations, 'open')++ logic.actions.askMax('hello')+ await Promise.resolve()+ await Promise.resolve()++ expect(taskSpy).toHaveBeenCalledTimes(1)+ expect(taskSpy).toHaveBeenCalledWith('pi-task')+ expect(openSpy).not.toHaveBeenCalled()+ expect(maxLogicInstance.values.activeStreamingThreads).toEqual(0)+ })++ it('validates a pending ACP task once before opening the conversation', async () => {+ maxLogicInstance.actions.setPendingBindTaskId('acp-task')+ const taskSpy = jest+ .spyOn(api.tasks, 'get')+ .mockResolvedValue({ id: 'acp-task', runtime: RuntimeEnumApi.Acp } as any)+ jest.spyOn(api.conversations, 'open').mockResolvedValue(sandboxRunResponse)++ await expectLogic(logic, () => {+ logic.actions.askMax('hello')+ }).toDispatchActions(['openSandboxSse'])++ expect(taskSpy).toHaveBeenCalledTimes(1)+ expect(taskSpy).toHaveBeenCalledWith('acp-task')+ })+it('holds the streaming lock until the sandbox turn completes and releases exactly once', async () => {const openSpy = jest.spyOn(api.conversations, 'open').mockResolvedValue(sandboxRunResponse)diff --git a/frontend/src/scenes/max/maxThreadLogic.tsx b/frontend/src/scenes/max/maxThreadLogic.tsxindex 0b88e9a6781e..4a1af9f0be04 100644--- a/frontend/src/scenes/max/maxThreadLogic.tsx+++ b/frontend/src/scenes/max/maxThreadLogic.tsx@@ -73,6 +73,7 @@ import {runStreamLogic,} from 'products/posthog_ai/frontend/api/logics'import { LogEntry, parseLogEvent } from 'products/posthog_ai/frontend/lib/parse-logs'+import { isPiTaskRuntime } from 'products/posthog_ai/frontend/types/taskTypes'import type { PermissionRequestRecord } from '../../../../products/posthog_ai/frontend/types/streamTypes'import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'@@ -129,6 +130,21 @@ export interface MaxThreadLogicProps {skipInitialLoad?: boolean}+async function shouldBlockPendingPiTask(pendingBindTaskId: string): Promise<boolean> {+ try {+ const pendingTask = await api.tasks.get(pendingBindTaskId)+ if (!isPiTaskRuntime(pendingTask.runtime)) {+ return false+ }++ lemonToast.error("Pi tasks aren't available in PostHog AI yet.")+ return true+ } catch {+ lemonToast.error("Couldn't load this task. Please try again.")+ return true+ }+}+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface maxThreadLogicValues {featureFlags: FeatureFlagsSet // featureFlagLogic@@ -1214,6 +1230,11 @@ export const maxThreadLogic = kea<maxThreadLogicType>([breakpoint) => {const { actions, values, cache, mount, props } = logic as BuiltLogic<maxThreadLogicType>++ if (isPiTaskRuntime(values.conversation?.task?.runtime)) {+ return+ }+// Set active streaming threads, so we know streaming is activeconst releaseStreamingLock = mount() // lock the logic - don't unmount before we're done streamingactions.incrActiveStreamingThreads()@@ -1877,6 +1898,17 @@ export const maxThreadLogic = kea<maxThreadLogicType>([if (values.conversationId !== values.activeThreadKey) {return}+ if (isPiTaskRuntime(values.conversation?.task?.runtime)) {+ return+ }+ if (+ !values.conversation?.task &&+ values.pendingBindTaskId &&+ (await shouldBlockPendingPiTask(values.pendingBindTaskId))+ ) {+ return+ }+// A sent message consumes any sandbox pre-warm: the warm Run is the in-progress run the// sandbox routing follows up on, so cancel pending timers and clear the flag WITHOUT// issuing a release/DELETE.@@ -2921,6 +2953,10 @@ export const maxThreadLogic = kea<maxThreadLogicType>([// runStreamLogic, which replays logs/ then opens SSE if non-terminal. The LangGraph// reconnect path below is never entered for sandbox runtimes (coexistence).if (conversation.agent_runtime === 'sandbox') {+ if (isPiTaskRuntime(conversation.task?.runtime)) {+ return+ }+// runStreamLogic and posthogAiContextLogic are connected (so already mounted) for this// conversation. Reset their per-conversation state before replaying this run's history.actions.resetSandboxStream()diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 0227e1b93556..e94f2d561158 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -82,6 +82,7 @@ import { AlertType } from 'products/alerts/frontend/types'import type { ExperimentFeatureFlagInputApi } from 'products/experiments/frontend/generated/api.schemas'import type { InsightFilterOverrideContextApi } from 'products/product_analytics/frontend/generated/api.schemas'import type { AIPromptConfigApi } from 'products/subscriptions/frontend/generated/api.schemas'+import type { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'import { CyclotronInputType } from 'products/workflows/frontend/Workflows/hogflows/steps/types'import type { HogFlow } from 'products/workflows/frontend/Workflows/hogflows/types'@@ -7465,7 +7466,7 @@ export interface Conversation {*/agent_runtime?: 'langgraph' | 'sandbox'/** Backing products/tasks Task for sandbox conversations. Null until the first message creates it. `latest_run` is the newest TaskRun id used to bootstrap the sandbox stream. */- task?: { id: string; latest_run: string | null } | null+ task?: { id: string; latest_run: string | null; runtime?: RuntimeEnumApi } | null}export interface ConversationDetail extends Conversation {diff --git a/products/conversations/frontend/generated/api.schemas.ts b/products/conversations/frontend/generated/api.schemas.tsindex 2eecd2e1f959..6b9d28baa37f 100644--- a/products/conversations/frontend/generated/api.schemas.ts+++ b/products/conversations/frontend/generated/api.schemas.ts@@ -115,6 +115,17 @@ export const ConversationTypeApi = {Slack: 'slack',} as const+/**+ * * `acp` - ACP+ * * `pi` - Pi+ */+export type RuntimeEnumApi = (typeof RuntimeEnumApi)[keyof typeof RuntimeEnumApi]++export const RuntimeEnumApi = {+ Acp: 'acp',+ Pi: 'pi',+} as const+/*** @nullable*/@@ -160,6 +171,11 @@ export interface TaskDetailDTOApi {title_manually_set: booleandescription: stringorigin_product: string+ /** Agent protocol and harness used for this task's runs.+ *+ * * `acp` - ACP+ * * `pi` - Pi */+ readonly runtime: RuntimeEnumApi/** @nullable */repository: string | null/** @nullable */diff --git a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsxindex 077c88e207d4..7c2f6fb0260a 100644--- a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx+++ b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx@@ -3,6 +3,8 @@ import '@testing-library/jest-dom'import { cleanup, render, screen } from '@testing-library/react'import { useActions, useValues } from 'kea'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import type { PermissionRequestRecord } from '../types/streamTypes'import ReadonlyRunSurfaceImpl from './ReadonlyRunSurfaceImpl'@@ -34,8 +36,10 @@ function setValues(overrides: Partial<{ pendingPermissionRequest: PermissionRequthreadItems: [{ id: 'x' }],pendingPermissionRequest: null,currentRunStatus: 'in_progress',- task: null,+ task: { origin_product: 'user_created', runtime: RuntimeEnumApi.Acp },taskLoading: false,+ taskError: null,+ taskNotFound: false,...overrides,})}diff --git a/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx b/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsxindex 466e30eb01c3..b83f65035982 100644--- a/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx+++ b/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx@@ -3,6 +3,8 @@ import '@testing-library/jest-dom'import { cleanup, render, screen } from '@testing-library/react'import { useActions, useValues } from 'kea'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import type { RunStatus } from '../logics/runStreamLogic'import type { PermissionRequestRecord } from '../types/streamTypes'import { RunSurface } from './RunSurfaceImpl'@@ -35,6 +37,7 @@ function setValues(pendingPermissionRequest: PermissionRequestRecord | nullbootstrapLoading: booleanthreadItems: unknown[]+ task: { origin_product: string; runtime?: RuntimeEnumApi } | null}>): void {;(useValues as jest.Mock).mockReturnValue({@@ -42,8 +45,10 @@ function setValues(threadItems: [],pendingPermissionRequest: null,currentRunStatus: 'in_progress',- task: null,+ task: { origin_product: 'user_created', runtime: RuntimeEnumApi.Acp },taskLoading: false,+ taskError: null,+ taskNotFound: false,...overrides,})}@@ -76,6 +81,36 @@ describe('RunSurface', () => {cleanup()})+ it('does not mount the ACP run surface for a Pi task', () => {+ setValues({ task: { origin_product: 'user_created', runtime: RuntimeEnumApi.Pi } })++ render(+ <RunSurface.Root taskId="task-1" runId="run-1" interaction="live">+ <RunSurface.Thread />+ <RunSurface.Composer>+ <div data-attr="composer-child" />+ </RunSurface.Composer>+ </RunSurface.Root>+ )++ expect(screen.getByText("Pi session logs aren't available in PostHog yet.")).toBeInTheDocument()+ expect(screen.queryByTestId('thread')).not.toBeInTheDocument()+ expect(screen.queryByTestId('composer')).not.toBeInTheDocument()+ })++ it('keeps the ACP run surface available when an older API response omits runtime', () => {+ setValues({ task: { origin_product: 'user_created' } })++ render(+ <RunSurface.Root taskId="task-1" runId="run-1" interaction="live">+ <RunSurface.Thread />+ </RunSurface.Root>+ )++ expect(screen.getByTestId('thread')).toBeInTheDocument()+ expect(screen.queryByText("Pi session logs aren't available in PostHog yet.")).not.toBeInTheDocument()+ })+describe('Composer slot', () => {it.each<RunStatus>(['queued', 'in_progress'])('renders the composer children for an active run (%s)',diff --git a/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx b/products/posthog_ai/frontend/components/RunSurfaceImpl.tsxindex 259df3505a49..adf3efa4421c 100644--- a/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx+++ b/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx@@ -1,11 +1,11 @@import { BindLogic, useActions, useValues } from 'kea'import { createContext, type ReactNode, useContext, useEffect } from 'react'-import { LemonDivider } from '@posthog/lemon-ui'+import { LemonBanner, LemonButton, LemonDivider } from '@posthog/lemon-ui'import { isTerminalRunStatus, runStreamLogic } from '../logics/runStreamLogic'import { taskLogic } from '../logics/taskLogic'-import { OriginProduct } from '../types/taskTypes'+import { isPiTaskRuntime, OriginProduct } from '../types/taskTypes'import { ContextUsageBar } from './ContextUsageBar'import { PermissionInput } from './PermissionInput'import { QuestionInput } from './QuestionInput'@@ -87,17 +87,35 @@ function RunSurfaceRoot({// A pending surface (no run id) must supply `streamKey` to key on; `runId` is the key otherwise.const logicKey = streamKey ?? runId ?? ''- // The scout flag lives on the task (not the run), so the surface owns loading it once and exposing it- // to the slots — the runner already has the task loaded, a live embed fetches it here. Only the- // context-usage line consumes this, and only in live mode, so a read-only embed never fetches.- const { task, taskLoading } = useValues(taskLogic({ taskId }))+ // The runtime and scout flag live on the task (not the run), so the surface owns loading it once and+ // exposing it to the slots. The runner already has the task loaded; an embed fetches it here.+ const { task, taskLoading, taskError, taskNotFound } = useValues(taskLogic({ taskId }))const { loadTask } = useActions(taskLogic({ taskId }))useEffect(() => {- // `taskId &&`: a pending surface (optimistic create) has no task yet — don't fetch an empty id.- if (interaction === 'live' && taskId && !task && !taskLoading) {+ // A pending surface (optimistic create) has no task yet, so don't fetch an empty id.+ if (taskId && !task && !taskLoading && !taskError && !taskNotFound) {loadTask()}- }, [interaction, taskId, task, taskLoading, loadTask])+ }, [taskId, task, taskLoading, taskError, taskNotFound, loadTask])++ if (taskId && !task) {+ if (taskNotFound) {+ return <LemonBanner type="error">Task not found.</LemonBanner>+ }+ if (taskError) {+ return (+ <LemonBanner type="error">+ Couldn't load this task. <LemonButton onClick={loadTask}>Try again</LemonButton>+ </LemonBanner>+ )+ }+ return <RunLogSkeleton />+ }++ if (task && isPiTaskRuntime(task.runtime)) {+ return <LemonBanner type="info">Pi session logs aren't available in PostHog yet.</LemonBanner>+ }+const isScout = task?.origin_product === OriginProduct.SIGNALS_SCOUTreturn (diff --git a/products/posthog_ai/frontend/logics/taskLogic.test.ts b/products/posthog_ai/frontend/logics/taskLogic.test.tsindex 7dc0bbb3f151..477533acb02f 100644--- a/products/posthog_ai/frontend/logics/taskLogic.test.ts+++ b/products/posthog_ai/frontend/logics/taskLogic.test.ts@@ -4,6 +4,8 @@ import { ApiError } from 'lib/api'import { initKeaTests } from '~/test/init'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { OriginProduct, Task, TaskRunEnvironment, TaskRunStatus } from '../types/taskTypes'import { taskLogic } from './taskLogic'import { tasksLogic } from './tasksLogic'@@ -15,6 +17,7 @@ const createMockTask = (id: string): Task => ({title: `Task ${id}`,description: 'A test task',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'test/repo',github_integration: null,signal_report: null,diff --git a/products/posthog_ai/frontend/logics/tasksLogic.test.ts b/products/posthog_ai/frontend/logics/tasksLogic.test.tsindex 755c9ca95ebf..d3378ca3f32f 100644--- a/products/posthog_ai/frontend/logics/tasksLogic.test.ts+++ b/products/posthog_ai/frontend/logics/tasksLogic.test.ts@@ -8,6 +8,8 @@ import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { OriginProduct, Task } from '../types/taskTypes'import { tasksLogic } from './tasksLogic'@@ -18,6 +20,7 @@ const createMockTask = (id: string): Task => ({title: `Task ${id}`,description: 'A test task',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'test/repo',github_integration: null,signal_report: null,diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsxindex c4db6326e0a4..3deda6766123 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx@@ -6,6 +6,8 @@ import { App } from 'scenes/App'import { mswDecorator } from '~/mocks/browser'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { OriginProduct, Task, TaskRun, TaskRunEnvironment, TaskRunStatus } from '../../types/taskTypes'const taskTrackerUrl = (): string => '/tasks'@@ -48,6 +50,7 @@ const TASKS: Task[] = [title: 'Add retention graph export',description: 'Let users download the retention graph as a CSV from the insight menu.',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'PostHog/posthog',github_integration: 1,signal_report: null,@@ -65,6 +68,7 @@ const TASKS: Task[] = [title: 'Fix cohort empty state in query builder',description: 'Handle an empty cohort gracefully instead of throwing in the query builder.',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'PostHog/posthog',github_integration: 1,signal_report: null,@@ -82,6 +86,7 @@ const TASKS: Task[] = [title: 'Investigate slow dashboard load',description: 'Profile the dashboard scene and find the slowest tiles on first paint.',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'PostHog/posthog',github_integration: 1,signal_report: null,diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsxindex 92f5f6305388..05e5529d7206 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskDetailPage.tsx@@ -7,6 +7,7 @@ import { NotFound } from 'lib/components/NotFound'import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { isPiTaskRuntime } from '../../../types/taskTypes'import { taskDetailSceneLogic } from '../taskDetailSceneLogic'import { taskTrackerSceneLogic } from '../taskTrackerSceneLogic'import { TaskHeaderActionsSkeleton } from './taskDetailSkeletons'@@ -65,7 +66,7 @@ export function TaskDetailPage({ taskId, isMobile }: TaskDetailPageProps): JSX.EView PR</LemonButton>)}- {!isLatestRunInProgress && !isLatestRunCompleted && (+ {!isPiTaskRuntime(task.runtime) && !isLatestRunInProgress && !isLatestRunCompleted && (<LemonButton type="primary" size="small" icon={<IconPlay />} onClick={runTask}>{runButtonText}</LemonButton>diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/taskDetailSceneLogic.test.ts b/products/posthog_ai/frontend/scenes/TaskTracker/taskDetailSceneLogic.test.tsindex d85ed6f4b435..50f7fde410c1 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/taskDetailSceneLogic.test.ts+++ b/products/posthog_ai/frontend/scenes/TaskTracker/taskDetailSceneLogic.test.ts@@ -5,6 +5,8 @@ import { ApiError } from 'lib/api'import { initKeaTests } from '~/test/init'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { tasksLogic } from '../../logics/tasksLogic'import { OriginProduct, Task, TaskRun, TaskRunEnvironment, TaskRunStatus } from '../../types/taskTypes'import { taskDetailSceneLogic } from './taskDetailSceneLogic'@@ -16,6 +18,7 @@ const createMockTask = (id: string): Task => ({title: `Task ${id}`,description: 'A test task',origin_product: OriginProduct.USER_CREATED,+ runtime: RuntimeEnumApi.Acp,repository: 'test/repo',github_integration: null,signal_report: null,diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/taskTrackerSceneLogic.test.ts b/products/posthog_ai/frontend/scenes/TaskTracker/taskTrackerSceneLogic.test.tsindex 32d47818b51a..66482e6d9fc6 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/taskTrackerSceneLogic.test.ts+++ b/products/posthog_ai/frontend/scenes/TaskTracker/taskTrackerSceneLogic.test.ts@@ -6,6 +6,8 @@ import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { attachedContextLogic } from '../../api/logics'import { composerSeedLogic } from '../../logics/composerSeedLogic'import { OriginProduct, Task, TaskRunEnvironment, TaskRunStatus } from '../../types/taskTypes'@@ -18,6 +20,7 @@ const buildTask = (overrides: Partial<Task> = {}): Task => ({title: 'Some task',description: 'do the thing',origin_product: OriginProduct.POSTHOG_AI,+ runtime: RuntimeEnumApi.Acp,repository: null,github_integration: null,signal_report: null,diff --git a/products/posthog_ai/frontend/types/taskTypes.ts b/products/posthog_ai/frontend/types/taskTypes.tsindex 26ce38a7dde3..2ade8e942824 100644--- a/products/posthog_ai/frontend/types/taskTypes.ts+++ b/products/posthog_ai/frontend/types/taskTypes.ts@@ -1,5 +1,11 @@import { Optional } from 'lib/utils/types'+import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'++export function isPiTaskRuntime(runtime: RuntimeEnumApi | undefined): boolean {+ return runtime === RuntimeEnumApi.Pi+}+export interface RepositoryConfig {integrationId?: number/** `owner/repo` (GitHub `full_name`), same as data warehouse / Cyclotron GitHub pickers */@@ -77,6 +83,7 @@ export interface Task {title: stringdescription: stringorigin_product: OriginProduct+ runtime: RuntimeEnumApirepository: string | nullgithub_integration: number | null/** For signal-report-origin tasks: the inbox `SignalReport` this task ran for (set-once at creation). */diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.pyindex bcc151deb2b6..7d5c5bceb122 100644--- a/products/tasks/backend/facade/api.py+++ b/products/tasks/backend/facade/api.py@@ -79,6 +79,7 @@ logger = logging.getLogger(__name__)TaskRunStatus = TaskRun.StatusTaskRunEnvironment = TaskRun.EnvironmentTaskOriginProduct = Task.OriginProduct+TaskRuntime = Task.RuntimeSandboxNetworkAccessLevel = SandboxEnvironment.NetworkAccessLevelSandboxSnapshotStatus = SandboxSnapshot.Status@@ -113,6 +114,7 @@ __all__ = ["SandboxNetworkAccessLevel","SandboxSnapshotStatus","TaskOriginProduct",+ "TaskRuntime","TaskRunEnvironment","TaskRunStatus","append_task_run_log",@@ -212,6 +214,7 @@ __all__ = ["task_ids_with_pr_url_subquery","task_run_has_slack_mapping","task_run_is_terminal",+ "task_runtime","task_visible","update_sandbox_environment","update_task",@@ -403,6 +406,7 @@ def _task_detail_to_dto(title_manually_set=task.title_manually_set,description=task.description,origin_product=task.origin_product,+ runtime=task.runtime,repository=task.repository,github_integration=task.github_integration_id,github_user_integration=task.github_user_integration_id,@@ -3039,6 +3043,8 @@ def check_task_run_startable(run_id: str | UUID, task_id: str | UUID, team_id: irun = _get_visible_run(run_id, task_id, team_id)if run is None:return "not_found"+ if run.task.runtime == Task.Runtime.PI:+ return "unsupported_runtime"if run.environment != TaskRun.Environment.CLOUD:return "not_cloud"if run.status not in _STARTABLE_TASK_RUN_STATUSES:@@ -3118,6 +3124,8 @@ def resume_task_run_in_cloud(run = _get_visible_run(run_id, task_id, team_id)if run is None:return "not_found", None, None+ if run.task.runtime == Task.Runtime.PI:+ return "unsupported_runtime", None, Nonelogger.info("resume_in_cloud_called",@@ -3290,6 +3298,15 @@ def get_conversation_task_dtos(task_ids: Sequence[str | UUID], team_id: int) ->return {task.id: _task_detail_to_dto(task, include_latest_run=False) for task in tasks}+def task_runtime(task_id: str | UUID, team_id: int, user_id: int | None, *, for_control: bool = False) -> str | None:+ return (+ _visible_task_qs(team_id, user_id, for_control=for_control)+ .filter(id=task_id)+ .values_list("runtime", flat=True)+ .first()+ )++def task_visible(task_id: str | UUID, team_id: int, user_id: int | None, *, for_control: bool = False) -> bool:"""Whether a non-deleted task exists for the team and is visible to the user.@@ -4060,6 +4077,12 @@ def run_task(task = _visible_task_qs(team_id, user_id, for_control=True).filter(id=task_id).first()if task is None:return None+ if task.runtime == Task.Runtime.PI:+ return contracts.TaskRunResult(+ error=contracts.TaskValidationError(+ kind="detail", detail="Pi tasks cannot be run through the ACP task workflow."+ )+ )mode = validated_data.get("mode", "background")branch = validated_data.get("branch")diff --git a/products/tasks/backend/facade/contracts.py b/products/tasks/backend/facade/contracts.pyindex e7875b6dfc77..9ec2bcf045b7 100644--- a/products/tasks/backend/facade/contracts.py+++ b/products/tasks/backend/facade/contracts.py@@ -134,6 +134,7 @@ class TaskDetailDTO:title_manually_set: booldescription: strorigin_product: str+ runtime: strrepository: str | Nonegithub_integration: int | Nonegithub_user_integration: UUID | Nonediff --git a/products/tasks/backend/max_tools.py b/products/tasks/backend/max_tools.pyindex d7ae11bda3d2..6121eb1719dd 100644--- a/products/tasks/backend/max_tools.py+++ b/products/tasks/backend/max_tools.py@@ -152,6 +152,8 @@ Use this tool when the user wants to:if not task:return None+ if task.runtime == Task.Runtime.PI:+ return {"error": "unsupported_runtime"}task_run = task.create_run()task_url = f"/project/{task.team.project.id}/tasks/{task.id}?runId={task_run.id}"@@ -168,6 +170,8 @@ Use this tool when the user wants to:if not result:return f"Task with ID {task_id} not found", {"error": "not_found"}+ if result.get("error") == "unsupported_runtime":+ return "Pi tasks cannot be run through the ACP task workflow.", result# Extract slack thread context from config if availableslack_thread_context = (self._config.get("configurable") or {}).get("slack_thread_context")diff --git a/products/tasks/backend/migrations/0061_task_runtime.py b/products/tasks/backend/migrations/0061_task_runtime.pynew file mode 100644index 000000000000..b74936063894--- /dev/null+++ b/products/tasks/backend/migrations/0061_task_runtime.py@@ -0,0 +1,21 @@+# Generated by Django 5.2.14 on 2026-07-15 12:34++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [("tasks", "0060_taskrun_relayed_mcp_servers")]++ operations = [+ migrations.AddField(+ model_name="task",+ name="runtime",+ field=models.CharField(+ choices=[("acp", "ACP"), ("pi", "Pi")],+ db_default="acp",+ default="acp",+ help_text="Agent protocol/harness driving this task's runs.",+ max_length=10,+ ),+ ),+ ]diff --git a/products/tasks/backend/migrations/max_migration.txt b/products/tasks/backend/migrations/max_migration.txtindex b987c7228e64..8711230f37fe 100644--- a/products/tasks/backend/migrations/max_migration.txt+++ b/products/tasks/backend/migrations/max_migration.txt@@ -1 +1 @@-0060_taskrun_relayed_mcp_servers+0061_task_runtimediff --git a/products/tasks/backend/models.py b/products/tasks/backend/models.pyindex 6fe1f20db6c4..88b5409e0567 100644--- a/products/tasks/backend/models.py+++ b/products/tasks/backend/models.py@@ -110,6 +110,10 @@ PR_READY_EMAIL_PR_URL_STATE_KEY = "pr_ready_email_pr_url"class Task(FileSystemSyncMixin, DeletedMetaFields, models.Model):+ class Runtime(models.TextChoices):+ ACP = "acp", "ACP"+ PI = "pi", "Pi"+class OriginProduct(models.TextChoices):ONBOARDING = "onboarding", "Onboarding"ERROR_TRACKING = "error_tracking", "Error Tracking"@@ -226,6 +230,14 @@ class Task(FileSystemSyncMixin, DeletedMetaFields, models.Model):# is a fresh TaskRun), e.g. which PRs have been announced to the Slack thread.state = models.JSONField(default=dict, null=True, blank=True)+ runtime = models.CharField(+ max_length=10,+ choices=Runtime,+ default=Runtime.ACP,+ db_default=Runtime.ACP,+ help_text="Agent protocol/harness driving this task's runs.",+ )+class Meta:db_table = "posthog_task"managed = Truediff --git a/products/tasks/backend/presentation/serializers.py b/products/tasks/backend/presentation/serializers.pyindex 6c8074b08ab2..b6529de32a77 100644--- a/products/tasks/backend/presentation/serializers.py+++ b/products/tasks/backend/presentation/serializers.py@@ -347,6 +347,11 @@ class TaskSerializer(DataclassSerializer):latest_run = TaskRunDetailSerializer(allow_null=True, required=False, help_text="Latest run details for this task")created_by = TaskUserBasicInfoSerializer(allow_null=True, required=False)+ runtime = serializers.ChoiceField(+ choices=tasks_facade.TaskRuntime.choices,+ read_only=True,+ help_text="Agent protocol and harness used for this task's runs.",+ )class Meta:dataclass = TaskDetailDTO@@ -358,6 +363,7 @@ class TaskSerializer(DataclassSerializer):"title_manually_set","description","origin_product",+ "runtime","repository","github_integration","github_user_integration",@@ -617,6 +623,9 @@ class TaskWriteSerializer(serializers.Serializer):return normalizeddef validate(self, attrs: dict) -> dict:+ if "runtime" in self.initial_data and "runtime" not in self.fields:+ raise serializers.ValidationError({"runtime": "Runtime cannot be changed after task creation."})+rel = attrs.get("signal_report_task_relationship")if rel is not None:if not attrs.get("signal_report"):@@ -637,6 +646,14 @@ class TaskWriteSerializer(serializers.Serializer):return attrs+class TaskCreateSerializer(TaskWriteSerializer):+ runtime = serializers.ChoiceField(+ choices=tasks_facade.TaskRuntime.choices,+ required=False,+ help_text="Agent protocol and harness used for this task's runs. Defaults to ACP when omitted.",+ )++class TaskRunSetOutputRequestSerializer(serializers.Serializer):output = serializers.JSONField(help_text="Output data from the run. Validated against the task's json_schema if one is set."diff --git a/products/tasks/backend/presentation/views/api.py b/products/tasks/backend/presentation/views/api.pyindex 9bb08d059d9e..e7e733edbb2f 100644--- a/products/tasks/backend/presentation/views/api.py+++ b/products/tasks/backend/presentation/views/api.py@@ -73,6 +73,7 @@ from products.tasks.backend.presentation.serializers import (StreamReadTokenResponseSerializer,TaskAutomationSerializer,TaskAutomationWriteSerializer,+ TaskCreateSerializer,TaskListQuerySerializer,TaskPresenceBeaconRequestSerializer,TaskRepositoriesResponseSerializer,@@ -227,8 +228,14 @@ class TaskViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):def _user_id(self) -> int | None:return getattr(self.request.user, "id", None)- def _write_serializer(self, data, *, partial: bool = False) -> TaskWriteSerializer:- serializer = TaskWriteSerializer(+ def _write_serializer(+ self,+ data,+ *,+ partial: bool = False,+ serializer_class: type[TaskWriteSerializer] = TaskWriteSerializer,+ ) -> TaskWriteSerializer:+ serializer = serializer_class(data=data,partial=partial,context={"team": self.team, "team_id": self.team.id, "request": self.request},@@ -274,9 +281,9 @@ class TaskViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):raise NotFound()return Response(TaskSerializer(task).data)- @extend_schema(request=TaskWriteSerializer, responses={201: TaskSerializer})+ @extend_schema(request=TaskCreateSerializer, responses={201: TaskSerializer})def create(self, request, **kwargs):- serializer = self._write_serializer(request.data)+ serializer = self._write_serializer(request.data, serializer_class=TaskCreateSerializer)task = tasks_facade.create_task(self.team_id, self._user_id(), validated_data=dict(serializer.validated_data))return Response(TaskSerializer(task).data, status=status.HTTP_201_CREATED)@@ -950,6 +957,11 @@ class TaskRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):startable = tasks_facade.check_task_run_startable(pk, task_id, self.team_id)if startable == "not_found":raise NotFound()+ if startable == "unsupported_runtime":+ return Response(+ TaskRunErrorResponseSerializer({"error": "Pi tasks cannot be run through the ACP task workflow."}).data,+ status=status.HTTP_400_BAD_REQUEST,+ )if startable == "not_cloud":return Response(TaskRunErrorResponseSerializer({"error": "Only cloud runs can be started via this endpoint"}).data,@@ -1487,6 +1499,15 @@ class TaskRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):)def command(self, request, pk=None, **kwargs):task_id = self._ensure_task_accessible()+ if (+ tasks_facade.task_runtime(task_id, self.team_id, self._user_id(), for_control=True)+ == tasks_facade.TaskRuntime.PI+ ):+ return Response(+ TaskRunErrorResponseSerializer({"error": "Pi tasks do not support ACP task commands."}).data,+ status=status.HTTP_400_BAD_REQUEST,+ )+method = request.validated_data["method"]request_id = request.validated_data.get("id")params = request.validated_data.get("params")@@ -1824,6 +1845,11 @@ class TaskRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):outcome, run, _ = tasks_facade.resume_task_run_in_cloud(pk, task_id, self.team_id, self._user_id())if outcome == "not_found":raise NotFound()+ if outcome == "unsupported_runtime":+ return Response(+ TaskRunErrorResponseSerializer({"error": "Pi tasks cannot be run through the ACP task workflow."}).data,+ status=status.HTTP_400_BAD_REQUEST,+ )if outcome == "already_active":return Response(TaskRunErrorResponseSerializer({"error": "Run is already active in cloud"}).data,diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex e78f90e7c934..6f11cd5a575a 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -170,13 +170,19 @@ class BaseTaskAPITest(TestCase):self.mock_feature_flag.side_effect = check_flag- def create_task(self, title="Test Task", created_by: User | None = None):+ def create_task(+ self,+ title: str = "Test Task",+ created_by: User | None = None,+ runtime: Task.Runtime = Task.Runtime.ACP,+ ) -> Task:return Task.objects.create(team=self.team,created_by=created_by or self.user,title=title,description="Test Description",origin_product=Task.OriginProduct.USER_CREATED,+ runtime=runtime,)def create_organization_user(self, email_prefix: str = "other") -> User:@@ -1128,6 +1134,35 @@ class TestTaskAPI(BaseTaskAPITest):self.assertEqual(data["title"], "New Task")self.assertEqual(data["description"], "New Description")self.assertEqual(data["repository"], "posthog/posthog")+ self.assertEqual(data["runtime"], Task.Runtime.ACP)++ def test_create_task_with_pi_runtime(self):+ response = self.client.post(+ "/api/projects/@current/tasks/",+ {+ "title": "New Pi Task",+ "description": "New Description",+ "runtime": Task.Runtime.PI,+ },+ format="json",+ )++ self.assertEqual(response.status_code, status.HTTP_201_CREATED)+ self.assertEqual(response.json()["runtime"], Task.Runtime.PI)+ self.assertEqual(Task.objects.get(id=response.json()["id"]).runtime, Task.Runtime.PI)++ def test_update_task_rejects_runtime_change(self):+ task = self.create_task(runtime=Task.Runtime.ACP)++ response = self.client.patch(+ f"/api/projects/@current/tasks/{task.id}/",+ {"runtime": Task.Runtime.PI},+ format="json",+ )++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ task.refresh_from_db()+ self.assertEqual(task.runtime, Task.Runtime.ACP)def test_create_task_accepts_null_runtime_fields(self):# The Code app's cloud-task flows (e.g. Discuss) send the write-only@@ -1551,6 +1586,17 @@ class TestTaskAPI(BaseTaskAPITest):self.assertEqual(latest_run["status"], "queued")self.assertEqual(latest_run["environment"], "cloud")+ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_run_endpoint_rejects_pi_task(self, mock_workflow):+ task = self.create_task(runtime=Task.Runtime.PI)++ response = self.client.post(f"/api/projects/@current/tasks/{task.id}/run/")++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(response.json()["detail"], "Pi tasks cannot be run through the ACP task workflow.")+ self.assertFalse(task.runs.exists())+ mock_workflow.assert_not_called()+@parameterized.expand([("run_source_omitted", None, "full"),@@ -2159,6 +2205,17 @@ class TestTaskAPI(BaseTaskAPITest):posthog_mcp_scopes="full",)+ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_start_run_endpoint_rejects_pi_task(self, mock_workflow):+ task = self.create_task(runtime=Task.Runtime.PI)+ task_run = task.create_run(environment=TaskRun.Environment.CLOUD)++ response = self.client.post(f"/api/projects/@current/tasks/{task.id}/runs/{task_run.id}/start/")++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(response.json()["error"], "Pi tasks cannot be run through the ACP task workflow.")+ mock_workflow.assert_not_called()+@patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")def test_start_run_endpoint_rejects_missing_run_artifacts(self, mock_workflow):task = self.create_task()@@ -4253,6 +4310,22 @@ class TestTaskRunAPI(BaseTaskAPITest):self.assertEqual(run.status, TaskRun.Status.COMPLETED)self.assertIsNotNone(run.completed_at)+ @patch("products.tasks.backend.temporal.client.resume_task_in_cloud_workflow")+ def test_resume_in_cloud_rejects_pi_task(self, mock_resume):+ task = self.create_task(runtime=Task.Runtime.PI)+ run = TaskRun.objects.create(+ task=task,+ team=self.team,+ environment=TaskRun.Environment.LOCAL,+ status=TaskRun.Status.COMPLETED,+ )++ response = self.client.post(f"/api/projects/@current/tasks/{task.id}/runs/{run.id}/resume_in_cloud/")++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(response.json()["error"], "Pi tasks cannot be run through the ACP task workflow.")+ mock_resume.assert_not_called()+@patch("products.tasks.backend.temporal.client.resume_task_in_cloud_workflow")def test_resume_in_cloud_rejects_user_authorship_without_github_identity_when_no_repo(self, mock_resume):task = self.create_task(created_by=self.user)@@ -7725,6 +7798,21 @@ class TestTaskRunCommandAPI(BaseTaskAPITest):mock_resp.text = json.dumps(body) if isinstance(body, dict) else str(body)mock_post.return_value = mock_resp+ @patch("products.tasks.backend.temporal.client.signal_task_followup_message")+ def test_command_rejects_pi_task(self, mock_signal_followup):+ task = self.create_task(runtime=Task.Runtime.PI)+ run = self._create_run_with_sandbox(task)++ response = self.client.post(+ self._command_url(task, run),+ self._make_user_message(),+ format="json",+ )++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(response.json()["error"], "Pi tasks do not support ACP task commands.")+ mock_signal_followup.assert_not_called()+@patch("products.tasks.backend.temporal.client.signal_task_followup_message")def test_command_signals_user_message(self, mock_signal_followup):task = self.create_task()diff --git a/products/tasks/backend/tests/test_max_tools.py b/products/tasks/backend/tests/test_max_tools.pyindex acca60f1ce9f..da2f06cfcfe7 100644--- a/products/tasks/backend/tests/test_max_tools.py+++ b/products/tasks/backend/tests/test_max_tools.py@@ -40,6 +40,7 @@ class BaseTaskToolTest(BaseTest):repository=None,origin_product=None,deleted=False,+ runtime=Task.Runtime.ACP,):task = Task.objects.create(team=self.team,@@ -48,6 +49,7 @@ class BaseTaskToolTest(BaseTest):origin_product=origin_product or Task.OriginProduct.USER_CREATED,repository=repository,created_by=self.user,+ runtime=runtime,)if deleted:task.deleted = True@@ -61,8 +63,11 @@ class BaseTaskToolTest(BaseTest):repository=None,origin_product=None,deleted=False,+ runtime=Task.Runtime.ACP,):- return await sync_to_async(self._create_task_sync)(title, description, repository, origin_product, deleted)+ return await sync_to_async(self._create_task_sync)(+ title, description, repository, origin_product, deleted, runtime+ )def _create_task_run_sync(self,@@ -178,6 +183,20 @@ class TestRunTaskTool(BaseTaskToolTest):mock_execute_workflow.assert_called_once()+ @patch("products.tasks.backend.max_tools.execute_task_processing_workflow_async")+ @pytest.mark.django_db+ @pytest.mark.asyncio+ async def test_run_task_rejects_pi_task(self, mock_execute_workflow):+ task = await self._create_task(runtime=Task.Runtime.PI)+ tool = self._create_tool(RunTaskTool)++ content, artifact = await tool._arun_impl(task_id=str(task.id))++ assert content == "Pi tasks cannot be run through the ACP task workflow."+ assert artifact["error"] == "unsupported_runtime"+ assert not await sync_to_async(task.runs.exists)()+ mock_execute_workflow.assert_not_called()+@pytest.mark.django_db@pytest.mark.asyncioasync def test_run_task_not_found(self):diff --git a/products/tasks/frontend/generated/api.schemas.ts b/products/tasks/frontend/generated/api.schemas.tsindex 6f8eb7560239..437c39c0524c 100644--- a/products/tasks/frontend/generated/api.schemas.ts+++ b/products/tasks/frontend/generated/api.schemas.ts@@ -502,6 +502,17 @@ export interface PaginatedTaskMentionDTOListApi {results: TaskMentionDTOApi[]}+/**+ * * `acp` - ACP+ * * `pi` - Pi+ */+export type RuntimeEnumApi = (typeof RuntimeEnumApi)[keyof typeof RuntimeEnumApi]++export const RuntimeEnumApi = {+ Acp: 'acp',+ Pi: 'pi',+} as const+/*** @nullable*/@@ -524,6 +535,11 @@ export interface TaskDetailDTOApi {title_manually_set: booleandescription: stringorigin_product: string+ /** Agent protocol and harness used for this task's runs.+ *+ * * `acp` - ACP+ * * `pi` - Pi */+ readonly runtime: RuntimeEnumApi/** @nullable */repository: string | null/** @nullable */@@ -628,6 +644,130 @@ export const ReasoningEffortEnumApi = {Max: 'max',} as const+/**+ * Request body for creating or updating a task.+ *+ * Field required/default semantics match the ``Task`` model. The view passes+ * ``validated_data`` (integration/report PK fields already resolved to instances) to the+ * facade ``create_task`` / ``update_task`` functions.+ */+export interface TaskCreateApi {+ /**+ * Short human-readable title. Auto-generated from `description` when omitted.+ * @maxLength 255+ */+ title?: string+ /** Whether the title was set by a human (vs auto-generated from the description). */+ title_manually_set?: boolean+ /** Free-form description of the work to be done. Used as the prompt passed to the agent. */+ description?: string+ /** PostHog product or surface that created this task (e.g. error_tracking, slack, user_created).+ *+ * * `onboarding` - Onboarding+ * * `error_tracking` - Error Tracking+ * * `eval_clusters` - Eval Clusters+ * * `user_created` - User Created+ * * `automation` - Automation+ * * `slack` - Slack+ * * `support_queue` - Support Queue+ * * `session_summaries` - Session Summaries+ * * `posthog_ai` - PostHog AI+ * * `experiments` - Experiments+ * * `signal_report` - Signal Report+ * * `signals_scout` - Signals Scout+ * * `support_reply` - Support Reply+ * * `hogdesk` - HogDesk+ * * `review_hog` - ReviewHog+ * * `image_builder` - Image Builder */+ origin_product?: OriginProductEnumApi+ /**+ * Target GitHub repository in `organization/repo` format (e.g. `posthog/posthog-js`).+ * @maxLength 255+ * @nullable+ */+ repository?: string | null+ /**+ * GitHub integration for this task.+ * @nullable+ */+ github_integration?: number | null+ /**+ * User-scoped GitHub integration to use for user-authored cloud runs.+ * @nullable+ */+ github_user_integration?: string | null+ /**+ * Signal report this task implements, when created from a report.+ * @nullable+ */+ signal_report?: string | null+ /**+ * How the created task relates to the signal report (e.g. 'implementation', 'discussion', 'research'). Recorded as a signals task_run work-log entry; 'implementation' also opens the auto-start spend gate. Any routing-safe identifier (lowercase letters, numbers, '_', '-') is accepted.+ * @maxLength 200+ */+ signal_report_task_relationship?: string+ /** JSON schema used to validate the output of the task. */+ json_schema?: unknown+ /** If true, this task is for internal use and should not be exposed to end users. */+ internal?: boolean+ /** If true, the task is hidden from default list responses. */+ archived?: boolean+ /**+ * Custom prompt for CI fixes. If blank, a default prompt will be used.+ * @nullable+ */+ ci_prompt?: string | null+ /**+ * Branch the user has selected for this cloud task. Write-only and not persisted on the task itself: used only to reuse a matching pre-warmed sandbox Run on creation (the branch is otherwise carried on the run). Omit to match a warm Run on the default branch.+ * @maxLength 255+ * @nullable+ */+ branch?: string | null+ /** Selected runtime adapter ('claude' or 'codex'). Write-only and not persisted on the task: used only to reuse a pre-warmed Run started on the same runtime. A value differing from the warm Run's runtime skips reuse so the task isn't silently run on the wrong runtime.+ *+ * * `claude` - claude+ * * `codex` - codex */+ runtime_adapter?: RuntimeAdapterEnumApi | null+ /**+ * Selected LLM model identifier. Write-only; used only to reuse a warm Run started on the same model.+ * @nullable+ */+ model?: string | null+ /** Selected reasoning effort. Write-only; used only to reuse a warm Run started on the same effort.+ *+ * * `low` - low+ * * `medium` - medium+ * * `high` - high+ * * `xhigh` - xhigh+ * * `max` - max */+ reasoning_effort?: ReasoningEffortEnumApi | null+ /**+ * First user message to forward when creation reuses a pre-warmed Run. Write-only and not persisted on the task: lets clients deliver a message that differs from `description` (e.g. a resolved skill invocation with channel context folded in). Ignored when no warm Run is reused — cold creation takes the first message via the run start endpoint instead.+ * @nullable+ */+ pending_user_message?: string | null+ /**+ * Run artifact ids (already uploaded to the pre-warmed Run) to attach to the forwarded first message when creation reuses that warm Run, e.g. skill bundles or file attachments. If any id is missing from the warm Run's manifest, warm reuse is skipped and the task is created cold. Ignored when no warm Run is matched.+ * @items.maxLength 128+ */+ pending_user_artifact_ids?: string[]+ /**+ * When true, the cloud run agent pushes its work and opens a draft pull request on completion without waiting for an explicit ask. Write-only and not persisted on the task: persisted into the reused warm Run's state when creation activates one, so resumes of that Run honor it. Ignored when no warm Run is reused — cold creation takes it via the run start endpoint instead.+ * @nullable+ */+ auto_publish?: boolean | null+ /**+ * Channel this task is owned by (the channel it was kicked off in).+ * @nullable+ */+ channel?: string | null+ /** Agent protocol and harness used for this task's runs. Defaults to ACP when omitted.+ *+ * * `acp` - ACP+ * * `pi` - Pi */+ runtime?: RuntimeEnumApi+}+/*** Request body for creating or updating a task.*diff --git a/products/tasks/frontend/generated/api.ts b/products/tasks/frontend/generated/api.tsindex 59b6f3d56b13..aff5cd8424c6 100644--- a/products/tasks/frontend/generated/api.ts+++ b/products/tasks/frontend/generated/api.ts@@ -46,6 +46,7 @@ import type {TaskAutomationsListParams,TaskChannelsFeedListParams,TaskChannelsListParams,+ TaskCreateApi,TaskDetailDTOApi,TaskMentionsListParams,TaskPresenceBeaconRequestApi,@@ -711,14 +712,14 @@ export const getTasksCreateUrl = (projectId: string) => {*/export const tasksCreate = async (projectId: string,- taskWriteApi?: TaskWriteApi,+ taskCreateApi?: TaskCreateApi,options?: RequestInit): Promise<TaskDetailDTOApi> => {return apiMutator<TaskDetailDTOApi>(getTasksCreateUrl(projectId), {...options,method: 'POST',headers: { 'Content-Type': 'application/json', ...options?.headers },- body: JSON.stringify(taskWriteApi),+ body: JSON.stringify(taskCreateApi),})}diff --git a/products/tasks/frontend/generated/api.zod.ts b/products/tasks/frontend/generated/api.zod.tsindex e7c3a2ef2d28..ba994811eba0 100644--- a/products/tasks/frontend/generated/api.zod.ts+++ b/products/tasks/frontend/generated/api.zod.ts@@ -472,6 +472,13 @@ export const TasksCreateBody = /* @__PURE__ */ zod"When true, the cloud run agent pushes its work and opens a draft pull request on completion without waiting for an explicit ask. Write-only and not persisted on the task: persisted into the reused warm Run's state when creation activates one, so resumes of that Run honor it. Ignored when no warm Run is reused — cold creation takes it via the run start endpoint instead."),channel: zod.uuid().nullish().describe('Channel this task is owned by (the channel it was kicked off in).'),+ runtime: zod+ .enum(['acp', 'pi'])+ .describe('\* `acp` - ACP\n\* `pi` - Pi')+ .optional()+ .describe(+ "Agent protocol and harness used for this task's runs. Defaults to ACP when omitted.\n\n\* `acp` - ACP\n\* `pi` - Pi"+ ),}).describe('Request body for creating or updating a task.\n\nField required\/default semantics match the ``Task`` model. The view passes\n``validated_data`` (integration\/report PK fields already resolved to instances) to the\nfacade ``create_task`` \/ ``update_task`` functions.'diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 1264dc5a9c28..ac7e99cb1f30 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -14675,6 +14675,18 @@ export namespace Schemas {Slack: 'slack',} as const;+ /**+ * * `acp` - ACP+ * * `pi` - Pi+ */+ export type RuntimeEnum = typeof RuntimeEnum[keyof typeof RuntimeEnum];+++ export const RuntimeEnum = {+ Acp: 'acp',+ Pi: 'pi',+ } as const;+/*** @nullable*/@@ -14697,6 +14709,11 @@ export namespace Schemas {title_manually_set: boolean;description: string;origin_product: string;+ /** Agent protocol and harness used for this task's runs.+ *+ * * `acp` - ACP+ * * `pi` - Pi */+ readonly runtime: RuntimeEnum;/** @nullable */repository: string | null;/** @nullable */@@ -60642,6 +60659,130 @@ export namespace Schemas {enabled?: boolean;}+ /**+ * Request body for creating or updating a task.+ *+ * Field required/default semantics match the ``Task`` model. The view passes+ * ``validated_data`` (integration/report PK fields already resolved to instances) to the+ * facade ``create_task`` / ``update_task`` functions.+ */+ export interface TaskCreate {+ /**+ * Short human-readable title. Auto-generated from `description` when omitted.+ * @maxLength 255+ */+ title?: string;+ /** Whether the title was set by a human (vs auto-generated from the description). */+ title_manually_set?: boolean;+ /** Free-form description of the work to be done. Used as the prompt passed to the agent. */+ description?: string;+ /** PostHog product or surface that created this task (e.g. error_tracking, slack, user_created).+ *+ * * `onboarding` - Onboarding+ * * `error_tracking` - Error Tracking+ * * `eval_clusters` - Eval Clusters+ * * `user_created` - User Created+ * * `automation` - Automation+ * * `slack` - Slack+ * * `support_queue` - Support Queue+ * * `session_summaries` - Session Summaries+ * * `posthog_ai` - PostHog AI+ * * `experiments` - Experiments+ * * `signal_report` - Signal Report+ * * `signals_scout` - Signals Scout+ * * `support_reply` - Support Reply+ * * `hogdesk` - HogDesk+ * * `review_hog` - ReviewHog+ * * `image_builder` - Image Builder */+ origin_product?: OriginProductEnum;+ /**+ * Target GitHub repository in `organization/repo` format (e.g. `posthog/posthog-js`).+ * @maxLength 255+ * @nullable+ */+ repository?: string | null;+ /**+ * GitHub integration for this task.+ * @nullable+ */+ github_integration?: number | null;+ /**+ * User-scoped GitHub integration to use for user-authored cloud runs.+ * @nullable+ */+ github_user_integration?: string | null;+ /**+ * Signal report this task implements, when created from a report.+ * @nullable+ */+ signal_report?: string | null;+ /**+ * How the created task relates to the signal report (e.g. 'implementation', 'discussion', 'research'). Recorded as a signals task_run work-log entry; 'implementation' also opens the auto-start spend gate. Any routing-safe identifier (lowercase letters, numbers, '_', '-') is accepted.+ * @maxLength 200+ */+ signal_report_task_relationship?: string;+ /** JSON schema used to validate the output of the task. */+ json_schema?: unknown;+ /** If true, this task is for internal use and should not be exposed to end users. */+ internal?: boolean;+ /** If true, the task is hidden from default list responses. */+ archived?: boolean;+ /**+ * Custom prompt for CI fixes. If blank, a default prompt will be used.+ * @nullable+ */+ ci_prompt?: string | null;+ /**+ * Branch the user has selected for this cloud task. Write-only and not persisted on the task itself: used only to reuse a matching pre-warmed sandbox Run on creation (the branch is otherwise carried on the run). Omit to match a warm Run on the default branch.+ * @maxLength 255+ * @nullable+ */+ branch?: string | null;+ /** Selected runtime adapter ('claude' or 'codex'). Write-only and not persisted on the task: used only to reuse a pre-warmed Run started on the same runtime. A value differing from the warm Run's runtime skips reuse so the task isn't silently run on the wrong runtime.+ *+ * * `claude` - claude+ * * `codex` - codex */+ runtime_adapter?: RuntimeAdapterEnum | null;+ /**+ * Selected LLM model identifier. Write-only; used only to reuse a warm Run started on the same model.+ * @nullable+ */+ model?: string | null;+ /** Selected reasoning effort. Write-only; used only to reuse a warm Run started on the same effort.+ *+ * * `low` - low+ * * `medium` - medium+ * * `high` - high+ * * `xhigh` - xhigh+ * * `max` - max */+ reasoning_effort?: ReasoningEffortEnum | null;+ /**+ * First user message to forward when creation reuses a pre-warmed Run. Write-only and not persisted on the task: lets clients deliver a message that differs from `description` (e.g. a resolved skill invocation with channel context folded in). Ignored when no warm Run is reused — cold creation takes the first message via the run start endpoint instead.+ * @nullable+ */+ pending_user_message?: string | null;+ /**+ * Run artifact ids (already uploaded to the pre-warmed Run) to attach to the forwarded first message when creation reuses that warm Run, e.g. skill bundles or file attachments. If any id is missing from the warm Run's manifest, warm reuse is skipped and the task is created cold. Ignored when no warm Run is matched.+ * @items.maxLength 128+ */+ pending_user_artifact_ids?: string[];+ /**+ * When true, the cloud run agent pushes its work and opens a draft pull request on completion without waiting for an explicit ask. Write-only and not persisted on the task: persisted into the reused warm Run's state when creation activates one, so resumes of that Run honor it. Ignored when no warm Run is reused — cold creation takes it via the run start endpoint instead.+ * @nullable+ */+ auto_publish?: boolean | null;+ /**+ * Channel this task is owned by (the channel it was kicked off in).+ * @nullable+ */+ channel?: string | null;+ /** Agent protocol and harness used for this task's runs. Defaults to ACP when omitted.+ *+ * * `acp` - ACP+ * * `pi` - Pi */+ runtime?: RuntimeEnum;+ }+/*** Request body for the presence beacon and beacon-leave endpoints.*