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(desktop): remove the server sync flags for instructions and task defaults (#113978)

Shy Alter70e402397b5c
diff --git a/products/desktop/packages/shared/src/feature-flag-keys.json b/products/desktop/packages/shared/src/feature-flag-keys.json
index 02989a896e50..74d2f456118d 100644
--- a/products/desktop/packages/shared/src/feature-flag-keys.json
+++ b/products/desktop/packages/shared/src/feature-flag-keys.json
@@ -27,8 +27,6 @@
"PROJECT_BLUEBIRD_FLAG": "project-bluebird",
"SAVED_SEARCHES_RAIL_FLAG": "posthog-desktop-saved-searches-rail",
"SELF_DRIVING_SETUP_TASK_FLAG": "posthog-code-self-driving-setup-task",
- "SERVER_AGENT_INSTRUCTIONS_FLAG": "posthog-desktop-server-agent-instructions",
- "SERVER_TASK_DEFAULTS_FLAG": "posthog-desktop-server-task-defaults",
"SETTINGS_BACKUP_FLAG": "posthog-desktop-settings-backup",
"SIGNALS_PR_REFUNDS_FLAG": "signals-pr-refunds",
"SPACE_SETUP_FLAG": "code-space-setup",
diff --git a/products/desktop/packages/shared/src/flags.ts b/products/desktop/packages/shared/src/flags.ts
index a44b6c293a39..8dae8249ef09 100644
--- a/products/desktop/packages/shared/src/flags.ts
+++ b/products/desktop/packages/shared/src/flags.ts
@@ -98,9 +98,3 @@ export const CUSTOM_IMAGES_FEATURE_FLAG =
export const PI_HARNESS_FLAG = featureFlagKeys.PI_HARNESS_FLAG;
export const TWIG_CLOUD_MODE_FLAG = featureFlagKeys.TWIG_CLOUD_MODE_FLAG;
export const USER_SPEND_LIMIT_FLAG = featureFlagKeys.USER_SPEND_LIMIT_FLAG;
-/** Move local custom instructions to "My instructions" on the server, then stop adding them to cloud tasks. */
-export const SERVER_AGENT_INSTRUCTIONS_FLAG =
- featureFlagKeys.SERVER_AGENT_INSTRUCTIONS_FLAG;
-/** Move local task defaults to the server once, then keep "always create pull requests" in step with it. */
-export const SERVER_TASK_DEFAULTS_FLAG =
- featureFlagKeys.SERVER_TASK_DEFAULTS_FLAG;
diff --git a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.contribution.ts b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.contribution.ts
index 75184d746745..827cf19e9d0a 100644
--- a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.contribution.ts
+++ b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.contribution.ts
@@ -3,13 +3,8 @@ import {
HOST_TRPC_CLIENT,
type HostTrpcClient,
} from "@posthog/host-router/client";
-import { SERVER_AGENT_INSTRUCTIONS_FLAG } from "@posthog/shared";
import { createAuthenticatedClient } from "@posthog/ui/features/auth/authClient";
import { useAuthStore } from "@posthog/ui/features/auth/store";
-import {
- FEATURE_FLAGS,
- type FeatureFlags,
-} from "@posthog/ui/features/feature-flags/identifiers";
import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";
import { logger } from "@posthog/ui/shell/logger";
import { inject, injectable } from "inversify";
@@ -36,20 +31,16 @@ export class ServerAgentInstructionsContribution implements Contribution {
constructor(
@inject(HOST_TRPC_CLIENT)
private readonly hostClient: HostTrpcClient,
- @inject(FEATURE_FLAGS)
- private readonly flags: FeatureFlags,
) {}
start(): void {
const run = () => void this.reconcile();
- this.flags.onFlagsLoaded(run);
useSettingsStore.subscribe(run);
useAuthStore.subscribe(run);
run();
}
private async reconcile(): Promise<void> {
- if (!this.flags.isEnabled(SERVER_AGENT_INSTRUCTIONS_FLAG)) return;
const settings = useSettingsStore.getState();
const authState = useAuthStore.getState().authState;
const projectId = authState.currentProjectId;
diff --git a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.test.ts b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.test.ts
index 3cd3d57700d0..978f5a0e519d 100644
--- a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.test.ts
+++ b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.test.ts
@@ -63,19 +63,10 @@ describe("serverAgentInstructions", () => {
});
it.each([
- ["the flag is off", false, 7, { "7": "Use pnpm." }, "Use pnpm.", true],
- ["nothing was uploaded", true, 7, {}, "Use pnpm.", true],
- [
- "the AGENTS.md snapshot is loading",
- true,
- 7,
- { "7": "Use pnpm." },
- null,
- true,
- ],
+ ["nothing was uploaded", 7, {}, "Use pnpm.", true],
+ ["the AGENTS.md snapshot is loading", 7, { "7": "Use pnpm." }, null, true],
[
"a Desktop edit is not uploaded yet",
- true,
7,
{ "7": "Use pnpm." },
"Use npm.",
@@ -83,7 +74,6 @@ describe("serverAgentInstructions", () => {
],
[
"the server holds the current text",
- true,
7,
{ "7": "Use pnpm." },
"Use pnpm.",
@@ -91,10 +81,9 @@ describe("serverAgentInstructions", () => {
],
] as const)(
"carries the local copy when %s: %s",
- (_case, flagEnabled, projectId, onServer, local, expected) => {
+ (_case, projectId, onServer, local, expected) => {
expect(
cloudTaskCarriesLocalInstructions({
- flagEnabled,
projectId,
onServer,
local,
diff --git a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.ts b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.ts
index 08255cbbf6e7..2dde44a0707f 100644
--- a/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.ts
+++ b/products/desktop/packages/ui/src/features/settings/serverAgentInstructions.ts
@@ -65,13 +65,11 @@ export function nextServerInstructions(input: {
* A failed or pending upload keeps the local copy, so an edit is never lost.
*/
export function cloudTaskCarriesLocalInstructions(input: {
- flagEnabled: boolean;
projectId: number | null;
onServer: Readonly<Record<string, string>>;
local: string | null;
}): boolean {
return !(
- input.flagEnabled &&
input.projectId != null &&
input.local != null &&
input.onServer[String(input.projectId)] === input.local
diff --git a/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.test.ts b/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.test.ts
index 85c4e1ca60e2..86ac5d76e186 100644
--- a/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.test.ts
+++ b/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.test.ts
@@ -4,7 +4,6 @@ import {
ANONYMOUS_AUTH_STATE,
useAuthStore,
} from "@posthog/ui/features/auth/store";
-import type { FeatureFlags } from "@posthog/ui/features/feature-flags/identifiers";
import { registerRendererStateStorage } from "@posthog/ui/shell/rendererStorage";
import { describe, expect, it, vi } from "vitest";
import { ServerTaskDefaultsContribution } from "./serverTaskDefaults.contribution";
@@ -23,11 +22,6 @@ vi.mock("@posthog/ui/features/auth/authClient", () => ({
createAuthenticatedClient: () => ({ getMyTaskRunConfig, setMyTaskDefaults }),
}));
-const flags = {
- isEnabled: () => true,
- onFlagsLoaded: () => () => {},
-} as unknown as FeatureFlags;
-
const flush = () => new Promise<void>((resolve) => setTimeout(resolve, 0));
function deferred<T>() {
@@ -70,7 +64,7 @@ describe("ServerTaskDefaultsContribution", () => {
);
openProject(1);
- new ServerTaskDefaultsContribution({} as HostTrpcClient, flags).start();
+ new ServerTaskDefaultsContribution({} as HostTrpcClient).start();
openProject(2);
await flush();
// Project 1 was changed on web while its request ran.
diff --git a/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.ts b/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.ts
index 847e322a0c72..96061cd0e793 100644
--- a/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.ts
+++ b/products/desktop/packages/ui/src/features/settings/serverTaskDefaults.contribution.ts
@@ -3,13 +3,8 @@ import {
HOST_TRPC_CLIENT,
type HostTrpcClient,
} from "@posthog/host-router/client";
-import { SERVER_TASK_DEFAULTS_FLAG } from "@posthog/shared";
import { createAuthenticatedClient } from "@posthog/ui/features/auth/authClient";
import { useAuthStore } from "@posthog/ui/features/auth/store";
-import {
- FEATURE_FLAGS,
- type FeatureFlags,
-} from "@posthog/ui/features/feature-flags/identifiers";
import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";
import { logger } from "@posthog/ui/shell/logger";
import { inject, injectable } from "inversify";
@@ -30,12 +25,9 @@ export class ServerTaskDefaultsContribution implements Contribution {
constructor(
@inject(HOST_TRPC_CLIENT)
private readonly hostClient: HostTrpcClient,
- @inject(FEATURE_FLAGS)
- private readonly flags: FeatureFlags,
) {}
start(): void {
- this.flags.onFlagsLoaded(() => void this.reconcile(true));
useAuthStore.subscribe((state, prev) => {
if (
state.authState.currentProjectId !== prev.authState.currentProjectId ||
@@ -58,7 +50,6 @@ export class ServerTaskDefaultsContribution implements Contribution {
// `fetchAlways` reads the server even when Desktop has nothing new, to pick
// up a change made on web.
private async reconcile(fetchAlways: boolean): Promise<void> {
- if (!this.flags.isEnabled(SERVER_TASK_DEFAULTS_FLAG)) return;
const settings = useSettingsStore.getState();
const authState = useAuthStore.getState().authState;
const projectId = authState.currentProjectId;
diff --git a/products/desktop/packages/ui/src/features/task-detail/hooks/useTaskCreation.ts b/products/desktop/packages/ui/src/features/task-detail/hooks/useTaskCreation.ts
index e344ccfb33d0..ad0a3cf82b91 100644
--- a/products/desktop/packages/ui/src/features/task-detail/hooks/useTaskCreation.ts
+++ b/products/desktop/packages/ui/src/features/task-detail/hooks/useTaskCreation.ts
@@ -19,7 +19,6 @@ import {
ANALYTICS_EVENTS,
type ModelAccess,
PROJECT_BLUEBIRD_FLAG,
- SERVER_AGENT_INSTRUCTIONS_FLAG,
type TaskCreationInput,
type WorkspaceMode,
} from "@posthog/shared";
@@ -275,9 +274,6 @@ export function useTaskCreation({
PROJECT_BLUEBIRD_FLAG,
import.meta.env.DEV,
);
- const serverInstructionsEnabled = useFeatureFlag(
- SERVER_AGENT_INSTRUCTIONS_FLAG,
- );
const currentProjectId = useAuthStateValue((state) => state.currentProjectId);
const claudeTokenStore = useServiceOptional<ClaudeSubscriptionTokenSettings>(
CLAUDE_SUBSCRIPTION_TOKEN_SETTINGS,
@@ -518,7 +514,6 @@ export function useTaskCreation({
customInstructions:
workspaceMode === "cloud" &&
!cloudTaskCarriesLocalInstructions({
- flagEnabled: serverInstructionsEnabled,
projectId: currentProjectId,
onServer: settings.customInstructionsOnServer,
local: getLocalInstructionsContent(settings),
@@ -700,7 +695,6 @@ export function useTaskCreation({
[
canSubmit,
canSubmitBase,
- serverInstructionsEnabled,
currentProjectId,
editorRef,
sessionId,