feat(sidebar): surface unread tasks with an exclamation icon#2682
Open
MattPua wants to merge 2 commits into
Open
feat(sidebar): surface unread tasks with an exclamation icon#2682MattPua wants to merge 2 commits into
MattPua wants to merge 2 commits into
Conversation
When an agent finished a task, the cloud/PR status icon hid the unread signal, so it wasn't clear which finished tasks still needed attention. Promote the unread state above the cloud/PR/diff/suspended icons in TaskIcon and render it as an amber WarningCircle exclamation. Opening the task clears `isUnread` (via the existing markAsViewed flow), so the normal status icon returns automatically — i.e. it's marked read on view. Live states (generating, needs-permission) still take precedence. Shared by the sidebar task list, command palette, and canvas channel list, which all render through TaskIcon. Generated-By: PostHog Code Task-Id: 524c2fa0-2175-4cbc-bf2e-ab68ef366fae
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "fix(sidebar): surface unread tasks with ..." | Re-trigger Greptile |
The imperative markActivity/markViewed writes persisted timestamps to the backend but never updated the react-query cache, so the sidebar's getAllTaskTimestamps query (staleTime 30s) kept computing isUnread=false until a later focus/reconnect refetch. Invalidate that query after the mutation so the unread exclamation appears the moment a task finishes, even when it isn't open. Generated-By: PostHog Code Task-Id: 2347fc39-cc4b-4c29-b9db-70e39074d83a
3d1c63b to
c0fff88
Compare
Contributor
|
Reviews (2): Last reviewed commit: "fix(sidebar): refresh unread state when ..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
lastViewedAt/lastActivityAt,markActivityon turn-complete,markAsViewedon open) but didn't surface:TaskIcon, unread sat below cloud/PR icons → on finish, cloud/PR icon won, unread never showedgetAllTaskTimestamps, staleTime 30s) →isUnreadstuck false until next focus/reconnect refetchChange
CleanShot.2026-06-15.at.14.04.48.mp4
TaskIcon, render as amberWarningCircle❗ ("Unread — new activity")markActivity/markViewednow invalidate timestamps query after mutate → unread shows instant on off-screen completionmarkAsViewedclearsisUnread→ normal status icon returns (marked read on view)TaskIcon) → consistent everywhereActivity → read/unread lifecycle
markActivityonly fires for a live session (local agent, or cloud while watched). Unwatched-cloud completion has nomarkActivity— it rides serverupdated_at+ the 30s task-list poll instead.stateDiagram-v2 [*] --> Unviewed Unviewed --> Read: markAsViewed (open) Read --> Unread: markActivity (local / watched-cloud finish) Read --> Unread: server updated_at + poll (unwatched cloud, ≤30s) Unread --> Read: markAsViewed (open) note right of Unread markActivity path: invalidate timestamps query → sidebar recomputes isUnread instantly end noteTaskIcon priority (after)
flowchart TD A[task state] --> B{needsPermission?} B -->|yes| P[HandPalm] B -->|no| C{isGenerating?} C -->|yes| G[spinner] C -->|no| D{isUnread?} D -->|yes| U["amber WarningCircle ❗"] D -->|no| E{terminal cloud?} E -->|yes| CL[cloud status] E -->|no| F{isSuspended?} F -->|yes| S[Pause] F -->|no| H{PR / diff?} H -->|yes| PR[PR / branch] H -->|no| Z[pinned / Slack / chat]Note
isUnreadonly true once viewed at least once (lastViewedAt != null) → tasks never opened (e.g. Slack) won't flag til first open. Lower-noise default; easy to flip.Testing
biome lintclean on changed filesdistbuild-order noise, unrelatedCreated with PostHog Code