Skip to content

feat(canvas): task-centric activity feed - #3671

Merged
trunk-io[bot] merged 17 commits into
mainfrom
posthog-code/task-activity-feed
Jul 27, 2026
Merged

feat(canvas): task-centric activity feed#3671
trunk-io[bot] merged 17 commits into
mainfrom
posthog-code/task-activity-feed

Conversation

@raquelmsmith

@raquelmsmith raquelmsmith commented Jul 22, 2026

Copy link
Copy Markdown
Member

Problem

Channels needs one Activity view for tasks that require attention. The unread badge and list must update when an agent finishes or requests permission, regardless of whether the task started from the new-task page or a channel.

Opening a channel must not mark its visible task previews read. Opening the specific task or thread should clear only that task while keeping the activity row in the list.

Changes

Adds a task-centric Activity view backed by the companion endpoint in PostHog/posthog #72793.

  • Shows one row per task with completed, awaiting-input, reply, mention, and creation activity.
  • Displays unread rows and the aggregate unread count in the Activity navigation item.
  • Loads the full feed with cursor pagination.
  • Registers newly created cloud runs with the existing SessionService SSE watcher, including tasks started inside channels.
  • Projects completion and permission events into the activity cache immediately, using the same typed notification events that drive toasts.
  • Removes activity polling and keeps cross-feature coordination in a boot contribution rather than React effects.
  • Marks only the opened task read. Channel feed previews remain read-only, and opening a task from its card, thread, or Activity marks that task.
  • Keeps read rows in the Activity list and protects newer events with per-task read timestamps.
  • Uses agent attribution for agent activity and formats personal and named channels with a # prefix.

The feature remains behind the existing project-bluebird flag and depends on the backend endpoint.

How did you test this?

Automated regression coverage verifies:

  • channel-created cloud tasks attach to the existing event stream
  • normal and warm-created cloud runs are watched before they are surfaced
  • completion and permission events immediately create unread activity
  • thread previews do not mark activity read
  • opening a task clears only that task
  • read activity remains visible
  • newer activity is not cleared by an older marker
  • pagination loads every page

Ran focused Vitest suites, Biome, package typechecks, the full 20-package monorepo typecheck, and host-boundary checks. CI unit and integration tests pass.

Manual testing by the human reviewer covered channel-created tasks, toasts, permission and completion activity, unread badges, channel navigation, and opening tasks through both Activity and channel cards.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

@trunk-io

trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

k11kirky added 2 commits July 26, 2026 06:56
Reworks the Channels Activity view from a raw @-mentions list into a
task-centric feed: one row per task the user is involved in — created,
@-mentioned in, or messaged in — newest activity first, backed by the new
`/task_activity/` endpoint.

Rows read per activity kind: "… is waiting for your reply" (agent turn
awaiting input), "You replied", "… mentioned you", or "You created this task",
each with a snippet where one applies. The sidebar badge counts tasks with
activity newer than the last visit. The prior mentions plumbing
(`useMentionActivity` / `mentionActivity`) stays in place — it still powers
per-channel unread state.

Why: users want the Activity view to surface all activity involving them —
especially tasks an agent updated and is waiting on them for — not just mentions.

Generated-By: PostHog Code
Task-Id: c10b01e4-4645-4c82-98b2-610b533f7f7c
Generated-By: PostHog Code
Task-Id: c4f5025f-8edf-40d4-a163-7174899045d1
@k11kirky
k11kirky force-pushed the posthog-code/task-activity-feed branch from c6860a2 to da9575c Compare July 26, 2026 05:56
Landing on the Activity page marked everything read, so anything that arrived
while it was open was dismissed unseen. Rows now clear when they are opened, and
markTaskActivityRead names the tasks rather than sweeping the whole feed.

Read state is per task on the server, so reaching a task any other way clears the
same row. useTaskThread pulls the feed back in when a thread loads, which keeps
the sidebar badge honest without waiting out its poll.

The unread dot reads is_unread straight off the row instead of comparing against
a snapshot of the last visit.


Generated-By: PostHog Code
Task-Id: 35a47457-b411-4d4b-80a5-ad06e2e6b1e5
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown

React Doctor found 2 issues in 2 files · 2 warnings.

2 warnings

src/features/canvas/components/ActivityView.tsx

src/features/canvas/components/ChannelFeedView.test.tsx

Reviewed by React Doctor for commit 3f9d947.

SidebarNavSection.test.tsx still stubbed useMentionActivity and
activitySeenStore. ActivityItem moved to useTaskActivity, so the real hook ran,
reached for a TRPC client with no provider mounted, and took all 10 render cases
down with "useTRPCClient() can only be used inside of a <TRPCProvider>".


Generated-By: PostHog Code
Task-Id: 35a47457-b411-4d4b-80a5-ad06e2e6b1e5
@k11kirky
k11kirky marked this pull request as ready for review July 26, 2026 09:10
@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/ui/src/features/canvas/hooks/useTaskThread.ts:40-43
**Thread refresh races read clearing**

When an unread task is opened, this effect refetches task activity concurrently with the thread request instead of after that request clears the server-side read state. The activity request can therefore cache the old `is_unread` and `unread_count` values, leaving the row and sidebar badge unread until the next 60-second poll.

Reviews (1): Last reviewed commit: "fix(sidebar): mock the hook ActivityItem..." | Re-trigger Greptile

Comment on lines +40 to +43
useEffect(() => {
if (!taskId || !enabled) return;
queryClient.invalidateQueries({ queryKey: TASK_ACTIVITY_QUERY_KEY });
}, [taskId, enabled, queryClient]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Thread refresh races read clearing

When an unread task is opened, this effect refetches task activity concurrently with the thread request instead of after that request clears the server-side read state. The activity request can therefore cache the old is_unread and unread_count values, leaving the row and sidebar badge unread until the next 60-second poll.

Knowledge Base Used: @posthog/ui shared UI package

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/features/canvas/hooks/useTaskThread.ts
Line: 40-43

Comment:
**Thread refresh races read clearing**

When an unread task is opened, this effect refetches task activity concurrently with the thread request instead of after that request clears the server-side read state. The activity request can therefore cache the old `is_unread` and `unread_count` values, leaving the row and sidebar badge unread until the next 60-second poll.

**Knowledge Base Used:** [`@posthog/ui` shared UI package](https://app.greptile.com/posthog-org-19734/-/custom-context/knowledge-base/posthog/code/-/docs/ui-package.md)

How can I resolve this? If you propose a fix, please make it concise.

k11kirky added 3 commits July 26, 2026 09:55
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
@posthog

posthog Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Visual changes approved by @k11kirky — baseline updated in dd399a1.

View this run in PostHog

16 changed.

k11kirky added 5 commits July 27, 2026 11:35
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
@veria-ai

veria-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

k11kirky and others added 3 commits July 27, 2026 12:44
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
16 updated
Run: 4d0ffcf3-2279-486b-b574-6e1e35cef15c

Co-authored-by: k11kirky <4571455+k11kirky@users.noreply.github.com>
? { before: page.next_before, beforeId: page.next_before_id }
: undefined,
enabled: !!client && (options?.enabled ?? true),
staleTime: Number.POSITIVE_INFINITY,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this permanently caches the feed right? do we want this as such?

k11kirky added 2 commits July 27, 2026 14:26
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code
Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
@k11kirky k11kirky added the Create Release This will trigger a new release label Jul 27, 2026
@k11kirky

Copy link
Copy Markdown
Contributor

/trunk merge

@trunk-io
trunk-io Bot merged commit 113eae9 into main Jul 27, 2026
40 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/task-activity-feed branch July 27, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create Release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants