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.

feat(desktop): evaluate the desktop app's flags in the posthog-desktop context (#120134)

Paul D'Ambrab1029e6484c3
diff --git a/products/desktop/packages/shared/src/flags.test.ts b/products/desktop/packages/shared/src/flags.test.ts
index cb7152bb6027..58786e6ee1b2 100644
--- a/products/desktop/packages/shared/src/flags.test.ts
+++ b/products/desktop/packages/shared/src/flags.test.ts
@@ -1,6 +1,7 @@
import { BEDROCK_LLM_GATEWAY_FLAG } from "@posthog/agent-contracts/bedrock-gateway";
import { describe, expect, it } from "vitest";
import featureFlagKeys from "./feature-flag-keys.json" with { type: "json" };
+import { MODEL_ACCESS_FLAGS } from "./model-catalog";
describe("flags", () => {
it("keeps the Bedrock gateway flag literal in step with the flag registry", () => {
@@ -8,4 +9,11 @@ describe("flags", () => {
featureFlagKeys.BEDROCK_LLM_GATEWAY_FLAG,
);
});
+
+ it("lists every model rollout flag in the flag registry", () => {
+ const registered = new Set<string>(Object.values(featureFlagKeys));
+ expect(MODEL_ACCESS_FLAGS.filter((flag) => !registered.has(flag))).toEqual(
+ [],
+ );
+ });
});
diff --git a/products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts b/products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts
index d49bb58574a3..2c0269b43831 100644
--- a/products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts
+++ b/products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts
@@ -199,6 +199,10 @@ export function initializePostHog(sessionId?: string) {
defaults: "2026-05-30",
api_host: apiHost,
ui_host: uiHost,
+ // The flags this app reads are listed in feature-flag-keys.json. Each one must carry the
+ // posthog-desktop evaluation context in PostHog, because this filter hides a flag that is
+ // tagged only with other contexts. The JSON list does not set the context.
+ evaluation_contexts: ["posthog-desktop"],
metrics: {
serviceName: "posthog-desktop",
environment: import.meta.env.PROD ? "production" : "development",