: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(desktop): remove posthog-code-task-cost flag gate (#94097)
Adam Bowkere3897adbb600
diff --git a/products/desktop/packages/shared/src/flags.ts b/products/desktop/packages/shared/src/flags.tsindex ad7d445bef66..d5e138c594bc 100644--- a/products/desktop/packages/shared/src/flags.ts+++ b/products/desktop/packages/shared/src/flags.ts@@ -49,11 +49,9 @@ export const LOCAL_MCP_IMPORT_FLAG = "posthog-code-local-mcp-import";* Owned by the backend rollout in posthog/posthog — same flag key there.*/export const MCP_GATEWAY_FLAG = "mcp-gateway";-/** Per-task estimated cost readout in the context usage indicator. */-export const TASK_COST_FLAG = "posthog-code-task-cost";/*** Shows the task cost as text beside the context ring rather than only inside- * the popover. Requires TASK_COST_FLAG, which is what fetches the figure.+ * the popover.*/export const TASK_COST_VISIBLE_FLAG = "posthog-code-task-cost-visible";/**diff --git a/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.test.tsx b/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.test.tsxindex 8bec20ff19fb..2083a9063a11 100644--- a/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.test.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.test.tsx@@ -1,11 +1,10 @@-import { TASK_COST_VISIBLE_FLAG } from "@posthog/shared";import type { ContextUsage } from "@posthog/ui/features/sessions/hooks/useContextUsage";import { Theme } from "@radix-ui/themes";import { render, screen } from "@testing-library/react";import { beforeEach, describe, expect, it, vi } from "vitest";import { ContextUsageIndicator } from "./ContextUsageIndicator";-const flagState = vi.hoisted(() => ({ cost: false, costVisible: false }));+const flagState = vi.hoisted(() => ({ costVisible: false }));const taskUsageState = vi.hoisted(() => ({data: undefined as| {@@ -16,15 +15,13 @@ const taskUsageState = vi.hoisted(() => ({| undefined,}));vi.mock("@posthog/ui/features/feature-flags/useFeatureFlag", () => ({- useFeatureFlag: (key: string) =>- key === TASK_COST_VISIBLE_FLAG ? flagState.costVisible : flagState.cost,+ useFeatureFlag: () => flagState.costVisible,}));vi.mock("@posthog/ui/features/sessions/hooks/useTaskUsage", () => ({useTaskUsage: () => taskUsageState,}));function enableCost(costVisible = false) {- flagState.cost = true;flagState.costVisible = costVisible;taskUsageState.data = {token_cost_usd: 0.4,@@ -34,7 +31,6 @@ function enableCost(costVisible = false) {}beforeEach(() => {- flagState.cost = false;flagState.costVisible = false;taskUsageState.data = undefined;});diff --git a/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.tsx b/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.tsxindex 1e3f997880ba..da2dd3b115a6 100644--- a/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/ContextUsageIndicator.tsx@@ -5,7 +5,7 @@ import {PopoverTrigger,Text,} from "@posthog/quill";-import { TASK_COST_FLAG, TASK_COST_VISIBLE_FLAG } from "@posthog/shared";+import { TASK_COST_VISIBLE_FLAG } from "@posthog/shared";import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import {formatCostUsd,@@ -32,9 +32,8 @@ export function ContextUsageIndicator({taskId,focused = true,}: ContextUsageIndicatorProps) {- const costEnabled = useFeatureFlag(TASK_COST_FLAG) || import.meta.env.DEV;const costVisible = useFeatureFlag(TASK_COST_VISIBLE_FLAG);- const { data: taskUsage } = useTaskUsage(taskId, costEnabled && focused);+ const { data: taskUsage } = useTaskUsage(taskId, focused);if (!usage) return null;@@ -44,7 +43,7 @@ export function ContextUsageIndicator({const hasSize = size > 0;const strokeDashoffset = CIRCUMFERENCE - (percentage / 100) * CIRCUMFERENCE;const color = getOverallUsageColor(percentage);- const showCost = costEnabled && taskUsage !== undefined;+ const showCost = taskUsage !== undefined;const showCostText = showCost && costVisible;// The ring carries no text, so the token figures reach a reader only through// the accessible name. Cost joins them only while it has no text of its own,