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.

revert(desktop): remove report canvas navigation gating (#86769)

Dylan Martin9c89dfa58e8b
diff --git a/products/desktop/docs/DEEP-LINKS.md b/products/desktop/docs/DEEP-LINKS.md
index 4ea730ed7669..8b1eb6b2ebf7 100644
--- a/products/desktop/docs/DEEP-LINKS.md
+++ b/products/desktop/docs/DEEP-LINKS.md
@@ -98,11 +98,11 @@ An **https** bridge also exists for links sent outside the app (e.g. comment Sla
### `posthog-code://inbox/<reportId>`
-Open a report in Inbox. When `posthog-desktop-report-canvases` is enabled and the report has a generated canvas, open that canvas instead.
+Open a specific inbox report.
| Segment | Required | Description |
|---|---|---|
-| `<reportId>` | Yes | Report ID |
+| `<reportId>` | Yes | Inbox report ID |
```
posthog-code://inbox/report_abc123
diff --git a/products/desktop/packages/core/src/canvas/taskActivity.test.ts b/products/desktop/packages/core/src/canvas/taskActivity.test.ts
index 8b7e3cc0bc06..ebd8f1aa8d4d 100644
--- a/products/desktop/packages/core/src/canvas/taskActivity.test.ts
+++ b/products/desktop/packages/core/src/canvas/taskActivity.test.ts
@@ -21,8 +21,6 @@ function activity(overrides: Partial<TaskActivity> = {}): TaskActivity {
snippet: "ping @[Me]([email protected])",
latest_author: ann,
latest_message_id: "m1",
- target_scope: null,
- target_id: null,
is_unread: true,
...overrides,
};
@@ -44,8 +42,6 @@ describe("toTaskActivityItems", () => {
messageId: "m1",
commentId: null,
commentTarget: null,
- targetScope: null,
- targetId: null,
isUnread: true,
},
]);
@@ -68,15 +64,6 @@ describe("toTaskActivityItems", () => {
});
});
- it("maps a report canvas target for direct navigation", () => {
- const [item] = toTaskActivityItems([
- activity({ target_scope: "desktop_canvas", target_id: "canvas-1" }),
- ]);
-
- expect(item.targetScope).toBe("desktop_canvas");
- expect(item.targetId).toBe("canvas-1");
- });
-
it("labels untitled tasks and tolerates missing optional values", () => {
const [item] = toTaskActivityItems([
activity({
diff --git a/products/desktop/packages/core/src/canvas/taskActivity.ts b/products/desktop/packages/core/src/canvas/taskActivity.ts
index 6f4c7f217ff8..420c41e54724 100644
--- a/products/desktop/packages/core/src/canvas/taskActivity.ts
+++ b/products/desktop/packages/core/src/canvas/taskActivity.ts
@@ -29,8 +29,6 @@ export interface TaskActivityItem {
messageId: string | null;
commentId?: string | null;
commentTarget?: CommentTarget | null;
- targetScope: "desktop_canvas" | null;
- targetId: string | null;
isUnread: boolean;
}
@@ -57,8 +55,6 @@ export function toTaskActivityItems(
itemId: row.latest_comment_item_id,
}
: null,
- targetScope: row.target_scope ?? null,
- targetId: row.target_id ?? null,
isUnread: row.is_unread,
}));
}
diff --git a/products/desktop/packages/core/src/sessions/sessionViewState.ts b/products/desktop/packages/core/src/sessions/sessionViewState.ts
index 3df51d341d79..f5ddf4c9aebf 100644
--- a/products/desktop/packages/core/src/sessions/sessionViewState.ts
+++ b/products/desktop/packages/core/src/sessions/sessionViewState.ts
@@ -29,6 +29,8 @@ export function deriveSessionViewState(
workspace: Workspace | null,
isCloud: boolean,
): SessionViewState {
+ // The live session knows it is cloud before the workspace query or `latest_run`
+ // metadata lands, so trust either source.
const effectiveIsCloud = isCloud || session?.isCloud === true;
const cloudStatus = resolveEffectiveCloudStatus(task, session);
const isCloudRunTerminal = effectiveIsCloud && isTerminalStatus(cloudStatus);
diff --git a/products/desktop/packages/shared/src/domain-types.ts b/products/desktop/packages/shared/src/domain-types.ts
index 77b68303950d..2e173697bcc7 100644
--- a/products/desktop/packages/shared/src/domain-types.ts
+++ b/products/desktop/packages/shared/src/domain-types.ts
@@ -254,8 +254,6 @@ export interface TaskActivity {
latest_comment_id?: string | null;
latest_comment_scope?: string | null;
latest_comment_item_id?: string | null;
- target_scope?: "desktop_canvas" | null;
- target_id?: string | null;
is_unread: boolean;
}
@@ -661,16 +659,6 @@ export interface SignalReport {
implementation_pr_url?: string | null;
/** Charts the report shows, placed by `[label](chart:<chart_id>)` links in the summary. */
charts?: SignalReportChart[];
- /** The persistent canvas session generated for this report, when available. */
- canvas_session?: {
- canvas_id: string;
- discussion_task_id: string;
- generation_task_id?: string | null;
- generation_status: "pending" | "generating" | "ready" | "failed";
- collaboration_mode: "managed" | "collaborative";
- failure_reason: string;
- updated_at: string;
- } | null;
/** The report's PR refund, when one exists (one refund per report, ever). */
refund?: SignalReportRefund | null;
/** Marks reports that were never billable ("Free"), so there is nothing to refund. */
diff --git a/products/desktop/packages/shared/src/flags.ts b/products/desktop/packages/shared/src/flags.ts
index 9b836c79ba96..660ac429d36f 100644
--- a/products/desktop/packages/shared/src/flags.ts
+++ b/products/desktop/packages/shared/src/flags.ts
@@ -52,8 +52,6 @@ export const TASK_COST_VISIBLE_FLAG = "posthog-code-task-cost-visible";
export const ANNOUNCEMENTS_FLAG = "posthog-desktop-announcements";
/** Gates the PR-refund action in the inbox (matches the web SIGNALS_PR_REFUNDS flag). */
export const SIGNALS_PR_REFUNDS_FLAG = "signals-pr-refunds";
-/** Gates replacing Inbox report navigation with generated report canvases. */
-export const REPORT_CANVAS_INBOX_FLAG = "posthog-desktop-report-canvases";
/**
* Serves a session's Claude traffic from Bedrock instead of Anthropic. The
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.test.tsx
index af15152de2cf..2194ec975520 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.test.tsx
@@ -41,11 +41,10 @@ const conversationItems = [
function renderTimeline(
canOpenInPlace?: boolean,
items: ConversationItem[] = conversationItems,
- timelineTask: Task = task,
) {
return render(
<ActivityTimeline
- task={timelineTask}
+ task={task}
timeline={[]}
messages={[]}
// biome-ignore lint/suspicious/noExplicitAny: narrow fixture for the rows under test
@@ -60,18 +59,6 @@ beforeEach(() => {
});
describe("ActivityTimeline", () => {
- it("attributes an internal Signals task to its report", () => {
- renderTimeline(false, [], {
- ...task,
- created_by: undefined,
- origin_product: "signal_report",
- });
-
- expect(
- screen.getByText("PostHog started this task from a Signals report"),
- ).toBeInTheDocument();
- });
-
it("names each message row by its own content, not a shared template", () => {
renderTimeline(true);
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx
index 162b106c3223..e38705ea8b1a 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityTimeline.tsx
@@ -336,9 +336,7 @@ export function ActivityTimeline({
gutter={<PersonBead user={task.created_by} badge={CREATED_BADGE} />}
timestamp={task.created_at}
>
- {!task.created_by && task.origin_product === "signal_report"
- ? "PostHog started this task from a Signals report"
- : `${task.created_by ? userDisplayName(task.created_by) : "Someone"} created this task`}
+ {`${task.created_by ? userDisplayName(task.created_by) : "Someone"} created this task`}
</TimelineRow>
);
case "user_message":
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx
index 504265d34c95..9f8993ea0b8f 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx
@@ -31,8 +31,6 @@ function item(overrides: Partial<TaskActivityItem>): TaskActivityItem {
snippet: "Hello!",
author: null,
messageId: "message-1",
- targetScope: null,
- targetId: null,
isUnread: true,
...overrides,
};
@@ -159,30 +157,4 @@ describe("activityHeadline", () => {
intent: "navigate",
});
});
-
- it("opens report activity at its generated canvas", () => {
- const activity = item({
- activityKind: "completed",
- channelId: "channel-1",
- targetScope: "desktop_canvas",
- targetId: "canvas-1",
- });
-
- render(
- <ActivityRow
- item={activity}
- channelId="channel-1"
- onOpen={vi.fn()}
- onMarkRead={vi.fn()}
- blockedTaskIds={NO_BLOCKED_TASKS}
- />,
- );
- fireEvent.click(screen.getByText("A report canvas is ready"));
-
- expect(navigation.toChannelDashboard).toHaveBeenCalledWith(
- "channel-1",
- "canvas-1",
- );
- expect(navigation.toChannelTask).not.toHaveBeenCalled();
- });
});
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx
index 96e883d884aa..291226cbc582 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx
@@ -115,10 +115,6 @@ export function ActivityRow({
.requestCommentFocus(item.taskId, item.commentTarget, item.commentId);
}
onNavigate?.();
- if (channelId && item.targetScope === "desktop_canvas" && item.targetId) {
- navigateToChannelDashboard(channelId, item.targetId);
- return;
- }
if (channelId && item.commentTarget?.scope === "desktop_canvas") {
useCanvasChatPanelStore.getState().openComments();
navigateToChannelDashboard(channelId, item.commentTarget.itemId);
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx
index 865f679bd209..95ced96dde07 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx
@@ -40,12 +40,6 @@ describe("ChannelNav", () => {
mocks.view = { type: "task-input" };
});
- it("keeps Inbox available in the channels navigation", () => {
- render(<ChannelNav />);
-
- expect(screen.getByLabelText("Inbox")).toBeEnabled();
- });
-
it("opens recent activity from the bell after the hover delay", async () => {
const user = userEvent.setup();
render(<ChannelNav />);
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx
index 5c6bf501c0ef..fa9b13f7712b 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx
@@ -13,7 +13,6 @@ const mocks = vi.hoisted(() => ({
starred: boolean;
}[],
channelsLoading: false,
- createChannel: vi.fn(),
archivedTaskIds: new Set<string>(),
navigateToArchived: vi.fn(),
track: vi.fn(),
@@ -36,9 +35,6 @@ vi.mock("@posthog/ui/features/canvas/hooks/useChannels", () => ({
channels: mocks.channels,
isLoading: mocks.channelsLoading,
}),
- useChannelMutations: () => ({
- createChannel: mocks.createChannel,
- }),
}));
vi.mock("@posthog/ui/features/canvas/hooks/useMarkChannelSeen", () => ({
useMarkChannelSeen: (channelId: string | undefined) =>
@@ -89,10 +85,7 @@ vi.mock("@tanstack/react-router", () => ({
useParams: () => ({ channelId: mocks.routeChannelId }),
}));
-import {
- PROJECT_BLUEBIRD_FLAG,
- REPORT_CANVAS_INBOX_FLAG,
-} from "@posthog/shared";
+import { PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";
import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";
import {
keepListForRoute,
@@ -131,7 +124,6 @@ describe("ChannelsSidebar", () => {
mocks.channelsLayout = false;
mocks.channels = [];
mocks.channelsLoading = false;
- mocks.createChannel.mockResolvedValue({ id: "general-id" });
mocks.archivedTaskIds = new Set();
mocks.track.mockClear();
mocks.routeChannelId = undefined;
@@ -146,14 +138,6 @@ describe("ChannelsSidebar", () => {
});
});
- it("does not provision #general outside the report canvas rollout", () => {
- mocks.featureFlags.set(REPORT_CANVAS_INBOX_FLAG, false);
-
- renderSidebar();
-
- expect(mocks.createChannel).not.toHaveBeenCalled();
- });
-
// The sidebar is a two-pane slider: the channel list, and the channel you're
// in. Both stay mounted, so "which one is showing" is the offscreen pane
// being inert rather than unmounted.
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx
index 1005e954e438..7fa6dcc685c4 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx
@@ -1,9 +1,6 @@
import { ArchiveIcon } from "@phosphor-icons/react";
import { cn, Separator } from "@posthog/quill";
-import {
- PROJECT_BLUEBIRD_FLAG,
- REPORT_CANVAS_INBOX_FLAG,
-} from "@posthog/shared";
+import { PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";
import { useArchivedTaskIds } from "@posthog/ui/features/archive/useArchivedTaskIds";
import { ChannelItemPreviewCardProvider } from "@posthog/ui/features/canvas/components/ChannelItemHoverCard";
import { ChannelNav } from "@posthog/ui/features/canvas/components/ChannelNav";
@@ -15,7 +12,6 @@ import { useChannelPaneSwipe } from "@posthog/ui/features/canvas/hooks/useChanne
import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";
import { useCurrentChannel } from "@posthog/ui/features/canvas/hooks/useCurrentChannel";
import { useMarkChannelSeen } from "@posthog/ui/features/canvas/hooks/useMarkChannelSeen";
-import { useReportSpace } from "@posthog/ui/features/canvas/hooks/useReportSpace";
import { useTrackChannelsSpaceViewed } from "@posthog/ui/features/canvas/hooks/useTrackChannelsSpaceViewed";
import {
clearKeepListForRoute,
@@ -114,11 +110,6 @@ function ChannelPanes({
);
}
export function ChannelsSidebar() {
- const reportCanvasesEnabled = useFeatureFlag(
- REPORT_CANVAS_INBOX_FLAG,
- import.meta.env.DEV,
- );
- useReportSpace(reportCanvasesEnabled);
const width = useChannelsSidebarStore((state) => state.width);
const setWidth = useChannelsSidebarStore((state) => state.setWidth);
const isResizing = useChannelsSidebarStore((state) => state.isResizing);
diff --git a/products/desktop/packages/ui/src/features/canvas/components/WebsiteChannelsIndex.tsx b/products/desktop/packages/ui/src/features/canvas/components/WebsiteChannelsIndex.tsx
index 9e4a3e81f80c..059fdf772ca3 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/WebsiteChannelsIndex.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/WebsiteChannelsIndex.tsx
@@ -1,6 +1,5 @@
import { PlusIcon } from "@phosphor-icons/react";
import { Button } from "@posthog/quill";
-import { REPORT_CANVAS_INBOX_FLAG } from "@posthog/shared";
import { BlankTabView } from "@posthog/ui/features/browser-tabs/BlankTabView";
import {
useActiveTabIsBlank,
@@ -9,8 +8,6 @@ import {
import { CreateChannelModal } from "@posthog/ui/features/canvas/components/CreateChannelModal";
import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";
import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";
-import { useReportSpace } from "@posthog/ui/features/canvas/hooks/useReportSpace";
-import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
import { Flex, Text } from "@radix-ui/themes";
import { Navigate, useRouterState } from "@tanstack/react-router";
import { useState } from "react";
@@ -20,13 +17,6 @@ import { useState } from "react";
export function WebsiteChannelsIndex() {
const spacesLayout = useChannelsLayout();
const { channels, isLoading } = useChannels();
- const reportCanvasesEnabled = useFeatureFlag(
- REPORT_CANVAS_INBOX_FLAG,
- import.meta.env.DEV,
- );
- const { reportSpaceId, isLoading: isLoadingReportSpace } = useReportSpace(
- reportCanvasesEnabled,
- );
const [modalOpen, setModalOpen] = useState(false);
// A blank "+" tab parks at /website; RootLayout renders the placeholder for
// it. Never redirect to the first channel while it's active.
@@ -45,23 +35,13 @@ export function WebsiteChannelsIndex() {
select: (s) => s.location.pathname === "/website",
});
- if (isLoading || isLoadingReportSpace) return null;
+ if (isLoading) return null;
if (!onIndexPath || activeTabIsBlank) return null;
- if (reportSpaceId) {
+ if (channels.length > 0) {
// Empty tab strip → the new-tab screen, not a redirect that re-opens a tab.
if (hasNoTabs) return <BlankTabView />;
- return (
- <Navigate
- to="/website/$channelId"
- params={{ channelId: reportSpaceId }}
- replace
- />
- );
- }
-
- if (channels.length > 0) {
return (
<Navigate
to="/website/$channelId"
diff --git a/products/desktop/packages/ui/src/features/canvas/components/activityHeadline.tsx b/products/desktop/packages/ui/src/features/canvas/components/activityHeadline.tsx
index 004127bb638c..c97ba43c25c8 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/activityHeadline.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/activityHeadline.tsx
@@ -1,19 +1,16 @@
+import { channelDisplayReference } from "@posthog/core/canvas/channelName";
import type { TaskActivityItem } from "@posthog/core/canvas/taskActivity";
import { userDisplayName } from "@posthog/ui/features/canvas/utils/userDisplay";
import type { ReactNode } from "react";
-function ChannelSuffix({
- channelName,
-}: {
- channelName: string | null;
-}): ReactNode {
+function ChannelSuffix({ channelName }: { channelName: string | null }) {
if (!channelName) return null;
- const label =
- channelName === "personal" ? "your personal space" : `#${channelName}`;
return (
<>
{" in "}
- <span className="font-medium text-xs">{label}</span>
+ <span className="font-medium text-xs">
+ {channelDisplayReference(channelName)}
+ </span>
</>
);
}
@@ -29,18 +26,11 @@ function ownedItemName(item: TaskActivityItem): string {
}
}
+/** The lead line describing what happened, chosen by the row's activity kind. */
export function activityHeadline(
item: TaskActivityItem,
currentUserEmail?: string | null,
): ReactNode {
- if (item.targetScope === "desktop_canvas") {
- return (
- <>
- A report canvas is ready
- <ChannelSuffix channelName={item.channelName} />
- </>
- );
- }
switch (item.activityKind) {
case "awaiting_input":
return (
diff --git a/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.test.ts b/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.test.ts
index 31a1cc736102..0c4791cc28dc 100644
--- a/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.test.ts
+++ b/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.test.ts
@@ -9,32 +9,16 @@ import {
} from "./canvasGenerationStatus";
type Run = Pick<TaskRun, "environment" | "status">;
-type Session = Pick<
- AgentSession,
- | "status"
- | "isCloud"
- | "cloudStatus"
- | "isPromptPending"
- | "taskRunId"
- | "agentIdleForRunId"
->;
+type Session = Pick<AgentSession, "status" | "cloudStatus" | "isPromptPending">;
type GenSession = Session;
const genSession = (
status: AgentSession["status"],
- opts?: {
- cloudStatus?: TaskRunStatus;
- isPromptPending?: boolean;
- agentIdle?: boolean;
- isCloud?: boolean;
- },
+ opts?: { cloudStatus?: TaskRunStatus; isPromptPending?: boolean },
): GenSession => ({
status,
cloudStatus: opts?.cloudStatus,
isPromptPending: opts?.isPromptPending ?? false,
- isCloud: opts?.isCloud,
- taskRunId: "r1",
- agentIdleForRunId: opts?.agentIdle ? "r1" : undefined,
});
const run = (environment: "local" | "cloud", status: TaskRunStatus): Run => ({
@@ -44,14 +28,7 @@ const run = (environment: "local" | "cloud", status: TaskRunStatus): Run => ({
const session = (
status: AgentSession["status"],
cloudStatus?: TaskRunStatus,
-): Session => ({
- status,
- cloudStatus,
- isPromptPending: false,
- isCloud: undefined,
- taskRunId: "r1",
- agentIdleForRunId: undefined,
-});
+): Session => ({ status, cloudStatus, isPromptPending: false });
describe("isCanvasGenerationRunning", () => {
it("is not running when there is no generation task", () => {
@@ -96,7 +73,7 @@ describe("isCanvasGenerationRunning", () => {
[
"turn settled on the lingering sandbox",
run("cloud", "in_progress"),
- genSession("connected", { agentIdle: true }),
+ genSession("connected", { isPromptPending: false }),
false,
],
[
@@ -196,17 +173,6 @@ describe("isCanvasGenerating", () => {
).toBe(true);
});
- it("uses a streaming cloud session before latest run metadata arrives", () => {
- expect(
- isCanvasGenerating({
- genTaskId: "t1",
- genTaskLoading: false,
- latestRun: undefined,
- session: genSession("connected", { isCloud: true }),
- }),
- ).toBe(true);
- });
-
it.each<[string, Run, GenSession | undefined, boolean]>([
["cloud in_progress", run("cloud", "in_progress"), undefined, true],
[
@@ -225,16 +191,10 @@ describe("isCanvasGenerating", () => {
genSession("connected", { isPromptPending: true }),
true,
],
- [
- "cloud automatic turn attached after its prompt",
- run("cloud", "in_progress"),
- genSession("connected"),
- true,
- ],
[
"cloud turn settled while the sandbox lingers",
run("cloud", "in_progress"),
- genSession("connected", { agentIdle: true }),
+ genSession("connected", { isPromptPending: false }),
false,
],
[
diff --git a/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.ts b/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.ts
index 9ebb659f209c..904cdfd73bd3 100644
--- a/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.ts
+++ b/products/desktop/packages/ui/src/features/canvas/freeform/canvasGenerationStatus.ts
@@ -14,15 +14,7 @@ export interface CanvasGenerationStatusInput {
latestRun: Pick<TaskRun, "environment" | "status"> | undefined;
/** The live ACP session for the task, if one is connected in this client. */
session:
- | Pick<
- AgentSession,
- | "status"
- | "isCloud"
- | "cloudStatus"
- | "isPromptPending"
- | "taskRunId"
- | "agentIdleForRunId"
- >
+ | Pick<AgentSession, "status" | "cloudStatus" | "isPromptPending">
| undefined;
}
@@ -33,23 +25,20 @@ export type CanvasTerminalStatus = Extract<
// A cloud run's turn-level activity. The sandbox lingers after the agent's
// turn so follow-ups can reuse it — the run record only completes on the
-// inactivity timeout, long after generation actually ended. A live session
-// therefore decides: prompt-pending proves work is active, while the per-run
-// idle marker proves turn_complete arrived. The marker also covers attachment
-// after an automatic prompt, where the prompt event itself may not be replayed.
-// Without a mirror the run status is all there is.
+// inactivity timeout, long after generation actually ended — so a non-terminal
+// status alone can't mean "generating". A live session mirror carries the
+// turn-level signal (prompt-pending arms on session/prompt and clears on
+// turn_complete); when one exists it decides, with "connecting" covering the
+// attach/replay window before the prompt event has streamed in. Without a
+// mirror the run status is all there is.
function isCloudRunActive(
- latestRun: Pick<TaskRun, "status"> | undefined,
+ latestRun: Pick<TaskRun, "status">,
session: CanvasGenerationStatusInput["session"],
): boolean {
- const cloudStatus = session?.cloudStatus ?? latestRun?.status;
+ const cloudStatus = session?.cloudStatus ?? latestRun.status;
if (isTerminalStatus(cloudStatus)) return false;
if (session) {
- return (
- session.status === "connecting" ||
- session.isPromptPending === true ||
- session.agentIdleForRunId !== session.taskRunId
- );
+ return session.status === "connecting" || session.isPromptPending === true;
}
return true;
}
@@ -74,7 +63,7 @@ export function isCanvasGenerationRunning({
// Assume running while the task record is still loading.
if (genTaskLoading) return true;
- if (latestRun?.environment === "cloud" || session?.isCloud === true) {
+ if (latestRun?.environment === "cloud") {
return isCloudRunActive(latestRun, session);
}
@@ -99,7 +88,7 @@ export function isCanvasGenerating({
if (!genTaskId) return false;
if (genTaskLoading) return true;
- if (latestRun?.environment === "cloud" || session?.isCloud === true) {
+ if (latestRun?.environment === "cloud") {
return isCloudRunActive(latestRun, session);
}
diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.test.tsx b/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.test.tsx
deleted file mode 100644
index 227d8bc6f4e4..000000000000
--- a/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.test.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-// @vitest-environment jsdom
-
-import { renderHook, waitFor } from "@testing-library/react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { useReportSpace } from "./useReportSpace";
-
-const createChannel = vi.fn(async () => ({ id: "general-id" }));
-let currentProjectId = 1;
-const channelsState: {
- channels: Array<{
- id: string;
- name: string;
- channelType: "public";
- starred: boolean;
- }>;
-} = {
- channels: [],
-};
-
-vi.mock("@posthog/ui/features/canvas/hooks/useChannels", () => ({
- useChannels: () => ({ channels: channelsState.channels, isLoading: false }),
- useChannelMutations: () => ({ createChannel }),
-}));
-vi.mock("@posthog/ui/features/auth/store", () => ({
- useAuthStateValue: (
- selector: (state: { currentProjectId: number }) => number,
- ) => selector({ currentProjectId }),
-}));
-
-describe("useReportSpace", () => {
- beforeEach(() => {
- channelsState.channels = [];
- currentProjectId = 1;
- createChannel.mockClear();
- });
-
- it("provisions the default report space once and resolves its id", async () => {
- const { rerender, result } = renderHook(() => useReportSpace());
- await waitFor(() => expect(createChannel).toHaveBeenCalledTimes(1));
- expect(createChannel).toHaveBeenCalledWith("general", { star: true });
-
- rerender();
- expect(createChannel).toHaveBeenCalledTimes(1);
-
- channelsState.channels = [
- {
- id: "general-id",
- name: "general",
- channelType: "public",
- starred: false,
- },
- ];
- rerender();
- expect(result.current.reportSpaceId).toBe("general-id");
- });
-
- it("does not provision or expose the report space when disabled", () => {
- channelsState.channels = [
- {
- id: "general-id",
- name: "general",
- channelType: "public",
- starred: false,
- },
- ];
-
- const { result } = renderHook(() => useReportSpace(false));
-
- expect(createChannel).not.toHaveBeenCalled();
- expect(result.current).toEqual({ reportSpaceId: null, isLoading: false });
- });
-
- it("provisions again after the current project changes", async () => {
- const { rerender } = renderHook(() => useReportSpace());
- await waitFor(() => expect(createChannel).toHaveBeenCalledTimes(1));
-
- currentProjectId = 2;
- rerender();
-
- await waitFor(() => expect(createChannel).toHaveBeenCalledTimes(2));
- });
-});
diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.ts
deleted file mode 100644
index f29e2081d9bf..000000000000
--- a/products/desktop/packages/ui/src/features/canvas/hooks/useReportSpace.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { useAuthStateValue } from "@posthog/ui/features/auth/store";
-import {
- useChannelMutations,
- useChannels,
-} from "@posthog/ui/features/canvas/hooks/useChannels";
-import { toast } from "@posthog/ui/primitives/toast";
-import { useEffect, useRef, useState } from "react";
-
-export const DEFAULT_REPORT_SPACE_NAME = "general";
-
-export function useReportSpace(enabled = true): {
- reportSpaceId: string | null;
- isLoading: boolean;
-} {
- const { channels, isLoading } = useChannels();
- const { createChannel } = useChannelMutations();
- const currentProjectId = useAuthStateValue((state) => state.currentProjectId);
- const creationStarted = useRef(false);
- const provisioningProjectId = useRef(currentProjectId);
- const [creationFailed, setCreationFailed] = useState(false);
- const reportSpace = channels.find(
- (channel) =>
- channel.channelType === "public" &&
- channel.name === DEFAULT_REPORT_SPACE_NAME,
- );
-
- useEffect(() => {
- if (provisioningProjectId.current === currentProjectId) return;
- provisioningProjectId.current = currentProjectId;
- creationStarted.current = false;
- setCreationFailed(false);
- }, [currentProjectId]);
-
- useEffect(() => {
- if (
- provisioningProjectId.current !== currentProjectId ||
- !enabled ||
- isLoading ||
- reportSpace ||
- creationStarted.current ||
- creationFailed
- )
- return;
- creationStarted.current = true;
- void createChannel(DEFAULT_REPORT_SPACE_NAME, { star: true }).catch(
- (error: unknown) => {
- creationStarted.current = false;
- setCreationFailed(true);
- toast.error("Couldn't create the report space", {
- // Stable id so concurrent hook instances collapse to one toast
- // instead of stacking identical failures.
- id: "report-space-creation-error",
- description:
- error instanceof Error
- ? error.message
- : "Refresh the page to try again.",
- });
- },
- );
- }, [
- createChannel,
- creationFailed,
- currentProjectId,
- enabled,
- isLoading,
- reportSpace,
- ]);
-
- return {
- reportSpaceId: enabled ? (reportSpace?.id ?? null) : null,
- isLoading: enabled && (isLoading || (!reportSpace && !creationFailed)),
- };
-}
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useOpenInboxReport.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useOpenInboxReport.ts
index 343c5f8f182d..72c83210dc80 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useOpenInboxReport.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useOpenInboxReport.ts
@@ -1,14 +1,10 @@
import { seedInboxReportDetailCache } from "@posthog/core/inbox/inboxQuery";
-import { REPORT_CANVAS_INBOX_FLAG } from "@posthog/shared";
import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";
import { AUTH_SCOPED_QUERY_META } from "@posthog/ui/features/auth/useCurrentUser";
-import { useReportSpace } from "@posthog/ui/features/canvas/hooks/useReportSpace";
-import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
import { reportKeys } from "@posthog/ui/features/inbox/hooks/useInboxReports";
import { useInboxSignalsFilterStore } from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";
import { toast } from "@posthog/ui/primitives/toast";
import {
- navigateToChannelDashboard,
navigateToInboxDismissedDetail,
navigateToInboxPullRequestDetail,
navigateToInboxReportDetail,
@@ -34,11 +30,6 @@ export function useOpenInboxReport() {
const queryClient = useQueryClient();
const client = useOptionalAuthenticatedClient();
const resetFilters = useInboxSignalsFilterStore((s) => s.resetFilters);
- const reportCanvasesEnabled = useFeatureFlag(
- REPORT_CANVAS_INBOX_FLAG,
- import.meta.env.DEV,
- );
- const { reportSpaceId } = useReportSpace(reportCanvasesEnabled);
return useCallback(
async (reportId: string) => {
@@ -62,18 +53,6 @@ export function useOpenInboxReport() {
return;
}
- if (
- reportCanvasesEnabled &&
- reportSpaceId &&
- report.canvas_session?.generation_status === "ready"
- ) {
- navigateToChannelDashboard(
- reportSpaceId,
- report.canvas_session.canvas_id,
- );
- return;
- }
-
resetFilters();
seedInboxReportDetailCache(queryClient, report);
if (report.status === "suppressed") {
@@ -89,6 +68,6 @@ export function useOpenInboxReport() {
toast.error("Failed to open report");
}
},
- [client, queryClient, reportCanvasesEnabled, reportSpaceId, resetFilters],
+ [client, queryClient, resetFilters],
);
}
diff --git a/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.test.tsx b/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.test.tsx
index 2d6ebaf72dac..9d11d1c35add 100644
--- a/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.test.tsx
+++ b/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.test.tsx
@@ -27,16 +27,6 @@ function task(runId: string, status: "failed" | "in_progress"): Task {
} as Task;
}
-function signalsTaskWithoutRun(): Task {
- return {
- ...task("pending-run", "in_progress"),
- title: "Generate report canvas",
- description: "Generate a canvas",
- origin_product: "signal_report",
- latest_run: undefined,
- };
-}
-
describe("useRefreshedTask", () => {
beforeEach(() => {
mocks.getTask.mockReset();
@@ -64,34 +54,4 @@ describe("useRefreshedTask", () => {
});
expect(mocks.getTask).toHaveBeenCalledWith("task-123");
});
-
- it("polls a Signals task until its cloud run is attached", async () => {
- const pendingTask = signalsTaskWithoutRun();
- const runningTask = {
- ...task("run-child", "in_progress"),
- origin_product: "signal_report",
- } as Task;
- mocks.getTask
- .mockResolvedValueOnce(pendingTask)
- .mockResolvedValueOnce(runningTask);
- const queryClient = new QueryClient({
- defaultOptions: { queries: { retry: false } },
- });
- const wrapper = ({ children }: PropsWithChildren) => (
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
- );
-
- const { result } = renderHook(
- () => useRefreshedTask("task-123", pendingTask),
- { wrapper },
- );
-
- await waitFor(
- () => {
- expect(result.current.latest_run?.id).toBe("run-child");
- },
- { timeout: 3_000 },
- );
- expect(mocks.getTask).toHaveBeenCalledTimes(2);
- });
});
diff --git a/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.ts b/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.ts
index d50f62c1140d..df35a8f382f2 100644
--- a/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.ts
+++ b/products/desktop/packages/ui/src/features/task-detail/hooks/useRefreshedTask.ts
@@ -2,19 +2,11 @@ import type { Task } from "@posthog/shared/domain-types";
import { useQuery } from "@tanstack/react-query";
import { taskDetailQuery } from "../../tasks/queries";
-const SIGNALS_RUN_POLL_INTERVAL_MS = 2_000;
-
export function useRefreshedTask(taskId: string, initialTask: Task): Task {
const { data } = useQuery({
...taskDetailQuery(taskId),
initialData: initialTask,
refetchOnMount: "always",
- refetchInterval: (query) => {
- const task = query.state.data;
- return task?.origin_product === "signal_report" && !task.latest_run?.id
- ? SIGNALS_RUN_POLL_INTERVAL_MS
- : false;
- },
});
// The refetch can resolve without data (e.g. a stale / cross-project id
diff --git a/products/desktop/packages/ui/src/features/workspace/useIsCloudTask.ts b/products/desktop/packages/ui/src/features/workspace/useIsCloudTask.ts
index a759444e2b4f..5c2e6a633511 100644
--- a/products/desktop/packages/ui/src/features/workspace/useIsCloudTask.ts
+++ b/products/desktop/packages/ui/src/features/workspace/useIsCloudTask.ts
@@ -1,8 +1,8 @@
import type { Task } from "@posthog/shared/domain-types";
-import { isCloudTask, useWorkspace } from "./useWorkspace";
+import { useWorkspace } from "./useWorkspace";
export function useIsCloudTask(taskId: string, task?: Task): boolean {
const workspace = useWorkspace(taskId);
- if (!task) return workspace?.mode === "cloud";
- return isCloudTask(task, workspace);
+ if (workspace?.mode === "cloud") return true;
+ return task?.latest_run?.environment === "cloud";
}
diff --git a/products/desktop/packages/ui/src/features/workspace/useWorkspace.test.ts b/products/desktop/packages/ui/src/features/workspace/useWorkspace.test.ts
index d2874919be00..3b35c184a348 100644
--- a/products/desktop/packages/ui/src/features/workspace/useWorkspace.test.ts
+++ b/products/desktop/packages/ui/src/features/workspace/useWorkspace.test.ts
@@ -10,10 +10,6 @@ function task(environment?: TaskRunEnvironment): Task {
} as Task;
}
-function signalReportTask(): Task {
- return { ...task(), origin_product: "signal_report" };
-}
-
function workspace(mode: Workspace["mode"]): Workspace {
return { mode } as Workspace;
}
@@ -38,12 +34,6 @@ describe("isCloudTask", () => {
workspace: null,
expected: false,
},
- {
- name: "Signals report before its run is visible",
- task: signalReportTask(),
- workspace: null,
- expected: true,
- },
{
name: "cloud workspace row",
task: task(),
diff --git a/products/desktop/packages/ui/src/features/workspace/useWorkspace.ts b/products/desktop/packages/ui/src/features/workspace/useWorkspace.ts
index b91d4c5da8d2..131c1b98ba2d 100644
--- a/products/desktop/packages/ui/src/features/workspace/useWorkspace.ts
+++ b/products/desktop/packages/ui/src/features/workspace/useWorkspace.ts
@@ -39,10 +39,7 @@ export function isCloudTask(task: Task, workspace: Workspace | null): boolean {
if (workspace) {
return workspace.mode === "cloud";
}
- return (
- task.origin_product === "signal_report" ||
- task.latest_run?.environment === "cloud"
- );
+ return task.latest_run?.environment === "cloud";
}
export function useIsCloudTask(task: Task): boolean {
diff --git a/products/desktop/packages/ui/src/router/routes/code/inbox.test.tsx b/products/desktop/packages/ui/src/router/routes/code/inbox.test.tsx
deleted file mode 100644
index c07b2a0c9bad..000000000000
--- a/products/desktop/packages/ui/src/router/routes/code/inbox.test.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { render, screen } from "@testing-library/react";
-import type { ReactElement } from "react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
-
-const mocks = vi.hoisted(() => ({
- reportId: "report-id" as string | undefined,
- pathname: "/code/inbox/reports/report-id",
- openReport: vi.fn(),
-}));
-
-vi.mock("@posthog/ui/features/feature-flags/useFeatureFlag", () => ({
- useFeatureFlag: () => true,
-}));
-vi.mock("@posthog/ui/features/inbox/hooks/useOpenInboxReport", () => ({
- useOpenInboxReport: () => mocks.openReport,
-}));
-vi.mock("@posthog/ui/features/inbox/components/InboxView", () => ({
- InboxView: () => <div>Inbox content</div>,
-}));
-vi.mock("@posthog/ui/router/routeSkeletons", () => ({
- AppPageSkeleton: () => null,
- withRouteSkeleton: () => ({}),
-}));
-vi.mock("@tanstack/react-router", () => ({
- createFileRoute: () => (options: { component: () => ReactElement }) => ({
- options,
- }),
- useLocation: () => ({ pathname: mocks.pathname }),
- useParams: () => ({ reportId: mocks.reportId }),
-}));
-
-import { Route } from "./inbox";
-
-const InboxRoute = Route.options.component as () => ReactElement;
-
-describe("InboxRoute", () => {
- beforeEach(() => {
- mocks.reportId = "report-id";
- mocks.pathname = "/code/inbox/reports/report-id";
- mocks.openReport.mockClear();
- });
-
- it("keeps Inbox visible while resolving a report without a canvas", () => {
- render(<InboxRoute />);
-
- expect(screen.getByText("Inbox content")).toBeInTheDocument();
- expect(mocks.openReport).toHaveBeenCalledWith("report-id");
- });
-
- it("opens an eligible report once while keeping Inbox mounted", () => {
- const { rerender } = render(<InboxRoute />);
- rerender(<InboxRoute />);
-
- expect(mocks.openReport).toHaveBeenCalledTimes(1);
- expect(screen.getByText("Inbox content")).toBeInTheDocument();
- });
-
- it.each(["pulls", "reports", "dismissed", "runs", "agents"])(
- "keeps the %s list route in Inbox",
- (tab) => {
- mocks.reportId = undefined;
- mocks.pathname = `/code/inbox/${tab}`;
-
- render(<InboxRoute />);
-
- expect(screen.getByText("Inbox content")).toBeInTheDocument();
- expect(mocks.openReport).not.toHaveBeenCalled();
- },
- );
-
- it("does not treat an agent run as a Signal report", () => {
- mocks.pathname = "/code/inbox/runs/report-id";
-
- render(<InboxRoute />);
-
- expect(mocks.openReport).not.toHaveBeenCalled();
- });
-});
diff --git a/products/desktop/packages/ui/src/router/routes/code/inbox.tsx b/products/desktop/packages/ui/src/router/routes/code/inbox.tsx
index 8e0386e9ec04..edd58890d132 100644
--- a/products/desktop/packages/ui/src/router/routes/code/inbox.tsx
+++ b/products/desktop/packages/ui/src/router/routes/code/inbox.tsx
@@ -1,47 +1,11 @@
-import { REPORT_CANVAS_INBOX_FLAG } from "@posthog/shared";
-import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
import { InboxView } from "@posthog/ui/features/inbox/components/InboxView";
-import { useOpenInboxReport } from "@posthog/ui/features/inbox/hooks/useOpenInboxReport";
import {
AppPageSkeleton,
withRouteSkeleton,
} from "@posthog/ui/router/routeSkeletons";
-import {
- createFileRoute,
- useLocation,
- useParams,
-} from "@tanstack/react-router";
-import { type ReactElement, useEffect, useRef } from "react";
+import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/code/inbox")({
- component: InboxRoute,
+ component: InboxView,
...withRouteSkeleton(AppPageSkeleton),
});
-
-function InboxRoute(): ReactElement {
- const reportCanvasesEnabled = useFeatureFlag(
- REPORT_CANVAS_INBOX_FLAG,
- import.meta.env.DEV,
- );
- const { reportId } = useParams({ strict: false });
- const { pathname } = useLocation();
- const openReport = useOpenInboxReport();
- const openedReportId = useRef<string | null>(null);
- const isSignalReportDetail = ["reports", "pulls", "dismissed"].some((tab) =>
- pathname.startsWith(`/code/inbox/${tab}/`),
- );
-
- useEffect(() => {
- if (
- reportCanvasesEnabled &&
- isSignalReportDetail &&
- reportId &&
- openedReportId.current !== reportId
- ) {
- openedReportId.current = reportId;
- void openReport(reportId);
- }
- }, [isSignalReportDetail, openReport, reportCanvasesEnabled, reportId]);
-
- return <InboxView />;
-}