Skip to content

: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.

chore(slack-app): remove the slack-app-footer-cost feature flag (#130034)

Vojta Bartoš2a149caacdd0
diff --git a/products/slack_app/backend/feature_flags.py b/products/slack_app/backend/feature_flags.py
index 65d927e90f2f..2b3592dfb72b 100644
--- a/products/slack_app/backend/feature_flags.py
+++ b/products/slack_app/backend/feature_flags.py
@@ -49,7 +49,6 @@ logger = structlog.get_logger(__name__)
SLACK_APP_AGENT_DESIGN_FLAG = "slack-app-agent-design"
SLACK_APP_FORKING_FLAG = "slack-app-forking"
SLACK_APP_BYOS_FLAG = "slack-app-byos"
-SLACK_APP_FOOTER_COST_FLAG = "slack-app-footer-cost"
SLACK_APP_ONBOARDING_FLAG = "slack-app-onboarding"
@@ -156,16 +155,6 @@ def is_slack_app_byos_enabled(
)
-def is_slack_app_footer_cost_enabled(integration: IntegrationRecord, distinct_id: str | None) -> bool:
- """Gate for the thread cost in the footer under an answer, keyed on the run's PostHog user."""
- return _workspace_flag_enabled(
- SLACK_APP_FOOTER_COST_FLAG,
- integration,
- failure_log_key="slack_app_footer_cost_feature_flag_check_failed",
- distinct_id=distinct_id,
- )
-
-
def is_slack_app_assistant_enabled(integration: IntegrationRecord) -> bool:
"""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
diff --git a/products/slack_app/backend/services/slack_messages.py b/products/slack_app/backend/services/slack_messages.py
index 5c05a60d4c94..a53d399c977e 100644
--- a/products/slack_app/backend/services/slack_messages.py
+++ b/products/slack_app/backend/services/slack_messages.py
@@ -849,31 +849,25 @@ def load_run_footer(
plan=plan,
chart_links=bool((run.state or {}).get("slack_chart_links")),
# A run on someone's own plan is not paid with PostHog credits, so its cost says nothing.
- thread_cost_usd=_thread_cost(run, integration_id=integration_id)
- if include_thread_cost and plan is None
- else None,
+ thread_cost_usd=_thread_cost(run) if include_thread_cost and plan is None else None,
)
except Exception:
logger.exception("slack_app_run_footer_load_failed", run_id=str(run_id))
return RunFooter()
-def _thread_cost(run: "TaskRunDTO", *, integration_id: int | None) -> Decimal | None:
- """What the thread's task spent on models so far, or `None` outside the rollout or when unknown.
+def _thread_cost(run: "TaskRunDTO") -> Decimal | None:
+ """What the thread's task spent on models so far, or `None` when unknown.
Reads the same task usage that PostHog Desktop shows, which sums the task's `$ai_generation`
events. Those events arrive with a short delay and the usage is cached for a minute, so the
newest requests can be missing here. A later reply's total then includes them.
"""
- from products.slack_app.backend.feature_flags import is_slack_app_footer_cost_enabled # noqa: PLC0415
from products.tasks.backend.facade.billing import get_task_usage # noqa: PLC0415
- if integration_id is None or run.task_created_at is None:
+ if run.task_created_at is None:
return None
try:
- integration = IntegrationManager.slack.oauth.get(run.team_id, integration_id)
- if not is_slack_app_footer_cost_enabled(integration, run.created_by_distinct_id):
- return None
return get_task_usage(
team_id=run.team_id, task_id=run.task_id, task_created_at=run.task_created_at
).token_cost_usd