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.

fix(desktop): match canvas presence avatars to sessions (#96242)

Peter Kirkhamb1c979b47cf6
diff --git a/products/desktop/docs/CONVENTIONS.md b/products/desktop/docs/CONVENTIONS.md
index 41175e769147..e8ab9b7b1cd6 100644
--- a/products/desktop/docs/CONVENTIONS.md
+++ b/products/desktop/docs/CONVENTIONS.md
@@ -19,6 +19,8 @@ Hooks wrap one source: one query, one mutation, one subscription, or one store s
## Components
+Use `PresenceAvatars` to show presence in a space.
+
Use functional components and typed props.
```ts
diff --git a/products/desktop/packages/core/src/canvas/channelItems.test.ts b/products/desktop/packages/core/src/canvas/channelItems.test.ts
index e4f85174ad4a..65a0fbbacd1a 100644
--- a/products/desktop/packages/core/src/canvas/channelItems.test.ts
+++ b/products/desktop/packages/core/src/canvas/channelItems.test.ts
@@ -72,12 +72,13 @@ function build(options: Partial<Parameters<typeof buildChannelItems>[0]> = {}) {
describe("buildChannelItems", () => {
it("merges canvases and tasks newest-first", () => {
const items = build({
- dashboards: [canvas({ id: "old", updatedAt: 1_000 })],
+ dashboards: [canvas({ id: "old", updatedAt: 1_000, createdByUser: ME })],
feedTasks: [
task({ id: "new", updated_at: new Date(5_000).toISOString() }),
],
});
expect(items.map((i) => i.key)).toEqual(["task:new", "canvas:old"]);
+ expect(items.map((item) => item.authorUser)).toEqual([ME, ME]);
});
it("drops archived tasks but keeps canvases", () => {
diff --git a/products/desktop/packages/core/src/canvas/channelItems.ts b/products/desktop/packages/core/src/canvas/channelItems.ts
index c42ca6562ffb..d86500fae57c 100644
--- a/products/desktop/packages/core/src/canvas/channelItems.ts
+++ b/products/desktop/packages/core/src/canvas/channelItems.ts
@@ -12,7 +12,7 @@ import type {
import { isTaskUnread, type TaskTimestamp } from "../sidebar/buildSidebarData";
import { getRepositoryInfo, repositoryLabel } from "../sidebar/groupTasks";
import { taskActivityAt, taskActivityTimestamp } from "../tasks/taskActivity";
-import type { DashboardRecord } from "./dashboardSchemas";
+import type { CanvasCreator, DashboardRecord } from "./dashboardSchemas";
/** Where a session runs. `worktree` is a local checkout, so it reads as local. */
export type ChannelItemEnvironment = "local" | "cloud";
@@ -49,7 +49,7 @@ export interface ChannelItemModel {
repository: ChannelItemRepository | null;
/** The branch its work is on, from the local checkout or the run. */
branch: string | null;
- authorUser: UserBasic | null;
+ authorUser: UserBasic | CanvasCreator | null;
authorName: string | null;
authorUuid: string | null;
templateId: string | null;
@@ -174,7 +174,7 @@ export function buildChannelItems({
source: null,
needsInput: false,
unread: false,
- authorUser: null,
+ authorUser: d.createdByUser ?? null,
authorName: d.createdBy ?? null,
authorUuid: d.createdByUuid ?? null,
templateId: d.templateId,
diff --git a/products/desktop/packages/core/src/canvas/dashboardSchemas.ts b/products/desktop/packages/core/src/canvas/dashboardSchemas.ts
index 266def62975a..e46a6fca4280 100644
--- a/products/desktop/packages/core/src/canvas/dashboardSchemas.ts
+++ b/products/desktop/packages/core/src/canvas/dashboardSchemas.ts
@@ -6,6 +6,15 @@ import { z } from "zod";
import { canvasAgentRequestInputSchema } from "./freeformSchemas";
import { componentMetaSchema } from "./gridLayoutSchemas";
+export const canvasCreatorSchema = z.object({
+ id: z.number().optional(),
+ uuid: z.string(),
+ first_name: z.string().nullish(),
+ last_name: z.string().nullish(),
+ email: z.string().nullish(),
+});
+export type CanvasCreator = z.infer<typeof canvasCreatorSchema>;
+
// A canvas record from the PostHog canvases API, normalized to camelCase and
// epoch-ms timestamps. Source code and version history are NOT part of the
// record — they live behind the source/versions endpoints, and the rendered
@@ -32,6 +41,7 @@ export const dashboardRecordSchema = z.object({
// Display name of the creator (from the backend's created_by user).
createdBy: z.string().optional(),
createdByUuid: z.string().optional(),
+ createdByUser: canvasCreatorSchema.optional(),
createdAt: z.number(),
updatedAt: z.number(),
// Epoch ms the canvas was pinned to its channel; absent = not pinned.
diff --git a/products/desktop/packages/core/src/canvas/dashboardsService.test.ts b/products/desktop/packages/core/src/canvas/dashboardsService.test.ts
index 75ffb40537f3..34dbee30bc63 100644
--- a/products/desktop/packages/core/src/canvas/dashboardsService.test.ts
+++ b/products/desktop/packages/core/src/canvas/dashboardsService.test.ts
@@ -14,7 +14,12 @@ function apiCanvas(overrides: Record<string, unknown> = {}) {
pinned_at: null,
current_version_id: "v1",
published_build_id: null,
- created_by: { first_name: "Ada", last_name: "L", email: "[email protected]" },
+ created_by: {
+ uuid: "ada-uuid",
+ first_name: "Ada",
+ last_name: "L",
+ email: "[email protected]",
+ },
created_at: "2026-07-01T00:00:00Z",
updated_at: "2026-07-02T00:00:00Z",
...overrides,
@@ -68,6 +73,7 @@ describe("DashboardsService.list", () => {
channelId: "chan-1",
name: "Revenue board",
createdBy: "Ada L",
+ createdByUser: apiCanvas().created_by,
currentVersionId: "v1",
});
expect(rows[0].createdAt).toBe(Date.parse("2026-07-01T00:00:00Z"));
diff --git a/products/desktop/packages/core/src/canvas/dashboardsService.ts b/products/desktop/packages/core/src/canvas/dashboardsService.ts
index 48be0743074c..54eb05e82f72 100644
--- a/products/desktop/packages/core/src/canvas/dashboardsService.ts
+++ b/products/desktop/packages/core/src/canvas/dashboardsService.ts
@@ -8,6 +8,7 @@ import {
import type {
CanvasActionDefinition,
CanvasActionResult,
+ CanvasCreator,
CanvasDraft,
CanvasSource,
CanvasSourceProject,
@@ -47,12 +48,7 @@ interface ApiCanvas {
pinned_at: string | null;
current_version_id: string | null;
published_build_id: string | null;
- created_by?: {
- uuid: string;
- first_name?: string | null;
- last_name?: string | null;
- email?: string | null;
- } | null;
+ created_by?: CanvasCreator | null;
created_at: string;
updated_at: string;
}
@@ -106,6 +102,7 @@ function toRecord(api: ApiCanvas): DashboardRecord {
generationTaskId: api.generation_task_id,
createdBy: creatorLabel(api.created_by),
createdByUuid: api.created_by?.uuid,
+ createdByUser: api.created_by ?? undefined,
createdAt: toEpoch(api.created_at) ?? 0,
updatedAt: toEpoch(api.updated_at) ?? 0,
pinnedAt: toEpoch(api.pinned_at),
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.test.tsx
index 6d49df4d8508..f4906c4bca38 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.test.tsx
@@ -360,12 +360,16 @@ describe("ChannelItemRow", () => {
});
it.each([
- ["the signed-in user", "u-1", "You were here recently"],
- ["another user", "u-2", "Ada Lovelace was here recently"],
- ])("labels recent presence for %s", (_case, uuid, label) => {
+ ["task", "u-1", "You were here recently"],
+ ["task", "u-2", "Ada Lovelace was here recently"],
+ ["canvas", "u-1", "You were here recently"],
+ ["canvas", "u-2", "Ada Lovelace was here recently"],
+ ] as const)("labels recent %s presence for %s", (kind, uuid, label) => {
renderRow(
item({
+ kind,
ts: Date.now() - 5 * 60_000,
+ authorUuid: uuid,
authorUser: {
id: 1,
uuid,
@@ -376,7 +380,9 @@ describe("ChannelItemRow", () => {
}),
);
- expect(screen.getByRole("img", { name: label })).not.toBeNull();
+ expect(screen.getByRole("img", { name: label }).textContent).toContain(
+ "AL",
+ );
});
// A pinned row offering only `move` resolves against the Command Center's
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.tsx
index 86bd83bb2b95..bf8ad4930b04 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelItemRow.tsx
@@ -155,12 +155,10 @@ function CanvasBadgeStack({
function rowAuthor(
item: ChannelItemModel,
): { user: AvatarPerson; label: string } | null {
- if (item.kind === "task") {
- if (!item.authorUser) return null;
+ if (item.authorUser) {
return { user: item.authorUser, label: userDisplayName(item.authorUser) };
}
- // A canvas carries only a display name and uuid — no email or photo — so its
- // face is an initials bubble seeded off the uuid.
+ if (item.kind === "task") return null;
const name = item.authorName;
if (!name && !item.authorUuid) return null;
const [first, ...rest] = (name ?? "").split(/\s+/).filter(Boolean);