: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
perf(desktop): fetch the channel feed with the basic payload (#98008)
Paul D'Ambra65cca4ce4009
diff --git a/products/desktop/packages/api-client/src/task-normalization.test.ts b/products/desktop/packages/api-client/src/task-normalization.test.tsindex 706ed71e2ce7..4c3732c3d518 100644--- a/products/desktop/packages/api-client/src/task-normalization.test.ts+++ b/products/desktop/packages/api-client/src/task-normalization.test.ts@@ -129,6 +129,7 @@ describe("task response normalization", () => {status: "started",log_url: null,},+ description_preview: "Task preview",created_at: "2026-07-21T00:00:00Z",updated_at: "2026-07-21T00:01:00Z",},@@ -140,6 +141,7 @@ describe("task response normalization", () => {slug: "task-1",title: "",description: "",+ description_preview: "Task preview",origin_product: "",repository: null,github_integration: null,diff --git a/products/desktop/packages/api-client/src/task-normalization.ts b/products/desktop/packages/api-client/src/task-normalization.tsindex 1b943d36e80d..34c25de11ff3 100644--- a/products/desktop/packages/api-client/src/task-normalization.ts+++ b/products/desktop/packages/api-client/src/task-normalization.ts@@ -42,6 +42,7 @@ type TaskResponseDTO = Partial<latest_run?: Record<string, unknown> | null;runtime?: unknown;repositories?: string[];+ description_preview?: string;};function isRecord(value: unknown): value is Record<string, unknown> {@@ -230,6 +231,9 @@ export function normalizeTaskResponse(? {}: { title_manually_set: dto.title_manually_set }),description: dto.description ?? "",+ ...(dto.description_preview === undefined+ ? {}+ : { description_preview: dto.description_preview }),created_at: dto.created_at ?? "",updated_at: dto.updated_at ?? "",last_activity_at: dto.last_activity_at ?? dto.updated_at ?? "",diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelFeedView.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelFeedView.tsxindex 7ecab7b689d8..0bbf985523c1 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelFeedView.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelFeedView.tsx@@ -756,8 +756,11 @@ const FeedItem = memo(function FeedItem({const canStop = taskData?.taskRunEnvironment === "cloud" && isActive;const starter = channelTaskStarter(task);const prompt = useMemo(- () => stripContextBlocks(xmlToPlainText(task.description ?? "")),- [task.description],+ () =>+ stripContextBlocks(+ xmlToPlainText(task.description_preview ?? task.description ?? ""),+ ),+ [task.description_preview, task.description],);const prUrls = useMemo(() =>diff --git a/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.test.ts b/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.test.tsindex 5cc94ecea0e7..e805652bdd02 100644--- a/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.test.ts+++ b/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.test.ts@@ -63,6 +63,10 @@ describe("channelFeedDisplay", () => {name: "PostHog app context blocks",text: "<posthog_trusted_context>\n- act with tools\n</posthog_trusted_context>\n<posthog_untrusted_context>\n- dashboard 1\n</posthog_untrusted_context>\n\nfix the bug",},+ {+ name: "a truncated channel context block",+ text: 'fix the bug\n<channel_context channel="growth">\nprivate context',+ },])("strips $name from the feed text", ({ text }) => {expect(stripContextBlocks(text)).toBe("fix the bug");});diff --git a/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.ts b/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.tsindex 4a0eb929d91a..c88b9ead7fb4 100644--- a/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.ts+++ b/products/desktop/packages/ui/src/features/canvas/components/channelFeedDisplay.ts@@ -2,8 +2,14 @@ import { stripInjectedBlocks } from "@posthog/core/editor/injectedBlocks";import type { SignalReport, Task } from "@posthog/shared/domain-types";import type { ChannelFeedSystemMessage } from "@posthog/ui/features/canvas/hooks/useChannelFeedMessages";+const incompleteContextBlock =+ /<(?:channel_context|canvas_generation_instructions|posthog_trusted_context|posthog_untrusted_context|posthog_context|user_custom_instructions|onboarding_brief|slack_thread_context)\b[\s\S]*$/;+export function stripContextBlocks(text: string): string {- return stripInjectedBlocks(text).replace(/\n{3,}/g, "\n\n");+ return stripInjectedBlocks(text)+ .replace(incompleteContextBlock, "")+ .replace(/\n{3,}/g, "\n\n")+ .trim();}// A single feed entry — a task card, a report card, or a synthetic system row —diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelFeed.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelFeed.tsindex 24e17a67fea6..92066f494fb6 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useChannelFeed.ts+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useChannelFeed.ts@@ -34,6 +34,9 @@ export function useChannelFeed(channelId: string | undefined): {client.getTasks({channel: channelId,ordering: "-last_activity_at",+ // The feed shows a prompt snippet, not the full body, so ask for the basic+ // payload. It reads description_preview; the full text is on the open task.+ basic: true,}) as unknown as Promise<Task[]>,{enabled: !!channelId,