:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(slack_app): remove seven fully rolled-out feature flags (#91570)
Vojta Bartoš90cc2d0db78e
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 4ec873456042..39195cc15a72 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7913,9 +7913,9 @@ snapshots:scenes-app-replay-vision--action-detail--light:hash: v1.k794b7964.fddd31bad32538bf10702607095b988829efd15e59cac6be49b6e66cd6195c7b.mPfMwarDBO9E3fSs_hJMQImG6fzXNdfFuPKDgeuhrgMscenes-app-replay-vision--action-editor-alert--dark:- hash: v1.k794b7964.3204d6ae31404bf3f33fcc79f4677be81f38de6f16e8ebd124996326a8030681.D8exff3-Oy2AM-UvFtlhRheKIOOOi162DVIgZcGviQE+ hash: v1.k794b7964.fdcca15f6b37ce5ed856e06de143bc0e975cfe76f58d4070ca44e837e0a85ddf.oXZ8eDvCfC_A2YFw_WgTS6PuiXSaSUVWfF1kxrEeHKYscenes-app-replay-vision--action-editor-alert--light:- hash: v1.k794b7964.ee28763bea5b87190aa29033f4f606fced20ca3d7801a76ef54cd1c84bf06546.lDUEss5wCkOJco80RWv8QEAYh4cGfSBNZSdzqWTvs3A+ hash: v1.k794b7964.82fa05fdbb2e3821359ad9746beccc030cf99f46b08c96067ed5fc59ec506763.igvaPjMHN5Z4BkkfgwXuHewly3vhQbWl1OjpTA8OI1Escenes-app-replay-vision--action-editor-digest--dark:hash: v1.k794b7964.483244eee8c1dcbfd3d897559b867fe8127151f78ec5b00a6ac4a9a39fa0219f.vyWDN2gFu2CWgMK3DCWigJEkLIIFzi3KCm73GY9bNvoscenes-app-replay-vision--action-editor-digest--light:@@ -8705,13 +8705,13 @@ snapshots:scenes-other-integration-landing-page--connected--light:hash: v1.k794b7964.3db01e8e2c1f2a9c6b622e06bd5ac66345cdd92961f70349829cdce36cddd2a9.BjXhubo71g8DdCf1Eih4H-AnYpXQnxwL48JtTfIjHWMscenes-other-integration-landing-page--no-permission--dark:- hash: v1.k794b7964.674e5a613b6d3f2933862db144b0fab805875bfb9926e2f1f49e502c375363f5.HHRhYsPPj9lhRPMJvLxGHitZUPgG5-Zg9K3k26fM2kI+ hash: v1.k794b7964.957e7be92050477838301517a8ebfdfd1f5b6c6ff3005dc35b505f553b6c58ea.CaFotiPrq8gJ5X6pzBmcsMuuURiBwLRHwihyFdPHZe8scenes-other-integration-landing-page--no-permission--light:- hash: v1.k794b7964.fe31b9b4308a40ebe93aaf37ac256bc1a21917798708dada68092982307706ac.GYO6l0kkFqPf9TA5o7k0AuLhY6WjXqxPCSUOI0ni8cA+ hash: v1.k794b7964.1fe42b8b297343b0180998e98d5c4c68de32791266a856a07fcaf88765b71e93.Q4lksjM0TVv96VjUo69rldiUY3upQaDAW9-4ldbn0vAscenes-other-integration-landing-page--not-connected--dark:- hash: v1.k794b7964.674e5a613b6d3f2933862db144b0fab805875bfb9926e2f1f49e502c375363f5.KcBmjEDBWtXtN_WsV0TL9ePVzhfYEyfr4qrLBdoyGyM+ hash: v1.k794b7964.957e7be92050477838301517a8ebfdfd1f5b6c6ff3005dc35b505f553b6c58ea.SoUeRmOD3bvKPv74k1UfUEArhSskLk6pVPDVlmUY_-gscenes-other-integration-landing-page--not-connected--light:- hash: v1.k794b7964.fe31b9b4308a40ebe93aaf37ac256bc1a21917798708dada68092982307706ac.AaXZuU22qSzLFz9K3r7uKn1dFqRUC5CwW2v3u3R-z6A+ hash: v1.k794b7964.1fe42b8b297343b0180998e98d5c4c68de32791266a856a07fcaf88765b71e93.Q-NV49-iLDmtzX4egP_H3Ks6sjTRd2NRMz_-OEJ7NWkscenes-other-onboarding-legacy--ai-observability-sdk-install--dark:hash: v1.k794b7964.0c82a4b8b276a3f51b42dd3a20aed7672fbfb5f096e4bd9da51221b6eb52bbdc.iXUjftr_vTAULjZ_soSDjZ9o_RG2YPlJBCG4ZSuNTS0scenes-other-onboarding-legacy--ai-observability-sdk-install--light:diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 5cf13f88adea..a22e7231e148 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -239,8 +239,6 @@ export const FEATURE_FLAGS = {SETTINGS_SESSIONS_V2_JOIN: 'settings-sessions-v2-join', // owner: @robbie-c #team-web-analyticsSETTINGS_WEB_ANALYTICS_PRE_AGGREGATED_TABLES: 'web-analytics-pre-aggregated-tables', // owner: @lricoy #team-web-analyticsSIGNALS_PR_REFUNDS: 'signals-pr-refunds', // owner: #team-self-driving, gates the inbox PR refund flow (also checked server-side)- SLACK_APP_ASSISTANT: 'slack-app-assistant', // owner: @VojtechBartos #team-platform-features- SLACK_APP_OAUTH: 'slack-app-oauth', // owner: @VojtechBartos #team-platform-featuresSLOPE_GRAPH_INSIGHT: 'slope-graph-insight', // owner: @pauldambra #team-product-analyticsSTARTUP_PROGRAM_INTENT: 'startup-program-intent', // owner: @pawel-cebula #team-billingSURVEYS_ACTIONS: 'surveys-actions', // owner: #team-surveysdiff --git a/frontend/src/lib/integrations/SlackIntegrationHelpers.tsx b/frontend/src/lib/integrations/SlackIntegrationHelpers.tsxindex 5756578da82a..efcf2f1f40a0 100644--- a/frontend/src/lib/integrations/SlackIntegrationHelpers.tsx+++ b/frontend/src/lib/integrations/SlackIntegrationHelpers.tsx@@ -13,10 +13,9 @@ import {import api from 'lib/api'import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'-import { FEATURE_FLAGS, OrganizationMembershipLevel } from 'lib/constants'+import { OrganizationMembershipLevel } from 'lib/constants'import { usePeriodicRerender } from 'lib/hooks/usePeriodicRerender'import { IconSlackExternal } from 'lib/lemon-ui/icons'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { IntegrationType, SlackChannelType } from '~/types'@@ -27,7 +26,6 @@ export function SlackNotConfiguredBanner({type = 'info',className,}: Partial<Pick<LemonBannerProps, 'type' | 'className'>>): JSX.Element {- const { featureFlags } = useValues(featureFlagLogic)return (<LemonBanner type={type} className={className}><div className="flex flex-col gap-2">@@ -51,12 +49,10 @@ export function SlackNotConfiguredBanner({/></Link></div>- {featureFlags[FEATURE_FLAGS.SLACK_APP_ASSISTANT] && (- <span className="text-sm text-secondary">- Adding PostHog creates a public #posthog-inbox channel in your Slack workspace, where PostHog- posts what it finds.- </span>- )}+ <span className="text-sm text-secondary">+ Adding PostHog creates a public #posthog-inbox channel in your Slack workspace, where PostHog posts+ what it finds.+ </span></div></LemonBanner>)diff --git a/frontend/src/scenes/integrations/components/SlackIntegration.tsx b/frontend/src/scenes/integrations/components/SlackIntegration.tsxindex d5ae7ce4adda..d0c78ccb66c8 100644--- a/frontend/src/scenes/integrations/components/SlackIntegration.tsx+++ b/frontend/src/scenes/integrations/components/SlackIntegration.tsx@@ -5,11 +5,9 @@ import { LemonButton, Link } from '@posthog/lemon-ui'import api from 'lib/api'import { CodeSnippet, Language } from 'lib/components/CodeSnippet'-import { FEATURE_FLAGS } from 'lib/constants'import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'import { integrationsLogic } from 'lib/integrations/integrationsLogic'import { IntegrationView } from 'lib/integrations/IntegrationView'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'@@ -63,7 +61,6 @@ export function SlackIntegration({ next, centered }: { next?: string; centered?:return () => stopPolling()})const { user } = useValues(userLogic)- const { featureFlags } = useValues(featureFlagLogic)const requiredScopesArr = useSlackRequiredScopes()const requiredScopes = useMemo(() => requiredScopesArr.join(' '), [requiredScopesArr])@@ -87,18 +84,16 @@ export function SlackIntegration({ next, centered }: { next?: string; centered?:srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/[email protected] 2x"/></Link>- {featureFlags[FEATURE_FLAGS.SLACK_APP_ASSISTANT] && (- <p- className={- centered- ? 'text-sm text-secondary max-w-sm m-0'- : 'text-sm text-secondary mt-2 mb-0'- }- >- Adding PostHog creates a public #posthog-inbox channel in your Slack workspace,- where PostHog posts what it finds.- </p>- )}+ <p+ className={+ centered+ ? 'text-sm text-secondary max-w-sm m-0'+ : 'text-sm text-secondary mt-2 mb-0'+ }+ >+ Adding PostHog creates a public #posthog-inbox channel in your Slack workspace, where+ PostHog posts what it finds.+ </p></div>) : user?.is_staff ? (!showSlackInstructions ? (diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex 9ffb0f977d8c..3d0077ef248c 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -2237,7 +2237,6 @@ export const SETTINGS_MAP: SettingSection[] = ['Bind your Slack identity to this PostHog account so @PostHog mentions route to you even when your Slack email and PostHog email differ.',component: <PersonalSlackIntegrations />,keywords: ['slack', 'integration', 'identity', 'link', 'mention', 'personal'],- flag: 'SLACK_APP_OAUTH',},{id: 'personal-integrations-posthog',diff --git a/frontend/src/scenes/settings/user/personalIntegrationsLogic.ts b/frontend/src/scenes/settings/user/personalIntegrationsLogic.tsindex aa471521c887..24726d1c1c1b 100644--- a/frontend/src/scenes/settings/user/personalIntegrationsLogic.ts+++ b/frontend/src/scenes/settings/user/personalIntegrationsLogic.ts@@ -4,11 +4,9 @@ import { loaders } from 'kea-loaders'import { lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'-import { FEATURE_FLAGS } from 'lib/constants'import { githubInstallRequestsLogic } from 'lib/integrations/githubInstallRequestsLogic'import { describeGithubLinkError } from 'lib/integrations/githubSetupErrors'import { integrationsLogic } from 'lib/integrations/integrationsLogic'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { teamLogic } from 'scenes/teamLogic'import {@@ -20,7 +18,6 @@ import {} from '~/generated/core/api'import type { UserGitHubIntegrationItemApi } from '~/generated/core/api.schemas'-import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'import type { TeamPublicType, TeamType, UserBasicType } from '../../../types'export interface PersonalGitHubIntegration {@@ -101,7 +98,6 @@ function writeConnectFromStorage(value: string | null): void {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface personalIntegrationsLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogiccurrentTeam: TeamPublicType | TeamType | null // teamLogicgithubConnecting: booleanintegrations: PersonalGitHubIntegration[]@@ -113,7 +109,6 @@ export interface personalIntegrationsLogicValues {slackConnectLoading: booleanslackIntegrations: PersonalSlackIntegration[]slackIntegrationsLoading: boolean- slackLinkEnabled: boolean}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -324,25 +319,16 @@ export interface personalIntegrationsLogicActions {}}-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface personalIntegrationsLogicMeta {- __keaTypeGenInternalSelectorTypes: {- slackLinkEnabled: (featureFlags: FeatureFlagsSet) => boolean- }-}-export type personalIntegrationsLogicType = MakeLogicType<personalIntegrationsLogicValues,- personalIntegrationsLogicActions,- Record<string, any>,- personalIntegrationsLogicMeta+ personalIntegrationsLogicActions>export const personalIntegrationsLogic = kea<personalIntegrationsLogicType>([path(['scenes', 'settings', 'user', 'personalIntegrationsLogic']),connect(() => ({- values: [teamLogic, ['currentTeam'], featureFlagLogic, ['featureFlags']],+ values: [teamLogic, ['currentTeam']],actions: [integrationsLogic,['loadIntegrations as loadProjectIntegrations', 'loadIntegrationsSuccess as projectIntegrationsLoaded'],@@ -451,17 +437,7 @@ export const personalIntegrationsLogic = kea<personalIntegrationsLogicType>([],})),- selectors({- // Gating selector for the new section. Read once in the component so the- // backend endpoints are still queryable for users who linked before the- // flag flipped off — only the *new connect / discoverability* surface- // is hidden, not the unlink path.- slackLinkEnabled: [- (s) => [s.featureFlags],- (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet): boolean =>- !!featureFlags[FEATURE_FLAGS.SLACK_APP_OAUTH],- ],- }),+ selectors({}),listeners(({ actions, values, cache }) => ({// Keep the personal GitHub rows current while the section is open, so an App removed ondiff --git a/posthog/api/user_integration.py b/posthog/api/user_integration.pyindex 6747914e198d..d38c7b6bade8 100644--- a/posthog/api/user_integration.py+++ b/posthog/api/user_integration.py@@ -719,9 +719,9 @@ class UserIntegrationViewSet(viewsets.GenericViewSet):for integration in candidates:if permissions.team(integration.team).effective_membership_level is None:continue- # Feature-flag check per workspace so an org that hasn't rolled out- # the flag yet doesn't show up in another org's picker.- if not is_slack_app_oauth_enabled(integration, integration.integration_id):+ # Scope check per workspace so an install that can't resolve identities+ # doesn't show up in another org's picker.+ if not is_slack_app_oauth_enabled(integration):continue# `(config or {}).get("team", {})` doesn't defend against an explicit# ``config["team"] = None`` — dict.get returns the literal None@@ -779,7 +779,7 @@ class UserIntegrationViewSet(viewsets.GenericViewSet):"This project has no Slack workspace connected. Ask an admin to install the Slack app first.")- if not is_slack_app_oauth_enabled(workspace, workspace.integration_id):+ if not is_slack_app_oauth_enabled(workspace):raise exceptions.PermissionDenied("Slack identity linking is not enabled for this organization.")if UserIntegration.objects.filter(diff --git a/posthog/helpers/slack_scopes.py b/posthog/helpers/slack_scopes.pyindex e132a3023bf8..a00b0e73b220 100644--- a/posthog/helpers/slack_scopes.py+++ b/posthog/helpers/slack_scopes.py@@ -16,8 +16,7 @@ logger = structlog.get_logger(__name__)# canvases:write/files:write are also excluded: they were approved only recently, so every install# authorized before then lacks them and gating mentions on them would hard-block those workspaces# until they reconnect. The artifact delivery path-# (products/tasks/backend/logic/services/living_artifacts.py) checks them at point of use instead,-# behind the slack-app-canvas-file-artifacts feature flag.+# (products/tasks/backend/logic/services/living_artifacts.py) checks them at point of use instead.REQUIRED_SLACK_SCOPES: frozenset[str] = frozenset({"app_mentions:read",diff --git a/posthog/temporal/ai/slack_app/activities/classifiers.py b/posthog/temporal/ai/slack_app/activities/classifiers.pyindex ddb50a3772a9..bf7b9672e4ba 100644--- a/posthog/temporal/ai/slack_app/activities/classifiers.py+++ b/posthog/temporal/ai/slack_app/activities/classifiers.py@@ -20,7 +20,6 @@ from products.slack_app.backend.facade.run_preferences import (available_model_choices,find_model_choice,group_by_runtime,- is_slack_app_model_classifier_enabled,)from products.slack_app.backend.models import SlackThreadTaskMapping@@ -536,7 +535,7 @@ def classify_slack_app_model_override_activity(input: SlackAppModelOverrideInputdifferent model than the first one announced. The workflow calls it once, above thepoint where the mention and follow-up paths diverge.- Every message behind the flag reaches the classifier. A keyword pre-filter would+ Every message reaches the classifier. A keyword pre-filter wouldsave the Haiku call on the majority that name no model, but it also decides — ona substring match — which phrasings can ever steer a run, and that judgementbelongs to the model reading the sentence, not to a word list. Blank text is not@@ -550,9 +549,6 @@ def classify_slack_app_model_override_activity(input: SlackAppModelOverrideInputkind="slack",integration_id=input.slack_team_id,)- if not is_slack_app_model_classifier_enabled(integration):- return None-choices = available_model_choices()if not choices:# The gateway is the source of truth for what can run; with no catalogue wediff --git a/posthog/temporal/ai/slack_app/activities/task_creation.py b/posthog/temporal/ai/slack_app/activities/task_creation.pyindex 1b32d109f1a1..dcaff423af75 100644--- a/posthog/temporal/ai/slack_app/activities/task_creation.py+++ b/posthog/temporal/ai/slack_app/activities/task_creation.py@@ -8,7 +8,8 @@ from django.db import modelsimport structlogfrom temporalio import activity-from posthog.models.integration import Integration, SlackIntegration+from posthog.helpers.slack_scopes import has_scopes+from posthog.models.integration import Integrationfrom posthog.temporal.ai.slack_app.attachments import (PreparedSlackAttachments,build_slack_attachment_prompt_text,@@ -37,7 +38,6 @@ _INITIATOR_PLACEHOLDER = "<original user message was here>"# Slack scopes the canvas/file living-artifact adapters check at delivery time._SLACK_CANVAS_FILE_ADAPTER_SCOPES = frozenset({"canvases:write", "files:write"})_SLACK_ARTIFACT_DELIVERY_KEY = "slack_artifact_delivery"-_SLACK_ARTIFACT_DELIVERY_NONE = "none"_SLACK_ARTIFACT_DELIVERY_MESSAGE = "message"_SLACK_ARTIFACT_DELIVERY_CANVAS_FILE = "canvas_file"# Charts are a second key rather than a fourth mode: an agent build that predates them@@ -125,28 +125,18 @@ def _artifact_delivery_state_updates(integration: Integration) -> dict[str, Any]"""Run state telling the agent which Slack delivery routes this workspace has.The agent turns these into its delivery constraints, so the wording lives with the- agent and the gating stays here. Canvas and file delivery needs its own rollout flag- *and* the Slack scopes the adapters write with, so that the agent is never invited to- create an artifact delivery would reject. Charts are gated on the flag alone: they- post as an image block referencing a PostHog-hosted url, which needs no upload and so- no ``files:write``. That difference is the whole point of the separate key — a- workspace waiting on the in-review scopes can still deliver charts. Resolved when the- run is created, before the sandbox boots and reads the state.+ agent and the gating stays here. Canvas and file delivery needs the Slack scopes the+ adapters write with, so that the agent is never invited to create an artifact+ delivery would reject. Charts need no scope: they post as an image block referencing+ a PostHog-hosted url, which needs no upload and so no ``files:write`` — a workspace+ still missing the adapter scopes can still deliver charts. Resolved when the run is+ created, before the sandbox boots and reads the state."""- from products.slack_app.backend.feature_flags import ( # noqa: PLC0415- is_slack_app_canvas_file_artifacts_enabled,- is_slack_app_living_artifacts_enabled,- )-- if not is_slack_app_living_artifacts_enabled(integration):- return {_SLACK_ARTIFACT_DELIVERY_KEY: _SLACK_ARTIFACT_DELIVERY_NONE, _SLACK_CHART_DELIVERY_KEY: False}-- charts_enabled = is_slack_app_canvas_file_artifacts_enabled(integration)- if charts_enabled and not SlackIntegration(integration).missing_scopes(_SLACK_CANVAS_FILE_ADAPTER_SCOPES):+ if has_scopes(integration, _SLACK_CANVAS_FILE_ADAPTER_SCOPES):mode = _SLACK_ARTIFACT_DELIVERY_CANVAS_FILEelse:mode = _SLACK_ARTIFACT_DELIVERY_MESSAGE- return {_SLACK_ARTIFACT_DELIVERY_KEY: mode, _SLACK_CHART_DELIVERY_KEY: charts_enabled}+ return {_SLACK_ARTIFACT_DELIVERY_KEY: mode, _SLACK_CHART_DELIVERY_KEY: True}def _uploaded_attachment_ids(uploaded_artifacts: list[dict[str, Any]]) -> list[str]:diff --git a/posthog/temporal/tests/ai/slack_app/activities/test_model_override_activity.py b/posthog/temporal/tests/ai/slack_app/activities/test_model_override_activity.pyindex 273f90408240..b1939b265ed5 100644--- a/posthog/temporal/tests/ai/slack_app/activities/test_model_override_activity.py+++ b/posthog/temporal/tests/ai/slack_app/activities/test_model_override_activity.py@@ -45,20 +45,18 @@ def _input(integration: Integration, text: str) -> SlackAppModelOverrideInput:class TestClassifySlackAppModelOverrideActivity:@pytest.mark.parametrize(- "text,flag_on,catalogue",+ "text,catalogue",[- ("use fable for this one", False, CATALOGUE),# The gateway is the source of truth for what can run; with no catalogue# there is nothing to validate a request against.- ("use fable for this one", True, ()),+ ("use fable for this one", ()),# A follow-up that is only an attachment carries no sentence to read.- (" ", True, CATALOGUE),+ (" ", CATALOGUE),],- ids=["flag_off", "empty_catalogue", "blank_text"],+ ids=["empty_catalogue", "blank_text"],)- def test_gates_return_no_override_without_calling_the_llm(self, integration, text, flag_on, catalogue):+ def test_gates_return_no_override_without_calling_the_llm(self, integration, text, catalogue):with (- patch(f"{ACTIVITY_MODULE}.is_slack_app_model_classifier_enabled", return_value=flag_on),patch(f"{ACTIVITY_MODULE}.available_model_choices", return_value=catalogue),patch(f"{ACTIVITY_MODULE}.classify_slack_app_model_override") as classify,):@@ -77,7 +75,6 @@ class TestClassifySlackAppModelOverrideActivity:)def test_passes_the_mention_to_the_classifier_and_returns_its_verdict(self, integration, classified):with (- patch(f"{ACTIVITY_MODULE}.is_slack_app_model_classifier_enabled", return_value=True),patch(f"{ACTIVITY_MODULE}.available_model_choices", return_value=CATALOGUE),patch(f"{ACTIVITY_MODULE}.classify_slack_app_model_override", return_value=classified) as classify,):diff --git a/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py b/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.pyindex eb9b3f4ce7e0..58448202b276 100644--- a/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py+++ b/posthog/temporal/tests/ai/slack_app/activities/test_task_creation.py@@ -12,7 +12,6 @@ to wording in the wrapper text show up as a diff in"""import pytest-from unittest.mock import patchfrom posthog.models.integration import Integrationfrom posthog.temporal.ai.slack_app.activities.task_creation import (@@ -80,39 +79,24 @@ def test_build_description_keeps_the_prompt_bare_without_a_context_block(thread_@pytest.mark.parametrize(- "living_enabled,canvas_flag_enabled,granted_scopes,expected_mode,expected_charts",+ "granted_scopes,expected_mode",[- (True, True, "chat:write,canvases:write,files:write", "canvas_file", True),- (True, True, "chat:write,canvases:write", "message", True),- (True, True, "chat:write", "message", True),- (True, False, "chat:write,canvases:write,files:write", "message", False),- (False, True, "chat:write,canvases:write,files:write", "none", False),+ ("chat:write,canvases:write,files:write", "canvas_file"),+ ("chat:write,canvases:write", "message"),+ ("chat:write", "message"),],)-def test_artifact_delivery_mode_offers_only_what_delivery_accepts(- living_enabled, canvas_flag_enabled, granted_scopes, expected_mode, expected_charts-):+def test_artifact_delivery_mode_offers_only_what_delivery_accepts(granted_scopes, expected_mode):# The agent offers whatever this state says, so it must never claim more than the- # workspace has: canvas/file needs its flag AND both scopes AND the umbrella gate,- # or the agent promises an artifact the adapters then reject. Charts clear on the flag- # and the umbrella gate alone, which is why the two rows with the flag on but a scope- # missing still get charts while dropping to message mode.+ # workspace has: canvas/file needs both adapter scopes, or the agent promises an+ # artifact the adapters then reject. Charts need no scope, which is why a workspace+ # missing one still gets charts while dropping to message mode.integration = Integration(kind="slack", config={"scope": granted_scopes})- with (- patch(- "products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled",- return_value=living_enabled,- ),- patch(- "products.slack_app.backend.feature_flags.is_slack_app_canvas_file_artifacts_enabled",- return_value=canvas_flag_enabled,- ),- ):- assert _artifact_delivery_state_updates(integration) == {- "slack_artifact_delivery": expected_mode,- "slack_chart_delivery": expected_charts,- }+ assert _artifact_delivery_state_updates(integration) == {+ "slack_artifact_delivery": expected_mode,+ "slack_chart_delivery": True,+ }def test_build_description_renders_labeled_mention_for_each_author():diff --git a/products/slack_app/backend/api.py b/products/slack_app/backend/api.pyindex 0b102ccb3ef2..0aea0f0fbbd9 100644--- a/products/slack_app/backend/api.py+++ b/products/slack_app/backend/api.py@@ -60,9 +60,7 @@ from products.slack_app.backend.discussion_replies import try_ingest_discussion_from products.slack_app.backend.feature_flags import (ASSISTANT_REQUIRED_SCOPES,is_slack_app_assistant_enabled,- is_slack_app_assistant_flag_enabled,is_slack_app_oauth_enabled,- is_slack_app_untagged_thread_followups_enabled,)from products.slack_app.backend.helpers import local_dev_slack_emailfrom products.slack_app.backend.models import SlackChannel, SlackThreadTaskMapping, UntaggedFollowupMode@@ -382,18 +380,13 @@ def resolve_slack_user(# path on miss so this stays additive — a workspace with no links# behaves exactly like before.#- # The link lookup runs FIRST (two cheap indexed queries) and the flag- # check only fires when a row is found, and on the email-mismatch- # failure branch below to decide whether to offer the invite button.- # Both checks are local-evaluation only (`only_evaluate_locally=True`),- # so calling twice on the rare both-branches path is essentially free.linked_user = find_linked_posthog_user(slack_user_id=slack_user_id,slack_team_id=slack_team_id,candidate_org_ids={integration.team.organization_id},)- if linked_user is not None and is_slack_app_oauth_enabled(integration, slack_team_id):+ if linked_user is not None and is_slack_app_oauth_enabled(integration):user_permissions = UserPermissions(user=linked_user, team=integration.team)if user_permissions.current_team.effective_membership_level is None:logger.warning(@@ -476,7 +469,7 @@ def resolve_slack_user(),prefer_thread_message=True,)- if is_slack_app_oauth_enabled(integration, slack_team_id):+ if is_slack_app_oauth_enabled(integration):invite_url = build_invite_url(slack_user_id=slack_user_id,slack_team_id=slack_team_id,@@ -1367,20 +1360,16 @@ def _resolve_untagged_followup_mapping(candidates: list[Integration],channel: str | None,thread_ts: str | None,- slack_team_id: str,) -> SlackThreadTaskMapping | None:- """Look up a ``SlackThreadTaskMapping`` for an untagged thread reply and- confirm the integration's org has opted in via the feature flag.+ """Look up the ``SlackThreadTaskMapping`` for an untagged thread reply.Returns the mapping when the message should enter the shared routing- pipeline; ``None`` when it should drop. Two distinct ``None`` cases —- no mapping (thread we don't own) and FF off — are logged separately so- rollout dashboards can tell them apart.+ pipeline; ``None`` when the thread isn't ours and it should drop."""candidate_ids = [c.id for c in candidates]# ``task`` is fetched separately inside the classifier activity — the- # handler hot path only needs the integration (for the FF check + the- # ``mention_target`` override downstream).+ # handler hot path only needs the integration (for the ``mention_target``+ # override downstream).mapping = (SlackThreadTaskMapping.objects.filter(integration_id__in=candidate_ids,@@ -1390,17 +1379,6 @@ def _resolve_untagged_followup_mapping(.select_related("integration", "integration__team").first())- if mapping is None:- return None- if not is_slack_app_untagged_thread_followups_enabled(mapping.integration, slack_team_id):- logger.info(- "slack_app_thread_message_feature_flag_off",- slack_team_id=slack_team_id,- channel=channel,- thread_ts=thread_ts,- integration_id=mapping.integration_id,- )- return Nonereturn mapping@@ -1600,16 +1578,14 @@ def resolve_posthog_user_from_event(return None# Linked-user path: short-circuit the email match when the user has bound- # their Slack identity to a PostHog account. The cheap indexed lookup- # runs first; the feature-flag gate only fires when a row is found so- # workspaces with no linked users don't pay for the flag evaluation.+ # their Slack identity to a PostHog account.slack_team_id = probe_integration.integration_idlinked_user = find_linked_posthog_user(slack_user_id=slack_user_id,slack_team_id=slack_team_id,candidate_org_ids=org_ids,)- if linked_user is not None and is_slack_app_oauth_enabled(probe_integration, slack_team_id):+ if linked_user is not None and is_slack_app_oauth_enabled(probe_integration):return linked_user if linked_user.is_active else Noneif slack_email is None:@@ -1714,7 +1690,7 @@ def _post_user_resolution_failure_reply(posted = _post_slack_user_feedback(slack_client, channel, slack_user_id, thread_ts, text, prefer_thread_message=True)- if failure_reason == "user_not_found" and is_slack_app_oauth_enabled(probe, probe.integration_id):+ if failure_reason == "user_not_found" and is_slack_app_oauth_enabled(probe):invite_url = build_invite_url(slack_user_id=slack_user_id,slack_team_id=probe.integration_id,@@ -1975,12 +1951,6 @@ def _route_assistant_event(probe = result.integration if result.integration in result.candidates else result.candidates[0]- # Kill-switch first: stay fully dark (no user resolution, no Slack reply) when the flag is off.- # The flag alone, not the full gate — a workspace that opted in but is missing scopes should- # hear that from `_handle_assistant_dm_message`, not be silently ignored.- if not is_slack_app_assistant_flag_enabled(probe.team):- return ROUTE_HANDLED_LOCALLY-# Share the mention path's user resolution + access filter, so the DM only ever sees and runs# against projects the resolved PostHog user can actually access (no cross-org metadata leak).resolution = resolve_user_for_workspace(@@ -1990,7 +1960,7 @@ def _route_assistant_event(event_id=event_id,)if resolution.user is None:- # Flag is on but the Slack user isn't a resolvable org member — tell them why (DMs only).+ # The Slack user isn't a resolvable org member — tell them why (DMs only).if event_type == "message":_post_assistant_unavailable(SlackIntegration(probe), fields.dm_channel_id, fields.thread_ts)return ROUTE_HANDLED_LOCALLY@@ -2275,15 +2245,14 @@ def route_posthog_code_event_to_relevant_region(if ingested:return ROUTE_HANDLED_LOCALLY- # Threads we don't own (and orgs that haven't opted in) are dropped here- # so the rest of the pipeline only runs for actionable messages.+ # Threads we don't own are dropped here so the rest of the pipeline+ # only runs for actionable messages.untagged_followup_mapping: SlackThreadTaskMapping | None = Noneif event_type == "message":untagged_followup_mapping = _resolve_untagged_followup_mapping(candidates=workspace_result.candidates,channel=channel_str,thread_ts=thread_ts_str,- slack_team_id=slack_team_id,)if untagged_followup_mapping is None:return ROUTE_HANDLED_LOCALLY@@ -2865,9 +2834,8 @@ def _route_team_join(member gets the DM: it grants no access on its own — the assistantresolves and authorizes the user on every interaction, offering theaccount-linking flow when their email doesn't match — so eligibility- sorts itself out on first use. The ``slack-app-assistant`` flag is the- per-install opt-in that keeps the DM dark for workspaces that haven't- enabled the assistant.+ sorts itself out on first use. The DM stays dark for installs that lack+ the assistant scopes."""joiner = event.get("user") if isinstance(event.get("user"), dict) else Noneslack_user_id = joiner.get("id") if joiner else None@@ -3232,9 +3200,7 @@ def _handle_untagged_followup_run(payload: dict) -> HttpResponse:.select_related("team__organization").first())- # A flag turned off between prompt and click means the whole untagged path is- # dark again; an unresolvable clicker means we have nobody to run as.- if integration is None or not is_slack_app_untagged_thread_followups_enabled(integration, slack_team_id):+ if integration is None:_delete_ephemeral_via_response_url(response_url)return HttpResponse(status=200)diff --git a/products/slack_app/backend/facade/run_preferences.py b/products/slack_app/backend/facade/run_preferences.pyindex 1151a1de73e6..086869235409 100644--- a/products/slack_app/backend/facade/run_preferences.py+++ b/products/slack_app/backend/facade/run_preferences.py@@ -6,7 +6,6 @@ because that one is about stored per-(workspace, user) settings, while this is acatalogue those settings pick from and the precedence that resolves them for one run."""-from products.slack_app.backend.feature_flags import is_slack_app_model_classifier_enabledfrom products.slack_app.backend.services.model_catalogue import (ModelChoice,available_model_choices,@@ -27,7 +26,6 @@ __all__ = ["describe_run_model","find_model_choice","group_by_runtime",- "is_slack_app_model_classifier_enabled","resolve_live_run_override","resolve_run_preferences",]diff --git a/products/slack_app/backend/facade/slack_settings.py b/products/slack_app/backend/facade/slack_settings.pyindex 180f130b4e39..9189b7f5ceea 100644--- a/products/slack_app/backend/facade/slack_settings.py+++ b/products/slack_app/backend/facade/slack_settings.py@@ -5,7 +5,6 @@ import from here rather than reaching into `services/`. Mirrors the layeringin `products/tasks/backend/facade/`."""-from products.slack_app.backend.feature_flags import SLACK_APP_HOME_FLAGfrom products.slack_app.backend.services.slack_settings import (AIPreferences,resolve_ai_preferences,@@ -13,7 +12,6 @@ from products.slack_app.backend.services.slack_settings import ()__all__ = [- "SLACK_APP_HOME_FLAG","AIPreferences","resolve_ai_preferences","validate_ai_preferences",diff --git a/products/slack_app/backend/feature_flags.py b/products/slack_app/backend/feature_flags.pyindex 20b579c3a6ee..bd7906a1c363 100644--- a/products/slack_app/backend/feature_flags.py+++ b/products/slack_app/backend/feature_flags.py@@ -28,21 +28,13 @@ import posthoganalyticsfrom posthog.helpers.slack_scopes import REQUIRED_SLACK_SCOPES, has_scopesfrom posthog.models.integration import Integration-from posthog.models.team.team import Teamfrom posthog.utils import get_instance_regionlogger = structlog.get_logger(__name__)-SLACK_APP_OAUTH_FLAG = "slack-app-oauth"-SLACK_APP_HOME_FLAG = "slack-app-home"SLACK_APP_AGENT_DESIGN_FLAG = "slack-app-agent-design"-SLACK_APP_ASSISTANT_FLAG = "slack-app-assistant"-SLACK_APP_LIVING_ARTIFACTS_FLAG = "slack-app-living-artifacts"-SLACK_APP_CANVAS_FILE_ARTIFACTS_FLAG = "slack-app-canvas-file-artifacts"-SLACK_APP_MODEL_CLASSIFIER_FLAG = "slack-app-model-classifier"SLACK_APP_FORKING_FLAG = "slack-app-forking"-UNTAGGED_THREAD_FOLLOWUPS_FLAG = "posthog-slack-app-untagged-thread-followups"# Linking a Slack identity to a PostHog user resolves the Slack profile and its email.@@ -60,92 +52,19 @@ def _region_properties() -> dict[str, str]:return {"region": get_instance_region() or "dev"}-def is_slack_app_oauth_enabled(integration: Integration, slack_team_id: str) -> bool:+def is_slack_app_oauth_enabled(integration: Integration) -> bool:"""Gate for the Slack user-identity OAuth link feature, covering both backend(offering the invite button, accepting the link callback, listing/startingfrom settings) and frontend (rendering the Slack card in Personal- integrations) decisions. Keyed on the Slack workspace + PostHog org."""- if not has_scopes(integration, OAUTH_REQUIRED_SCOPES):- return False- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_OAUTH_FLAG,- f"slack_workspace:{slack_team_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_user_link_feature_flag_check_failed",- slack_team_id=slack_team_id,- integration_id=integration.id,- )- return False---def is_slack_app_home_enabled(integration: Integration) -> bool:- """Gate for the App Home tab surface and the AI-settings resolver that feeds- Slack-triggered task runs. Publishing a Home view needs no scope of its own, so- this is the flag alone. Keyed on the Slack workspace + PostHog org."""- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_HOME_FLAG,- f"slack_workspace:{integration.integration_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_home_feature_flag_check_failed",- integration_id=integration.id,- )- return False---def is_slack_app_model_classifier_enabled(integration: Integration) -> bool:- """Gate for reading a one-off model choice out of the mention text ("use fable- for this one") and running that task on it. Reads text the bot already receives,- so this is the flag alone. Keyed on the Slack workspace + PostHog org, matching- the other Slack-app gates.-- Also gates the provenance footer under a finished reply: naming a model in a mention- and being told which model ran are two halves of the same feature, and splitting them- across two flags would let a workspace pick a model and then not be shown it.-- Independent of ``slack-app-home``: an override applies whether or not the- workspace has opted into the settings tab."""- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_MODEL_CLASSIFIER_FLAG,- f"slack_workspace:{integration.integration_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_model_classifier_feature_flag_check_failed",- integration_id=integration.id,- )- return False+ integrations) decisions. Linking resolves the Slack profile and its email,+ so the install must hold the identity scopes."""+ return has_scopes(integration, OAUTH_REQUIRED_SCOPES)def is_slack_app_agent_design_enabled(integration: Integration) -> bool:"""Gate for the agent-design plan-block streaming surface on Slack task runs.Posts through the ``chat:write`` the mention flow already requires, so this is the- flag alone. Keyed on the Slack workspace + PostHog org, matching- ``is_slack_app_home_enabled``."""+ flag alone. Keyed on the Slack workspace + PostHog org."""try:return bool(posthoganalytics.feature_enabled(@@ -165,117 +84,11 @@ def is_slack_app_agent_design_enabled(integration: Integration) -> bool:return False-def is_slack_app_canvas_file_artifacts_enabled(integration: Integration) -> bool:- """Gate for living-artifact delivery that depends on ``canvases:write`` (the canvas- adapter) and ``files:write`` (the file adapter). Both are approved but recent, so an- install authorized earlier won't have them until it reconnects.-- The flag alone: the two adapters need one scope each, so they check theirs at point- of use and can name the one to grant, and chart images post by public url on- ``chat:write`` alone, so this flag can roll charts out ahead of those grants. Keyed- on the Slack workspace + PostHog org."""- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_CANVAS_FILE_ARTIFACTS_FLAG,- f"slack_workspace:{integration.integration_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_canvas_file_artifacts_feature_flag_check_failed",- integration_id=integration.id,- )- return False---def is_slack_app_living_artifacts_enabled(integration: Integration) -> bool:- """Gate for creating, editing, and delivering living artifacts from Slack runs.-- Keyed on the Slack workspace + PostHog org. This is the umbrella artifact gate;- canvas and file adapters additionally require their scope rollout flag.- """- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_LIVING_ARTIFACTS_FLAG,- f"slack_workspace:{integration.integration_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_living_artifacts_feature_flag_check_failed",- integration_id=integration.id,- )- return False---def is_slack_app_untagged_thread_followups_enabled(integration: Integration, slack_team_id: str) -> bool:- """Gate for the untagged-thread followup path: when on, every message in a- tagged thread is eligible for classification + forward instead of requiring- a fresh ``@PostHog`` mention. Keyed on the Slack workspace + PostHog org.-- The flag alone: a followup only reaches this after a mention in the same thread, and- that path already enforces ``REQUIRED_SLACK_SCOPES`` — which covers reading channel- history — while telling the user which scopes to grant."""- try:- return bool(- posthoganalytics.feature_enabled(- UNTAGGED_THREAD_FOLLOWUPS_FLAG,- f"slack_workspace:{slack_team_id}",- groups={"organization": str(integration.team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception(- "slack_app_thread_message_feature_flag_check_failed",- slack_team_id=slack_team_id,- integration_id=integration.id,- )- return False---def is_slack_app_assistant_flag_enabled(team: Team) -> bool:- """Kill-switch for the DM assistant. Evaluated on the workspace's team (a- stable key) so the feature can be checked before resolving the DMing user —- i.e. it stays dark when off.-- Kept apart from ``is_slack_app_assistant_enabled`` because the two answers call- for opposite responses: a workspace outside the rollout gets silence, one that- opted in but lacks scopes gets told which scopes to grant."""- try:- return bool(- posthoganalytics.feature_enabled(- SLACK_APP_ASSISTANT_FLAG,- str(team.uuid),- groups={"organization": str(team.organization_id)},- person_properties=_region_properties(),- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- except Exception:- logger.exception("assistant_feature_flag_eval_failed")- return False--def is_slack_app_assistant_enabled(integration: Integration) -> bool:- """Gate for the DM assistant: rolled out to this workspace, and installed with- the scopes the DM surface calls."""- if not has_scopes(integration, ASSISTANT_REQUIRED_SCOPES):- return False- return is_slack_app_assistant_flag_enabled(integration.team)+ """Gate for the DM assistant: the install must hold the scopes the DM surface+ calls — ``im:history`` in particular, without which the assistant would answer+ once and then go deaf to follow-ups."""+ return has_scopes(integration, ASSISTANT_REQUIRED_SCOPES)def is_slack_app_forking_enabled(integration: Integration) -> bool:diff --git a/products/slack_app/backend/services/run_preferences.py b/products/slack_app/backend/services/run_preferences.pyindex 3b6194805ef9..36e856f36e90 100644--- a/products/slack_app/backend/services/run_preferences.py+++ b/products/slack_app/backend/services/run_preferences.py@@ -80,10 +80,6 @@ def resolve_run_preferences(own applies to whichever model the run was already going to use. Either can beabsent, and a request we can't honour — a model that isn't on offer, an effort themodel doesn't support — leaves the run on its saved preferences.-- Note that `resolve_ai_preferences` yields nothing at all for a workspace that- hasn't enabled `slack-app-home`, so there the chain is the Slack default plus- whatever the mention asked for."""override_model = override.model if override else Noneoverride_effort = override.reasoning_effort if override else Nonediff --git a/products/slack_app/backend/services/slack_app_home.py b/products/slack_app/backend/services/slack_app_home.pyindex 71742b203efa..5f36a2d85a68 100644--- a/products/slack_app/backend/services/slack_app_home.py+++ b/products/slack_app/backend/services/slack_app_home.py@@ -32,11 +32,7 @@ from posthog.models.user import Userfrom posthog.models.user_integration import UserIntegrationfrom posthog.user_permissions import UserPermissions-from products.slack_app.backend.feature_flags import (- is_slack_app_home_enabled,- is_slack_app_oauth_enabled,- is_slack_app_untagged_thread_followups_enabled,-)+from products.slack_app.backend.feature_flags import is_slack_app_oauth_enabledfrom products.slack_app.backend.models import SlackSettings, SlackUserProfileCache, UntaggedFollowupModefrom products.slack_app.backend.services.integration_resolver import load_integrationsfrom products.slack_app.backend.services.model_catalogue import (@@ -1470,26 +1466,12 @@ def handle_app_home_opened(event: dict, slack_team_id: str, *, integration: InteThe caller resolves the integration through the shared region gate, so thisregion owns the workspace by the time we get here.-- Gated by the slack-app-home flag — when off, the publish is skipped so- installs without the manifest changes (and workspaces that haven't opted- in) keep getting Slack's default blank Home tab instead of seeing an- interactive UI for a feature that doesn't fire downstream."""slack_user_id = event.get("user")if not slack_user_id:return- if not is_slack_app_home_enabled(integration):- logger.info(- "slack_app_home_publish_skipped",- reason="flag_off",- slack_team_id=slack_team_id,- slack_user_id=slack_user_id,- )- return-effective = resolve_ai_preferences(integration, slack_user_id)user_row = _load_user_row(integration, slack_user_id)@@ -1511,7 +1493,7 @@ def handle_app_home_opened(event: dict, slack_team_id: str, *, integration: Inteproject_state=project_state,tasks_state=tasks_state,stats_state=stats_state,- untagged_followup_mode=_resolve_untagged_followup_mode_for_card(integration, slack_user_id),+ untagged_followup_mode=resolve_untagged_followup_mode(integration, slack_user_id),has_project_access=bool(accessible),)try:@@ -1542,12 +1524,6 @@ def handle_ai_preferences_block_action(payload: dict, action: dict) -> HttpRespoif integration is None:return HttpResponse(status=200)- # The flag is the kill-switch for the whole feature — writes and modal- # opens must respect it too, otherwise a flipped-off flag silently- # accumulates rows that the resolver will ignore.- if not is_slack_app_home_enabled(integration):- return HttpResponse(status=200)-# The Home tab keeps no server-side view state — every payload carries the whole# view's inputs instead. Read them all back once so any action republishes with the# controls the user had dialled in, rather than resetting its neighbours' cards.@@ -1585,18 +1561,15 @@ def handle_ai_preferences_block_action(payload: dict, action: dict) -> HttpResporeturn HttpResponse(status=200)if action_id == ACTION_SET_UNTAGGED_FOLLOWUP_MODE:- # Same gate the card is rendered behind, so a stale view can't write a- # setting for a workspace that has since been switched off.- if is_slack_app_untagged_thread_followups_enabled(integration, integration.integration_id):- _apply_untagged_followup_mode_pick(integration, slack_user_id, action)+ _apply_untagged_followup_mode_pick(integration, slack_user_id, action)republish()return HttpResponse(status=200)if action_id == ACTION_UNLINK_ACCOUNT:- # Only act when the OAuth-link feature is on for this workspace —+ # Only act when the OAuth-link feature is available for this install —# otherwise the button shouldn't have been rendered, and a stale# cached view shouldn't be allowed to drive deletes.- if is_slack_app_oauth_enabled(integration, integration.integration_id):+ if is_slack_app_oauth_enabled(integration):_unlink_user_account(integration, slack_user_id)republish()return HttpResponse(status=200)@@ -1648,9 +1621,6 @@ def handle_app_home_view_submission(payload: dict) -> HttpResponse | JsonResponsif integration is None:return _modal_error_response("This Slack workspace is no longer connected to PostHog.")- if not is_slack_app_home_enabled(integration):- return _modal_error_response("AI preferences are not available for this workspace right now.")-runtime_adapter, model, reasoning_effort = parse_modal_submission(view)try:@@ -1833,19 +1803,6 @@ def _write_row()-def _resolve_untagged_followup_mode_for_card(- integration: Integration, slack_user_id: str-) -> UntaggedFollowupMode | None:- """The picker's current value, or ``None`` to leave the card out entirely.-- The setting only means anything where untagged follow-ups run at all, so the- card lives behind the same flag as the behaviour it configures.- """- if not is_slack_app_untagged_thread_followups_enabled(integration, integration.integration_id):- return None- return resolve_untagged_followup_mode(integration, slack_user_id)--def _apply_untagged_followup_mode_pick(integration: Integration, slack_user_id: str, action: dict) -> None:"""Persist the picked mode. An unrecognised value is ignored rather than stored."""@@ -1923,7 +1880,7 @@ def _republish_home(project_state=project_state,tasks_state=tasks_state,stats_state=stats_state,- untagged_followup_mode=_resolve_untagged_followup_mode_for_card(integration, slack_user_id),+ untagged_followup_mode=resolve_untagged_followup_mode(integration, slack_user_id),has_project_access=bool(accessible),)try:@@ -2108,7 +2065,7 @@ def _format_relative(when: datetime | None, *, now: datetime) -> str:def _resolve_account_state(integration: Integration, slack_user_id: str) -> AccountState:slack_team_id = integration.integration_id- if not is_slack_app_oauth_enabled(integration, slack_team_id):+ if not is_slack_app_oauth_enabled(integration):return AccountState(enabled=False)candidate_org_ids = _workspace_org_ids(slack_team_id)@@ -2154,7 +2111,7 @@ def _resolve_home_user(integration: Integration, slack_user_id: str) -> User | Nif not candidate_org_ids:return None- if is_slack_app_oauth_enabled(integration, slack_team_id):+ if is_slack_app_oauth_enabled(integration):linked_user = find_linked_posthog_user(slack_user_id=slack_user_id,slack_team_id=slack_team_id,diff --git a/products/slack_app/backend/services/slack_settings.py b/products/slack_app/backend/services/slack_settings.pyindex 0c23b2768759..c75746c69659 100644--- a/products/slack_app/backend/services/slack_settings.py+++ b/products/slack_app/backend/services/slack_settings.py@@ -13,10 +13,6 @@ a half-set row reads as "no preference" rather than half-applying.stale effort from a previous model choice can't silently stick. Unset keysstay `None` so the task layer applies its own defaults rather thanduplicating them here.--Gated by the `slack-app-home` feature flag: when off the resolver returns-the empty object, preserving pre-Home-tab behaviour for workspaces that-haven't opted in."""from __future__ import annotations@@ -24,7 +20,6 @@ from __future__ import annotationsfrom dataclasses import dataclassfrom typing import TYPE_CHECKING, Any-from products.slack_app.backend.feature_flags import is_slack_app_home_enabledfrom products.slack_app.backend.models import UntaggedFollowupModefrom products.slack_app.backend.services.model_catalogue import filter_unsupported_effort@@ -60,7 +55,7 @@ def resolve_ai_preferences(integration: Integration, slack_user_id: str | None)resolved model doesn't support it."""- if not slack_user_id or not is_slack_app_home_enabled(integration):+ if not slack_user_id:return _EMPTYfrom products.slack_app.backend.models import SlackSettingsdiff --git a/products/slack_app/backend/slack_thread.py b/products/slack_app/backend/slack_thread.pyindex c80b6685c7f9..5b6269fed157 100644--- a/products/slack_app/backend/slack_thread.py+++ b/products/slack_app/backend/slack_thread.py@@ -8,11 +8,7 @@ from slack_sdk.errors import SlackApiErrorfrom posthog.models.integration import Integration, SlackIntegration-from products.slack_app.backend.feature_flags import (- is_slack_app_forking_enabled,- is_slack_app_home_enabled,- is_slack_app_model_classifier_enabled,-)+from products.slack_app.backend.feature_flags import is_slack_app_forking_enabledfrom products.slack_app.backend.services.model_catalogue import describe_run_modelfrom products.slack_app.backend.services.slack_messages import (RunFooter,@@ -147,7 +143,6 @@ class SlackThreadHandler:self._integration: Integration | None = Noneself._client: WebClient | None = Noneself._bot_user_id: str | None = None- self._footer_flag: bool | None = Noneself._fork_flag: bool | None = Noneself._code_access: bool | None = None@@ -163,18 +158,6 @@ class SlackThreadHandler:self._client = SlackIntegration(integration).clientreturn self._client- def footer_enabled(self) -> bool:- """Whether this workspace shows run provenance.-- Shares the model-classifier flag: choosing a model in a mention and being told- which model ran are two halves of one feature. Public so a caller can skip the- work of describing a run nobody will be shown, and memoized because that caller- and the footer builder both ask.- """- if self._footer_flag is None:- self._footer_flag = is_slack_app_model_classifier_enabled(self._get_integration())- return bool(self._footer_flag)-def viewer_can_open_code_links(self) -> bool:"""Whether this reply's reader can open a PostHog Code link. Memoized: the cardsask for their buttons and the footer asks again for its own links."""@@ -201,25 +184,13 @@ class SlackThreadHandler:return self.reader_footer().task_urldef _footer_block(self, include_task_url: bool = True) -> dict[str, Any] | None:- """This handler's footer, or `None` when the workspace isn't in the rollout.-- "Configure" points at the Home tab, so it only appears where that tab exists — a- workspace outside the Home rollout would land on an empty one. The Home flag is- only consulted once there is actually something to gate.- """- # A handler with nothing to describe can't produce a footer, so it never pays for- # the flag lookups.+ """This handler's footer, or `None` when there is nothing to describe."""if not self.run_footer.has_content():return None- if not self.footer_enabled():- return Nonefooter = self.reader_footer()if not include_task_url:footer = replace(footer, task_url=None)- integration = self._get_integration()- configure_url = app_home_url(integration)- if configure_url and not is_slack_app_home_enabled(integration):- configure_url = None+ configure_url = app_home_url(self._get_integration())return reply_footer_block(footer, configure_url)def _fork_menu(self) -> dict[str, Any] | None:diff --git a/products/slack_app/backend/tests/services/test_slack_app_home.py b/products/slack_app/backend/tests/services/test_slack_app_home.pyindex 767aa619bee7..9c612f4ce143 100644--- a/products/slack_app/backend/tests/services/test_slack_app_home.py+++ b/products/slack_app/backend/tests/services/test_slack_app_home.py@@ -1094,7 +1094,6 @@ class TestTasksControlsResolveViewState:def _resolved_state(self, monkeypatch, payload: dict):captured: dict[str, Any] = {}monkeypatch.setattr(slack_app_home, "_resolve_interaction_integration", lambda team_id, user_id: object())- monkeypatch.setattr(slack_app_home, "is_slack_app_home_enabled", lambda integration: True)monkeypatch.setattr(slack_app_home,"_republish_home",diff --git a/products/slack_app/backend/tests/services/test_slack_settings.py b/products/slack_app/backend/tests/services/test_slack_settings.pyindex e9970915b97e..7f6cbaaef3ac 100644--- a/products/slack_app/backend/tests/services/test_slack_settings.py+++ b/products/slack_app/backend/tests/services/test_slack_settings.py@@ -1,7 +1,6 @@from typing import Anyimport pytest-from unittest.mock import patchfrom django.core.exceptions import ValidationError@@ -9,7 +8,6 @@ from posthog.models.integration import Integrationfrom posthog.models.organization import Organizationfrom posthog.models.team.team import Team-from products.slack_app.backend.feature_flags import SLACK_APP_HOME_FLAGfrom products.slack_app.backend.models import SlackSettings, UntaggedFollowupModefrom products.slack_app.backend.services.slack_settings import (AIPreferences,@@ -32,25 +30,6 @@ def slack_setup(db):return integration-def flag_on():- """Flip the slack-app-home flag on for the duration of a test."""- with patch(- "products.slack_app.backend.feature_flags.posthoganalytics.feature_enabled",- return_value=True,- ) as mock:- yield mock---def flag_off():- with patch(- "products.slack_app.backend.feature_flags.posthoganalytics.feature_enabled",- return_value=False,- ) as mock:- yield mock--@pytest.fixture(autouse=True)def _stub_task_runtime_helpers():"""Replace the lazy tasks-facade imports with a minimal stub.@@ -181,7 +160,7 @@ class TestResolveAIPreferences:),],)- def test_resolution_table(self, slack_setup, flag_on, user_row, workspace_row, expected):+ def test_resolution_table(self, slack_setup, user_row, workspace_row, expected):integration = slack_setupif user_row:SlackSettings.objects.create(@@ -207,7 +186,7 @@ class TestResolveAIPreferences:)assert resolve_ai_preferences(integration, "U001") == expected- def test_user_row_with_no_pair_reads_as_no_preference(self, slack_setup, flag_on):+ def test_user_row_with_no_pair_reads_as_no_preference(self, slack_setup):"""A user row without the atomic `(runtime_adapter, model)` pair istreated as "no personal preference" — the orphaned effort never leaksinto the resolved triple."""@@ -224,7 +203,7 @@ class TestResolveAIPreferences:assert resolve_ai_preferences(integration, "U001") == AIPreferences()- def test_unsupported_effort_dropped_when_model_does_not_support_it(self, slack_setup, flag_on):+ def test_unsupported_effort_dropped_when_model_does_not_support_it(self, slack_setup):"""If a row stores an effort the resolved model can't honour (e.g.the model definition changed since the effort was saved), theresolver drops it rather than letting it leak through to the task@@ -247,7 +226,7 @@ class TestResolveAIPreferences:assert result.model == "claude-sonnet-4-6"assert result.reasoning_effort is None- def test_user_id_none_resolves_empty(self, slack_setup, flag_on):+ def test_user_id_none_resolves_empty(self, slack_setup):# No Slack user to attribute the run to, so there's no preference to# apply — the workspace row's AI fields are no longer consulted.integration = slack_setup@@ -259,30 +238,6 @@ class TestResolveAIPreferences:)assert resolve_ai_preferences(integration, None) == AIPreferences()- def test_flag_off_returns_empty_even_with_rows_present(self, slack_setup, flag_off):- integration = slack_setup- SlackSettings.objects.create(- default_integration=integration,- slack_workspace_id="T_WS",- slack_user_id="U001",- ai_preferences={"runtime_adapter": "claude", "model": "claude-opus-4-7", "reasoning_effort": "high"},- )- assert resolve_ai_preferences(integration, "U001") == AIPreferences()-- def test_flag_check_failure_fails_closed(self, slack_setup):- integration = slack_setup- SlackSettings.objects.create(- default_integration=integration,- slack_workspace_id="T_WS",- slack_user_id="U001",- ai_preferences={"runtime_adapter": "claude", "model": "claude-opus-4-7", "reasoning_effort": "high"},- )- with patch(- "products.slack_app.backend.feature_flags.posthoganalytics.feature_enabled",- side_effect=RuntimeError("boom"),- ):- assert resolve_ai_preferences(integration, "U001") == AIPreferences()-class TestResolveUntaggedFollowupMode:@pytest.mark.parametrize(@@ -359,7 +314,3 @@ class TestValidateAIPreferences:def test_effort_unsupported_by_model_rejected(self):with pytest.raises(ValidationError, match="not supported"):validate_ai_preferences("claude", "claude-sonnet-4-6", "xhigh")-- def test_flag_constant_is_stable(self):- # Sanity: the flag name is what we documented and rolled out with.- assert SLACK_APP_HOME_FLAG == "slack-app-home"diff --git a/products/slack_app/backend/tests/test_feature_flags.py b/products/slack_app/backend/tests/test_feature_flags.pyindex ef49ddc4b186..87b30a43aa3a 100644--- a/products/slack_app/backend/tests/test_feature_flags.py+++ b/products/slack_app/backend/tests/test_feature_flags.py@@ -1,14 +1,11 @@import pytest-from unittest.mock import patchfrom products.slack_app.backend import feature_flags-SLACK_TEAM_ID = "T12345"--# (gate, scopes the feature calls, trailing args the gate takes)+# (gate, scopes the feature calls)SCOPED_GATES = [- (feature_flags.is_slack_app_oauth_enabled, feature_flags.OAUTH_REQUIRED_SCOPES, (SLACK_TEAM_ID,)),- (feature_flags.is_slack_app_assistant_enabled, feature_flags.ASSISTANT_REQUIRED_SCOPES, ()),+ (feature_flags.is_slack_app_oauth_enabled, feature_flags.OAUTH_REQUIRED_SCOPES),+ (feature_flags.is_slack_app_assistant_enabled, feature_flags.ASSISTANT_REQUIRED_SCOPES),]IDS = [gate.__name__ for gate, *_ in SCOPED_GATES]@@ -19,25 +16,15 @@ def _grant(integration, scopes):integration.save()[email protected](("gate", "required", "extra_args"), SCOPED_GATES, ids=IDS)-def test_gate_opens_when_the_flag_is_on_and_the_scopes_are_granted(workspace_integration, gate, required, extra_args):[email protected](("gate", "required"), SCOPED_GATES, ids=IDS)+def test_gate_opens_when_the_scopes_are_granted(workspace_integration, gate, required):_grant(workspace_integration, required)- with patch("posthoganalytics.feature_enabled", return_value=True):- assert gate(workspace_integration, *extra_args) is True+ assert gate(workspace_integration) is True[email protected](("gate", "required", "extra_args"), SCOPED_GATES, ids=IDS)-def test_gate_stays_closed_when_a_required_scope_is_missing(workspace_integration, gate, required, extra_args):[email protected](("gate", "required"), SCOPED_GATES, ids=IDS)+def test_gate_stays_closed_when_a_required_scope_is_missing(workspace_integration, gate, required):_grant(workspace_integration, required - {min(required)})- with patch("posthoganalytics.feature_enabled", return_value=True):- assert gate(workspace_integration, *extra_args) is False--[email protected](("gate", "required", "extra_args"), SCOPED_GATES, ids=IDS)-def test_gate_stays_closed_when_the_flag_is_off_despite_full_scopes(workspace_integration, gate, required, extra_args):- _grant(workspace_integration, required)-- with patch("posthoganalytics.feature_enabled", return_value=False):- assert gate(workspace_integration, *extra_args) is False+ assert gate(workspace_integration) is Falsediff --git a/products/slack_app/backend/tests/test_posthog_code_event_handler.py b/products/slack_app/backend/tests/test_posthog_code_event_handler.pyindex 6f87d33a60d7..9b189a80cbea 100644--- a/products/slack_app/backend/tests/test_posthog_code_event_handler.py+++ b/products/slack_app/backend/tests/test_posthog_code_event_handler.py@@ -1464,7 +1464,7 @@ class TestAssistantEvents(TestCase):with override_settings(DEBUG=False):return route_posthog_code_event_to_relevant_region(request, event, "T12345")- def _patch_resolution(self, *, user, enabled=True):+ def _patch_resolution(self, *, user):from products.slack_app.backend.services.integration_resolver import (ResolutionResult,UserAndIntegrationsResolution,@@ -1484,15 +1484,13 @@ class TestAssistantEvents(TestCase):else UserAndIntegrationsResolution(failure_reason="user_not_found"))resolve = patch("products.slack_app.backend.api.resolve_user_for_workspace", return_value=resolution)- # The route's kill-switch is the flag alone — missing scopes get a reply, not silence.- enabled_p = patch("products.slack_app.backend.api.is_slack_app_assistant_flag_enabled", return_value=enabled)usp = patch("products.slack_app.backend.api._us_should_handle_instead", return_value=False)slack = patch("products.slack_app.backend.api.SlackIntegration")- return load, resolve, enabled_p, usp, slack+ return load, resolve, usp, slackdef test_assistant_thread_started_sets_prompts_for_member(self):- load, resolve, enabled_p, usp, slack = self._patch_resolution(user=self.user)- with load, resolve, enabled_p, usp, slack as slack_cls:+ load, resolve, usp, slack = self._patch_resolution(user=self.user)+ with load, resolve, usp, slack as slack_cls:slack_cls.return_value.missing_scopes.return_value = set()self._route({@@ -1503,8 +1501,8 @@ class TestAssistantEvents(TestCase):slack_cls.return_value.client.assistant_threads_setSuggestedPrompts.assert_called_once()def test_assistant_thread_started_noop_for_non_member(self):- load, resolve, enabled_p, usp, slack = self._patch_resolution(user=None)- with load, resolve, enabled_p, usp, slack as slack_cls:+ load, resolve, usp, slack = self._patch_resolution(user=None)+ with load, resolve, usp, slack as slack_cls:self._route({"type": "assistant_thread_started",@@ -1516,8 +1514,8 @@ class TestAssistantEvents(TestCase):def test_context_changed_caches_viewed_channel(self):from products.slack_app.backend.api import _get_assistant_channel_context- load, resolve, enabled_p, usp, slack = self._patch_resolution(user=self.user)- with load, resolve, enabled_p, usp, slack:+ load, resolve, usp, slack = self._patch_resolution(user=self.user)+ with load, resolve, usp, slack:self._route({"type": "assistant_thread_context_changed",@@ -1532,9 +1530,9 @@ class TestAssistantEvents(TestCase):assert _get_assistant_channel_context(self.integration.id, "D001", "111.222") == "C999"def test_dm_message_starts_agent(self):- load, resolve, enabled_p, usp, slack = self._patch_resolution(user=self.user)+ load, resolve, usp, slack = self._patch_resolution(user=self.user)start = patch("products.slack_app.backend.api._start_mention_workflow", return_value="handled_locally")- with load, resolve, enabled_p, usp, slack as slack_cls, start as mock_start:+ with load, resolve, usp, slack as slack_cls, start as mock_start:slack_cls.return_value.missing_scopes.return_value = set()self._route({@@ -1560,25 +1558,6 @@ class TestAssistantEvents(TestCase):)mock_start.assert_not_called()- def test_dm_message_flag_off_is_dark(self):- # Kill-switch: flag off -> no user resolution, no agent start, and no reply at all.- load, resolve, enabled_p, usp, slack = self._patch_resolution(user=self.user, enabled=False)- start = patch("products.slack_app.backend.api._start_mention_workflow", return_value="handled_locally")- with load, resolve as mock_resolve, enabled_p, usp, slack as slack_cls, start as mock_start:- self._route(- {- "type": "message",- "channel_type": "im",- "channel": "D001",- "user": "U123",- "text": "fix it",- "ts": "1.2",- }- )- mock_resolve.assert_not_called()- mock_start.assert_not_called()- slack_cls.return_value.client.chat_postMessage.assert_not_called()-class TestAssistantInstallWelcome(TestCase):def setUp(self):diff --git a/products/slack_app/backend/tests/test_slack_thread.py b/products/slack_app/backend/tests/test_slack_thread.pyindex 3861eaf0132f..f7e5aad210f2 100644--- a/products/slack_app/backend/tests/test_slack_thread.py+++ b/products/slack_app/backend/tests/test_slack_thread.py@@ -372,8 +372,6 @@ class TestReplyFooterGate(SimpleTestCase):return SlackThreadHandler(context, footer or RunFooter(model="claude-opus-5"))@parameterized.expand([("withheld", False), ("granted", True)])- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=True)- @patch("products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled", return_value=True)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")def test_withholding_the_links_still_leaves_the_model_and_configure(@@ -382,8 +380,6 @@ class TestReplyFooterGate(SimpleTestCase):code_access: bool,mock_get_client,mock_get_integration,- _mock_flag,- _mock_home,) -> None:# Whether this reader can open a task page changes which segments render, never# whether the line appears: the model and the way to change it are theirs either way.@@ -405,44 +401,25 @@ class TestReplyFooterGate(SimpleTestCase):assert ("View on web" in line) is code_accessassert ("View on desktop" in line) is code_access- @parameterized.expand([("off", False, False), ("on", True, True)])- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=False)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")- def test_streamed_reply_carries_the_footer_only_inside_the_rollout(- self,- _name: str,- flag_enabled: bool,- expected: bool,- mock_get_client,- mock_get_integration,- _mock_home_enabled,- ) -> None:- # Losing this gate would put the footer under every workspace's replies at once.+ def test_streamed_reply_carries_the_footer(self, mock_get_client, mock_get_integration) -> None:mock_client = MagicMock()mock_get_client.return_value = mock_clientmock_get_integration.return_value = Integration(config={}, integration_id="T1")- with patch(- "products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled",- return_value=flag_enabled,- ):- self._handler().stop_status_stream(ts="1.0", final_markdown="Done.")+ self._handler().stop_status_stream(ts="1.0", final_markdown="Done.")chunks = mock_client.chat_appendStream.call_args.kwargs["chunks"]# The footer rides as a `blocks` chunk: a `context` block is the only muted text,# and Slack's streamed markdown_text has no equivalent.- assert any(chunk.get("type") == "blocks" for chunk in chunks) is expected+ assert any(chunk.get("type") == "blocks" for chunk in chunks)class TestFooterNeverCostsTheAnswer(SimpleTestCase):- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=False)- @patch("products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled", return_value=True)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")- def test_a_rejected_footer_reposts_the_answer_as_plain_text(- self, mock_get_client, mock_get_integration, _mock_flag, _mock_home- ) -> None:+ def test_a_rejected_footer_reposts_the_answer_as_plain_text(self, mock_get_client, mock_get_integration) -> None:# Slack fails the whole request when blocks are invalid — the text fallback does# not rescue it — so without this the reader loses the answer, not just its footer.mock_client = MagicMock()@@ -476,8 +453,6 @@ class TestRelayedAnswerFooter(SimpleTestCase):("earlier_chunk", RunFooter(model="claude-opus-5"), False, False),])- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=False)- @patch("products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled", return_value=True)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")def test_footer_rides_the_last_chunk_only(@@ -488,8 +463,6 @@ class TestRelayedAnswerFooter(SimpleTestCase):expected: bool,mock_get_client,mock_get_integration,- _mock_flag,- _mock_home,) -> None:# A non-streamed answer is split only to fit Slack's length cap, so a footer on# any chunk but the last would appear mid-answer.@@ -574,12 +547,10 @@ class TestForkMenuOnReplies(SimpleTestCase):return SlackThreadHandler(context, RunFooter(model="claude-opus-5"))@patch("products.slack_app.backend.slack_thread.is_slack_app_forking_enabled", return_value=True)- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=True)- @patch("products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled", return_value=True)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")def test_non_streamed_answer_hangs_the_menu_off_the_answer_not_the_footer(- self, mock_get_client, mock_get_integration, _flag, _home, _forking+ self, mock_get_client, mock_get_integration, _forking) -> None:# Hanging it off the answer's section buys both things the footer alone cannot# give: no extra line, and a footer that stays muted. A context block rejects@@ -599,12 +570,10 @@ class TestForkMenuOnReplies(SimpleTestCase):assert blocks[1]["type"] == "context"@patch("products.slack_app.backend.slack_thread.is_slack_app_forking_enabled", return_value=False)- @patch("products.slack_app.backend.slack_thread.is_slack_app_home_enabled", return_value=True)- @patch("products.slack_app.backend.slack_thread.is_slack_app_model_classifier_enabled", return_value=True)@patch.object(SlackThreadHandler, "_get_integration")@patch.object(SlackThreadHandler, "_get_client")def test_outside_the_rollout_the_footer_closes_the_message(- self, mock_get_client, mock_get_integration, _flag, _home, _forking+ self, mock_get_client, mock_get_integration, _forking) -> None:mock_client = MagicMock()mock_get_client.return_value = mock_clientdiff --git a/products/slack_app/backend/tests/test_thread_message_routing.py b/products/slack_app/backend/tests/test_thread_message_routing.pyindex 958913beef6e..5edba5aa89bf 100644--- a/products/slack_app/backend/tests/test_thread_message_routing.py+++ b/products/slack_app/backend/tests/test_thread_message_routing.py@@ -105,15 +105,6 @@ class TestRouteThreadMessage(TestCase):untagged_followup_mode=UntaggedFollowupMode.AUTO,)- # All routing tests assume the per-org feature flag is on. The- # dedicated ``test_feature_flag_off_dropped`` test stops the patcher- # to exercise the off path.- self._ff_patcher = patch(- "products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=True- )- self._ff_patcher.start()- self.addCleanup(self._ff_patcher.stop)-# --- Helpers -----------------------------------------------------------def _make_event(self, **overrides) -> dict:@@ -293,22 +284,6 @@ class TestRouteThreadMessage(TestCase):mock_resolve.assert_not_called()mock_start.assert_not_called()- def test_feature_flag_off_dropped(self):- """Off-by-default workspaces pay one DB query and nothing else."""- from products.slack_app.backend.api import ROUTE_HANDLED_LOCALLY-- self._ff_patcher.stop()- with (- patch("products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=False),- patch("products.slack_app.backend.api.resolve_user_for_workspace") as mock_resolve,- patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,- ):- result = self._route(self._make_event())- self._ff_patcher.start()- assert result == ROUTE_HANDLED_LOCALLY- mock_resolve.assert_not_called()- mock_start.assert_not_called()-# --- Cross-org access gate -------------------------------------------def test_user_without_access_to_mapping_team_dropped_silently(self):diff --git a/products/slack_app/backend/tests/test_untagged_followup_interactivity.py b/products/slack_app/backend/tests/test_untagged_followup_interactivity.pyindex a2fd653be78f..5ae72a52981d 100644--- a/products/slack_app/backend/tests/test_untagged_followup_interactivity.py+++ b/products/slack_app/backend/tests/test_untagged_followup_interactivity.py@@ -107,12 +107,6 @@ class TestUntaggedFollowupInteractivity(TestCase):timeout=900,)- self._ff_patcher = patch(- "products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=True- )- self._ff_patcher.start()- self.addCleanup(self._ff_patcher.stop)-def _click(self, action_id: str, slack_user_id: str) -> Any:payload = {"type": "block_actions",@@ -187,21 +181,6 @@ class TestUntaggedFollowupInteractivity(TestCase):assert response.status_code == 200mock_start.assert_not_called()- def test_flag_turned_off_between_prompt_and_click_dispatches_nothing(self, mock_slack_cls, mock_post):- mock_slack_cls.slack_config.return_value = {"SLACK_APP_SIGNING_SECRET": self.signing_secret}- self._ff_patcher.stop()-- with (- patch("products.slack_app.backend.api.is_slack_app_untagged_thread_followups_enabled", return_value=False),- self._stub_slack_user_email(self.member_user.email),- patch("products.slack_app.backend.api._start_mention_workflow") as mock_start,- ):- response = self._click(UNTAGGED_FOLLOWUP_ACTION_RUN, "U_BOB")-- self._ff_patcher.start()- assert response.status_code == 200- mock_start.assert_not_called()-def test_confirmation_after_the_creator_switched_to_never_dispatches_nothing(self, mock_slack_cls, mock_post):# The confirmed run skips the mode activity, so the click is the last place# that can honour a mode changed while the prompt sat unanswered.diff --git a/products/slack_app/backend/views/slack_user_link.py b/products/slack_app/backend/views/slack_user_link.pyindex d0fa25a7deb9..6149a497121b 100644--- a/products/slack_app/backend/views/slack_user_link.py+++ b/products/slack_app/backend/views/slack_user_link.py@@ -22,9 +22,9 @@ install routes the SPA owns.the browser tab back to Personal integrations with a success query param —matching how the GitHub link flow finishes.-The whole feature is gated by ``slack-app-oauth``; with the flag off both-views redirect to the settings page with ``?slack_link_error=flag_off`` so-the user sees a clear toast instead of a 404.+The whole feature requires the workspace install to hold the identity scopes;+without them both views redirect to the settings page with+``?slack_link_error=flag_off`` so the user sees a clear toast instead of a 404."""from typing import Any, cast@@ -104,7 +104,7 @@ def slack_user_link_authorize(request: HttpRequest) -> HttpResponse:if workspace_integration is None:return _settings_redirect(error="workspace_not_found")- if not is_slack_app_oauth_enabled(workspace_integration, invite.slack_team_id):+ if not is_slack_app_oauth_enabled(workspace_integration):return _settings_redirect(error="flag_off")callback_state = CallbackState(@@ -153,7 +153,7 @@ def slack_user_link_callback(request: HttpRequest) -> HttpResponse:workspace_integration = _load_workspace_integration(state.posthog_team_id, state.slack_team_id)if workspace_integration is None:return _settings_redirect(error="workspace_not_found")- if not is_slack_app_oauth_enabled(workspace_integration, state.slack_team_id):+ if not is_slack_app_oauth_enabled(workspace_integration):return _settings_redirect(error="flag_off")try:diff --git a/products/tasks/backend/logic/services/comment_slack_dm.py b/products/tasks/backend/logic/services/comment_slack_dm.pyindex 13d0b7454da6..1cfa6f170f85 100644--- a/products/tasks/backend/logic/services/comment_slack_dm.py+++ b/products/tasks/backend/logic/services/comment_slack_dm.py@@ -142,7 +142,7 @@ def send_comment_slack_dms(*, team_id: int, comment_id: UUID, task_id: UUID, rec)slack_user_id: str | None = Noneif integration is not None:- if not settings.DEBUG and not is_slack_app_oauth_enabled(integration, integration.integration_id):+ if not settings.DEBUG and not is_slack_app_oauth_enabled(integration):_skip(comment_id, "slack_app_oauth_disabled", user_id=user_id)continueslack = slack_for(integration)@@ -152,7 +152,7 @@ def send_comment_slack_dms(*, team_id: int, comment_id: UUID, task_id: UUID, recemail_destination_slack: SlackIntegration | None = Noneambiguous_email_destination = Falsefor candidate in integrations:- if not settings.DEBUG and not is_slack_app_oauth_enabled(candidate, candidate.integration_id):+ if not settings.DEBUG and not is_slack_app_oauth_enabled(candidate):continuecandidate_slack = slack_for(candidate)candidate_user_id = _slack_user_id_by_email(diff --git a/products/tasks/backend/logic/services/living_artifacts.py b/products/tasks/backend/logic/services/living_artifacts.pyindex 2a488e90b98c..aa5bf3887bbe 100644--- a/products/tasks/backend/logic/services/living_artifacts.py+++ b/products/tasks/backend/logic/services/living_artifacts.py@@ -34,9 +34,9 @@ from products.tasks.backend.models import TaskArtifact, TaskRunlogger = structlog.get_logger(__name__)-# Both scopes are approved (see posthog/helpers/slack_scopes.py), so the canvas and file adapters-# stay behind the slack-app-canvas-file-artifacts flag: scope checks alone would turn the feature-# on for every install that has them, with no rollout control.+# Both scopes are approved but recent (see posthog/helpers/slack_scopes.py), so an install+# authorized earlier lacks them until it reconnects — the adapters check them at point of use+# and can name the one to grant.SLACK_CANVAS_SCOPE = "canvases:write"SLACK_FILE_SCOPE = "files:write"LIVING_ARTIFACT_TTL_DAYS = "30"@@ -111,7 +111,6 @@ def create_living_artifact(metadata: dict[str, Any] | None = None,export_asset_id: int | None = None,) -> TaskArtifact:- _require_living_artifacts_enabled(run)content_payload = resolve_artifact_content(run=run,name=name,@@ -179,7 +178,6 @@ def edit_living_artifact(# must resolve Slack mappings (repointed to the latest run) and storage paths as itself,# not as the run that originally created the artifact.run = run or artifact.task_run- _require_living_artifacts_enabled(run)selected_adapter = _adapter_for_existing_artifact(artifact)next_version = int(artifact.current_version or 0) + 1next_name = name or artifact.name@@ -653,11 +651,6 @@ class SlackCanvasArtifactAdapter(LivingArtifactAdapter):export_asset_id: int | None = None,) -> ArtifactCommit:mapping = _get_slack_mapping(run)- if not _canvas_file_artifacts_enabled(mapping):- raise ValueError(- "Slack canvas delivery is not enabled for this workspace: you do not have this capability. "- "Use adapter=slack_message and deliver the content as text instead."- )slack_integration = _slack_integration_for_mapping(mapping)missing_scopes = slack_integration.missing_scopes(frozenset({SLACK_CANVAS_SCOPE}))if missing_scopes:@@ -778,11 +771,6 @@ class SlackFileArtifactAdapter(LivingArtifactAdapter):export_asset_id: int | None = None,) -> ArtifactCommit:mapping = _get_slack_mapping(run)- if not _canvas_file_artifacts_enabled(mapping):- raise ValueError(- "Slack file delivery is not enabled for this workspace: you do not have this capability. "- "Use adapter=slack_message and summarize the result as text instead."- )slack_integration = _slack_integration_for_mapping(mapping)resolved_content_type = content_type or _guess_content_type(name)# Chart images deliver as image blocks referencing a PostHog-hosted url, which needs no@@ -837,9 +825,6 @@ class SlackFileArtifactAdapter(LivingArtifactAdapter):# file artifact leaves the pending version on that artifact, and this run's end-of-turn# delivery must pick it up.def has_pending_slack_file_artifacts(run: TaskRun) -> bool:- if not _living_artifacts_enabled_for_run(run):- return False-artifacts = TaskArtifact.objects.for_team(run.team_id).filter(task_id=run.task_id,adapter=TaskArtifact.Adapter.SLACK_FILE,@@ -888,14 +873,6 @@ def deliver_pending_slack_file_artifacts(if mapping is None:return result- if not _living_artifacts_enabled_for_mapping(mapping):- logger.warning("task_artifact.slack_living_artifacts_disabled", task_run_id=str(run.id))- return result-- if not _canvas_file_artifacts_enabled(mapping):- logger.warning("task_artifact.slack_file_delivery_disabled", task_run_id=str(run.id))- return result-slack_integration = _slack_integration_for_mapping(mapping)# Nobody is waiting on charts or file shares for a prompt that has been deleted.# Leave the artifacts pending rather than delivering them into the thread.@@ -1486,31 +1463,6 @@ def _get_slack_mapping(run: TaskRun, *, raise_if_missing: bool = True):return mapping-def _living_artifacts_enabled_for_run(run: TaskRun) -> bool:- mapping = _get_slack_mapping(run, raise_if_missing=False)- return mapping is None or _living_artifacts_enabled_for_mapping(mapping)---def _living_artifacts_enabled_for_mapping(mapping: Any) -> bool:- from products.slack_app.backend.feature_flags import is_slack_app_living_artifacts_enabled # noqa: PLC0415-- return is_slack_app_living_artifacts_enabled(mapping.integration)---def _require_living_artifacts_enabled(run: TaskRun) -> None:- if not _living_artifacts_enabled_for_run(run):- raise ValueError(- "Living artifacts are not enabled for this Slack workspace: you cannot create or deliver "- "artifacts on this run. Deliver results as plain text in your reply instead."- )---def _canvas_file_artifacts_enabled(mapping: Any) -> bool:- from products.slack_app.backend.feature_flags import is_slack_app_canvas_file_artifacts_enabled # noqa: PLC0415-- return is_slack_app_canvas_file_artifacts_enabled(mapping.integration)--def _slack_client_for_mapping(mapping: Any):return _slack_integration_for_mapping(mapping).clientdiff --git a/products/tasks/backend/logic/services/tests/test_living_artifacts.py b/products/tasks/backend/logic/services/tests/test_living_artifacts.pyindex b27a8d328c39..758e2b112f07 100644--- a/products/tasks/backend/logic/services/tests/test_living_artifacts.py+++ b/products/tasks/backend/logic/services/tests/test_living_artifacts.py@@ -27,7 +27,6 @@ from products.tasks.backend.logic.services.living_artifacts import (_section_blocks,_SlackImageCard,create_living_artifact,- deliver_pending_slack_file_artifacts,edit_living_artifact,get_task_artifact_for_run,get_task_artifacts_for_run,@@ -93,14 +92,6 @@ class TestLivingArtifacts(TestCase):task: ClassVar[Task]task_run: ClassVar[TaskRun]- def setUp(self) -> None:- artifacts_flag = patch(- "products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled",- return_value=True,- )- artifacts_flag.start()- self.addCleanup(artifacts_flag.stop)-@classmethoddef setUpTestData(cls):cls.organization = Organization.objects.create(name="Test Org")@@ -153,9 +144,8 @@ class TestLivingArtifacts(TestCase):self.assertEqual(updated.versions[-1]["content"], "# Updated report")self.assertEqual(updated.location["document_id"], artifact.location["document_id"])- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_mapped_slack_document_defaults_to_canvas_external_pointer(self, mock_integration_for_mapping, _mock_flag):+ def test_mapped_slack_document_defaults_to_canvas_external_pointer(self, mock_integration_for_mapping):integration = Integration.objects.create(team=self.team,kind="slack",@@ -209,9 +199,8 @@ class TestLivingArtifacts(TestCase):)slack_integration.missing_scopes.assert_called()- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_follow_up_run_sees_and_edits_prior_run_artifacts(self, mock_integration_for_mapping, _mock_flag):+ def test_follow_up_run_sees_and_edits_prior_run_artifacts(self, mock_integration_for_mapping):integration = Integration.objects.create(team=self.team,kind="slack",@@ -262,9 +251,8 @@ class TestLivingArtifacts(TestCase):self.assertEqual(updated.current_version, 2)self.assertEqual(slack.api_call.call_args_list[-1].args[0], "canvases.edit")- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_slack_canvas_adapter_requires_canvas_scope(self, mock_integration_for_mapping, _mock_flag):+ def test_slack_canvas_adapter_requires_canvas_scope(self, mock_integration_for_mapping):integration = Integration.objects.create(team=self.team, kind="slack", integration_id="T123", config={})SlackThreadTaskMapping.objects.create(team=self.team,@@ -288,12 +276,14 @@ class TestLivingArtifacts(TestCase):content="# Report",)- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("posthog.storage.object_storage.tag")@patch("posthog.storage.object_storage.write")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")def test_slack_file_adapter_stores_binary_versions_until_relay(- self, mock_integration_for_mapping, mock_write, mock_tag, _mock_flag+ self,+ mock_integration_for_mapping,+ mock_write,+ mock_tag,):integration = Integration.objects.create(team=self.team,@@ -348,12 +338,14 @@ class TestLivingArtifacts(TestCase):slack.api_call.assert_not_called()slack_integration.missing_scopes.assert_called_with(frozenset({"files:write"}))- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("posthog.storage.object_storage.tag")@patch("posthog.storage.object_storage.write")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")def test_slack_file_adapter_presents_xlsx_payload_with_xlsx_filename(- self, mock_integration_for_mapping, mock_write, _mock_tag, _mock_flag+ self,+ mock_integration_for_mapping,+ mock_write,+ _mock_tag,):integration = Integration.objects.create(team=self.team,@@ -401,13 +393,16 @@ class TestLivingArtifacts(TestCase):self.assertEqual(mock_write.call_args.args[2]["ContentType"], artifact.location["content_type"])slack.api_call.assert_not_called()- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("posthog.storage.object_storage.tag")@patch("posthog.storage.object_storage.write")@patch("posthog.storage.object_storage.read_bytes")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")def test_slack_file_adapter_stores_source_artifact_until_relay(- self, mock_integration_for_mapping, mock_read_bytes, mock_write, _mock_tag, _mock_flag+ self,+ mock_integration_for_mapping,+ mock_read_bytes,+ mock_write,+ _mock_tag,):workbook_bytes = _xlsx_bytes()mock_read_bytes.return_value = workbook_bytes@@ -510,9 +505,8 @@ class TestLivingArtifacts(TestCase):self.assertFalse(TaskArtifact.objects.for_team(self.team.id).exists())- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_slack_file_adapter_requires_file_scope(self, mock_integration_for_mapping, _mock_flag):+ def test_slack_file_adapter_requires_file_scope(self, mock_integration_for_mapping):integration = Integration.objects.create(team=self.team, kind="slack", integration_id="T123", config={})SlackThreadTaskMapping.objects.create(team=self.team,@@ -555,10 +549,10 @@ class TestLivingArtifacts(TestCase):mock_integration_for_mapping.return_value = slack_integration@override_settings(SITE_URL="http://localhost:8010")- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")def test_slack_file_adapter_allows_chart_images_with_own_export_without_file_scope(- self, mock_integration_for_mapping, _mock_flag+ self,+ mock_integration_for_mapping,):# Chart images deliver as image blocks pointing at a PostHog-hosted url — no upload,# no files:write.@@ -599,10 +593,12 @@ class TestLivingArtifacts(TestCase):("export_asset_that_is_not_an_image", lambda self: self._non_image_asset_id()),])- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")def test_slack_file_adapter_rejects_images_without_a_resolvable_export(- self, _name, asset_id_factory, mock_integration_for_mapping, _mock_flag+ self,+ _name,+ asset_id_factory,+ mock_integration_for_mapping,):self._create_scopeless_mapping(mock_integration_for_mapping)@@ -639,62 +635,8 @@ class TestLivingArtifacts(TestCase):mentioning_slack_user_id="U123",)- @patch(- "products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled",- return_value=False,- )@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_slack_living_artifact_creation_rejected_when_flag_off(- self, mock_integration_for_mapping, _mock_flag- ) -> None:- self._create_mapping_with_full_scopes()-- with self.assertRaisesRegex(ValueError, "Living artifacts are not enabled"):- create_living_artifact(- run=self.task_run,- name="Summary",- artifact_type=TaskArtifact.ArtifactType.SLACK_MESSAGE,- content="Result",- )-- mock_integration_for_mapping.assert_not_called()- self.assertFalse(TaskArtifact.objects.for_team(self.team.id).exists())-- @parameterized.expand(- [- (- "canvas",- {"artifact_type": TaskArtifact.ArtifactType.SLACK_CANVAS, "content": "# Report"},- "Slack canvas delivery is not enabled",- ),- (- "file",- {- "artifact_type": TaskArtifact.ArtifactType.SPREADSHEET,- "adapter": TaskArtifact.Adapter.SLACK_FILE,- "content_bytes": b"col_a,col_b",- "content_type": "text/csv",- },- "Slack file delivery is not enabled",- ),- ]- )- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=False)- @patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_canvas_and_file_adapters_reject_when_flag_off(- self, _name, create_kwargs, expected_error, mock_integration_for_mapping, _mock_flag- ):- self._create_mapping_with_full_scopes()-- with self.assertRaisesRegex(ValueError, expected_error):- create_living_artifact(run=self.task_run, name="report", **create_kwargs)-- mock_integration_for_mapping.assert_not_called()- self.assertFalse(TaskArtifact.objects.for_team(self.team.id).exists())-- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)- @patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_caller_metadata_cannot_link_an_export_asset(self, mock_integration_for_mapping, _mock_flag):+ def test_caller_metadata_cannot_link_an_export_asset(self, mock_integration_for_mapping):# Anyone with task:write can pass metadata here, and the export link is what lets# delivery mint an anonymous url for someone else's export. It lives in its own# column, which caller metadata must never populate.@@ -723,9 +665,8 @@ class TestLivingArtifacts(TestCase):)self.assertIsNone(updated.export_asset_id)- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_editing_a_chart_drops_its_export_link(self, mock_integration_for_mapping, _mock_flag):+ def test_editing_a_chart_drops_its_export_link(self, mock_integration_for_mapping):# The export depicts the version it was rendered from, so a new version must not# deliver the old picture.self._create_mapping_with_full_scopes()@@ -746,38 +687,6 @@ class TestLivingArtifacts(TestCase):self.assertIsNone(updated.export_asset_id)- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=False)- @patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_pending_file_delivery_skipped_when_flag_off(self, mock_integration_for_mapping, _mock_flag):- self._create_mapping_with_full_scopes()- storage_path = f"{self.task_run.get_artifact_s3_prefix()}/living/abc/report.v1.csv"- artifact = TaskArtifact.objects.for_team(self.team.id).create(- team=self.team,- task=self.task,- task_run=self.task_run,- name="report.csv",- artifact_type=TaskArtifact.ArtifactType.SPREADSHEET,- adapter=TaskArtifact.Adapter.SLACK_FILE,- status=TaskArtifact.Status.ACTIVE,- location={"kind": "slack_file", "storage_path": storage_path, "delivery_status": "pending"},- versions=[- {- "version": 1,- "delivery_status": "pending",- "location": {"storage_path": storage_path},- }- ],- current_version=1,- )-- delivery = deliver_pending_slack_file_artifacts(self.task_run)-- self.assertFalse(delivery.answer_posted)- self.assertEqual(delivery.delivered_count, 0)- mock_integration_for_mapping.assert_not_called()- artifact.refresh_from_db()- self.assertEqual(artifact.versions[0]["delivery_status"], "pending")-@override_settings(SITE_URL="http://localhost:8010")class TestChartCardBlockBuilders(SimpleTestCase):diff --git a/products/tasks/backend/temporal/process_task/activities/slack_agent_design.py b/products/tasks/backend/temporal/process_task/activities/slack_agent_design.pyindex 2896a9277e00..7546a1a09098 100644--- a/products/tasks/backend/temporal/process_task/activities/slack_agent_design.py+++ b/products/tasks/backend/temporal/process_task/activities/slack_agent_design.py@@ -125,10 +125,7 @@ def stop_slack_agent_design_stream(input: StopSlackAgentDesignStreamInput) -> Notry:context = SlackThreadContext.from_dict(input.slack_thread_context)handler = SlackThreadHandler(context)- # Describing the run costs a query and a flag call, so only do it for a- # workspace that will actually be shown the result.- if handler.footer_enabled():- handler.run_footer = load_run_footer(input.run_id)+ handler.run_footer = load_run_footer(input.run_id)handler.stop_status_stream(ts=input.ts,complete_task_id=input.complete_task_id,diff --git a/products/tasks/backend/temporal/process_task/tests/test_slack_agent_design.py b/products/tasks/backend/temporal/process_task/tests/test_slack_agent_design.pyindex dfbc385b00cc..73033280b74e 100644--- a/products/tasks/backend/temporal/process_task/tests/test_slack_agent_design.py+++ b/products/tasks/backend/temporal/process_task/tests/test_slack_agent_design.py@@ -26,9 +26,8 @@ class TestSlackAgentDesignStream(TestCase):cls.team = Team.objects.create(organization=cls.org, name="TestTeam")cls.integration = Integration.objects.create(team=cls.team, kind="slack", integration_id="T123", config={})- @patch("products.slack_app.backend.slack_thread.SlackThreadHandler.footer_enabled", return_value=False)@patch("products.slack_app.backend.slack_thread.SlackThreadHandler.stop_status_stream")- def test_streamed_final_answer_has_object_tags_rewritten(self, mock_stop, _mock_footer) -> None:+ def test_streamed_final_answer_has_object_tags_rewritten(self, mock_stop) -> None:stop_slack_agent_design_stream(StopSlackAgentDesignStreamInput(slack_thread_context={"integration_id": self.integration.id, "channel": "C1", "thread_ts": "1.0"},diff --git a/products/tasks/backend/temporal/slack_relay/activities.py b/products/tasks/backend/temporal/slack_relay/activities.pyindex e119ec265f2e..9266a70129e3 100644--- a/products/tasks/backend/temporal/slack_relay/activities.py+++ b/products/tasks/backend/temporal/slack_relay/activities.py@@ -449,8 +449,7 @@ def relay_slack_message(input: RelaySlackMessageInput) -> None:)handler = SlackThreadHandler(context, actor_slack_user_id=target)- if handler.footer_enabled():- handler.run_footer = load_run_footer(task_run.id)+ handler.run_footer = load_run_footer(task_run.id)mention_prefix = f"<@{target}> " if target else ""def _record_sent_relay(state: dict[str, Any]) -> None:diff --git a/products/tasks/backend/temporal/slack_relay/tests/test_activities.py b/products/tasks/backend/temporal/slack_relay/tests/test_activities.pyindex 0ff55a001908..ed17693dc63b 100644--- a/products/tasks/backend/temporal/slack_relay/tests/test_activities.py+++ b/products/tasks/backend/temporal/slack_relay/tests/test_activities.py@@ -221,17 +221,10 @@ class TestRelaySlackMessage(TestCase):assert "user_activity_report.pdf" in postedassert "no file was attached to Slack for this run" in posted- @patch("products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled", return_value=True)@patch("products.slack_app.backend.slack_thread.SlackThreadHandler.update_reaction")@patch("products.slack_app.backend.slack_thread.SlackThreadHandler.post_thread_message")@patch("products.slack_app.backend.slack_thread.SlackThreadHandler.delete_progress")- def test_run_manifest_artifacts_never_surface_in_slack(- self,- _mock_delete_progress,- mock_post,- _mock_update,- _mock_flag,- ):+ def test_run_manifest_artifacts_never_surface_in_slack(self, _mock_delete_progress, mock_post, _mock_update):# Run-manifest artifacts are internal (inputs, context, raw agent outputs).# Even with living artifacts enabled they must not leak into the posted text,# and their presence must not suppress the unconfirmed-attachment notice.@@ -315,11 +308,6 @@ class TestRelaySlackMessage(TestCase):mock_integration_for_mapping.return_value = slack_integrationreturn slack- @patch(- "products.tasks.backend.logic.services.living_artifacts._living_artifacts_enabled_for_mapping",- return_value=True,- )- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts.requests.post")@patch("products.tasks.backend.logic.services.living_artifacts.object_storage.read_bytes")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")@@ -334,8 +322,6 @@ class TestRelaySlackMessage(TestCase):mock_integration_for_mapping,mock_read_bytes,mock_requests_post,- _mock_canvas_file_flag,- _mock_living_artifacts_flag,):artifact, storage_path = self._create_pending_slack_file_artifact(name="report.xlsx",@@ -371,11 +357,6 @@ class TestRelaySlackMessage(TestCase):self.assertEqual(artifact.versions[0]["delivery_status"], "delivered")self.assertEqual(artifact.versions[0]["slack_file_id"], "F123")- @patch(- "products.tasks.backend.logic.services.living_artifacts._living_artifacts_enabled_for_mapping",- return_value=True,- )- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts.requests.post")@patch("products.tasks.backend.logic.services.living_artifacts.object_storage.read_bytes")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")@@ -396,8 +377,6 @@ class TestRelaySlackMessage(TestCase):mock_integration_for_mapping,mock_read_bytes,_mock_requests_post,- _mock_flag,- _mock_living_artifacts_flag,):# posthog_url must be SITE_URL-origin, or it is treated as untrusted caller metadata# and no button is added.@@ -467,11 +446,6 @@ class TestRelaySlackMessage(TestCase):self.assertNotIn("slack_file_id", artifact.versions[0])self.assertEqual(artifact.versions[0]["delivery_status"], "delivered")- @patch(- "products.tasks.backend.logic.services.living_artifacts._living_artifacts_enabled_for_mapping",- return_value=True,- )- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts.requests.post")@patch("products.tasks.backend.logic.services.living_artifacts.object_storage.read_bytes")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")@@ -487,8 +461,6 @@ class TestRelaySlackMessage(TestCase):mock_integration_for_mapping,mock_read_bytes,_mock_requests_post,- _mock_flag,- _mock_living_artifacts_flag,):artifact, _storage_path = self._create_pending_slack_file_artifact(name="Signups by week",@@ -524,11 +496,6 @@ class TestRelaySlackMessage(TestCase):self.assertEqual(artifact.versions[0]["delivery_status"], "delivered")self.assertEqual(artifact.versions[0]["slack_file_id"], "F123")- @patch(- "products.tasks.backend.logic.services.living_artifacts._living_artifacts_enabled_for_mapping",- return_value=True,- )- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts.requests.post")@patch("products.tasks.backend.logic.services.living_artifacts.object_storage.read_bytes")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")@@ -543,8 +510,6 @@ class TestRelaySlackMessage(TestCase):mock_integration_for_mapping,mock_read_bytes,_mock_requests_post,- _mock_flag,- _mock_living_artifacts_flag,):artifact, _storage_path = self._create_pending_slack_file_artifact(name="Signups by week",diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex f7cd41220c98..acf428a9efad 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -6643,12 +6643,8 @@ class TestTaskRunAPI(BaseTaskAPITest):self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)- @patch("products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled", return_value=True)- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_living_artifact_create_open_and_edit(- self, mock_integration_for_mapping, _mock_canvas_file_flag, _mock_living_artifacts_flag- ):+ def test_living_artifact_create_open_and_edit(self, mock_integration_for_mapping):task = self.create_task()run = TaskRun.objects.create(task=task, team=self.team, status=TaskRun.Status.IN_PROGRESS)integration = Integration.objects.create(@@ -6731,19 +6727,10 @@ class TestTaskRunAPI(BaseTaskAPITest):self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)self.assertIn("s3", json.dumps(response.json()))- @patch("products.slack_app.backend.feature_flags.is_slack_app_living_artifacts_enabled", return_value=True)- @patch("products.tasks.backend.logic.services.living_artifacts._canvas_file_artifacts_enabled", return_value=True)@patch("posthog.storage.object_storage.tag")@patch("posthog.storage.object_storage.write")@patch("products.tasks.backend.logic.services.living_artifacts._slack_integration_for_mapping")- def test_living_artifact_create_slack_file_from_base64(- self,- mock_integration_for_mapping,- mock_write,- _mock_tag,- _mock_canvas_file_flag,- _mock_living_artifacts_flag,- ):+ def test_living_artifact_create_slack_file_from_base64(self, mock_integration_for_mapping, mock_write, _mock_tag):task = self.create_task()run = TaskRun.objects.create(task=task, team=self.team, status=TaskRun.Status.IN_PROGRESS)integration = Integration.objects.create(