feat(canvas): task-centric activity feed - #3671
Conversation
|
😎 Merged successfully - details. |
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
c6860a2 to
da9575c
Compare
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
|
React Doctor found 2 issues in 2 files · 2 warnings. 2 warnings
Reviewed by React Doctor for commit |
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
Prompt To Fix All With AIFix 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 |
| useEffect(() => { | ||
| if (!taskId || !enabled) return; | ||
| queryClient.invalidateQueries({ queryKey: TASK_ACTIVITY_QUERY_KEY }); | ||
| }, [taskId, enabled, queryClient]); |
There was a problem hiding this 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
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.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
|
✅ Visual changes approved by @k11kirky — baseline updated in 16 changed. |
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
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
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, |
There was a problem hiding this comment.
this permanently caches the feed right? do we want this as such?
Generated-By: PostHog Code Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
Generated-By: PostHog Code Task-Id: 744f81ec-6b8e-420c-960c-541b1932b46c
|
/trunk merge |
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.
SessionServiceSSE watcher, including tasks started inside channels.#prefix.The feature remains behind the existing
project-bluebirdflag and depends on the backend endpoint.How did you test this?
Automated regression coverage verifies:
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
Created with PostHog Code