Skip to content

Rank activity status groups by attention level - #19329

Merged
AmethystLiang merged 5 commits into
mainfrom
working-got-ranked-down
Sep 8, 2026
Merged

AmethystLiang merged 5 commits into
mainfrom
working-got-ranked-down

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​395 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​374
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160 $\color{#cf222e}{\Huge{\mathbf{−}}}$​165 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5

Problem

The activity view's status group ordering relied on array position, which caused attention-needing statuses (waiting, blocked, interrupted) to be buried under newer Done/Working threads. The interrupted status logic was scattered across multiple functions, making it hard to maintain.

Solution

Replaced the array-based group order with a numeric ranking system (ACTIVITY_STATUS_GROUP_RANK) that assigns consistent priorities regardless of thread recency. Centralized the interrupted predicate into activityThreadStatusId() as the single source of truth for status classification. Status group headers now mirror row states to prevent visual disagreement.

What Changed

  • Introduced activityThreadStatusId() in activity-thread-presentation.ts as the single classifier for all status-related logic
  • Replaced ACTIVITY_STATUS_GROUP_ORDER array with ACTIVITY_STATUS_GROUP_RANK Record for deterministic ordering
  • Generalized buildActivityThreadGroups() to rank groups only in status mode
  • Updated group key from 'done:interrupted' to 'interrupted' for clarity
  • Added comprehensive status-order test suite with 5 focused test cases

Visual Proof

N/A — reordering of existing UI elements; no new components or styling changes.

Testing

  • Added activity-thread-grouping.status-order.test.ts with comprehensive ordering tests: verifies attention-needing statuses rank above Done even when newer, confirms fixed group order regardless of recency, validates thread order within groups remains newest-first, tests header state consistency

  • Updated existing tests in ActivityPrototypePage.test.ts and ActivityPrototypePage.thread-grouping.test.ts to match new API

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Rank ordering is applied deterministically in status-grouping mode only. Other grouping modes (project, worktree, agent) preserve thread-recency ordering. No platform-specific logic added.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 2192695e-77d0-416d-b774-b4bd4dcfe7f8

📥 Commits

Reviewing files that changed from the base of the PR and between 69fd8d3 and 4b2e3dd.

📒 Files selected for processing (9)
  • src/renderer/src/components/activity/ActivityPrototypePage.test.ts
  • src/renderer/src/components/activity/activity-event-builder.live-cap.test.ts
  • src/renderer/src/components/activity/activity-event-builder.ts
  • src/renderer/src/components/activity/activity-event-cap.ts
  • src/renderer/src/components/activity/activity-event-state.ts
  • src/renderer/src/components/activity/activity-pane-events.ts
  • src/renderer/src/components/activity/useActivityUnreadCount.freshness.test.tsx
  • src/renderer/src/components/activity/useActivityUnreadCount.test.ts
  • src/renderer/src/components/activity/useActivityUnreadCount.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change centralizes activity thread status classification in activityThreadStatusId. Status grouping now uses explicit ranks, status keys, and matching header states. Live agent state can produce working events, including for cleared and retained activity. Event caching now considers live state. Tests cover status ordering, working events, freshness decay, read receipt reuse, and the updated grouping API.

Merge Risk: ⚪ Minimal · up to 4b2e3

Activity status groups now prioritize attention-needing states and fresh working activity is reflected in threads and unread counts. Monitoring snapshots are excluded from activity events, removing the previously identified misleading monitoring-event presentation risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, scope, visual impact, tests, and compatibility considerations. However, the required Linked Issue entry is empty, and the required validation commands a… Add a valid issue reference after Fixes #. Confirm that pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass, or state that CI will cover them. Complete the manual-testing checkbox if applicable or explain why manual testing …
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: activity status groups are ranked by attention level.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, scope, visual impact, tests, and compatibility considerations. However, the required Linked Issue entry is empty, and the required validation commands are not confirmed as passing or covered by CI.

Resolution

Add a valid issue reference after Fixes #. Confirm that pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass, or state that CI will cover them. Complete the manual-testing checkbox if applicable or explain why manual testing was not performed.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

  • Centralized status classification — activityThreadStatusId() in activity-thread-presentation.ts becomes the single predicate for interrupted detection, with threadAgentState() and threadAgentStateLabel() deriving from it. The interrupted → done glyph mapping (#2569) is preserved.
  • Rank-based group ordering — ACTIVITY_STATUS_GROUP_RANK replaces the old order array, and buildActivityThreadGroups() now sorts status-mode groups deterministically rather than relying on thread recency. Relative ordering for reachable states matches the prior array (waiting < blocked < interrupted < working < monitoring < done).
  • Header/row state agreement — getActivityThreadGroup() status branch now emits state: threadAgentState(thread), so status group headers mirror their row dots (previously headers in status mode never carried a state).
  • Cleanup — dead groupActivityThreadsByStatus(), threadStatusGroupId(), ActivityStatusGroupId, and the id/done:interrupted key are removed; isClearableActivityThread now uses the shared classifier with unchanged semantics.

Verified with no dangling references to any removed symbol, and ran the affected suites (47 tests across 4 files, all green) plus check:code-quality:changed.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang force-pushed the working-got-ranked-down branch from aa447e2 to 69fd8d3 Compare September 7, 2026 21:54

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 1fe97971-2f96-4822-afbf-a3a3ff5f2f22

📥 Commits

Reviewing files that changed from the base of the PR and between aa447e2 and 69fd8d3.

📒 Files selected for processing (8)
  • src/renderer/src/components/activity/ActivityPrototypePage.test.ts
  • src/renderer/src/components/activity/activity-event-build-cache.ts
  • src/renderer/src/components/activity/activity-event-builder.bounded-history.test.ts
  • src/renderer/src/components/activity/activity-event-builder.identity-reuse.test.ts
  • src/renderer/src/components/activity/activity-event-builder.ts
  • src/renderer/src/components/activity/activity-pane-events.ts
  • src/renderer/src/components/activity/activity-thread-presentation.ts
  • src/renderer/src/components/activity/activity-thread-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

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.

Important

Monitoring/background agents (workingMode: 'monitoring') now emit a working activity event — see the inline comment on activity-pane-events.ts:106. This re-introduces the row/header disagreement the PR is otherwise removing and should be fixed before merge.

Reviewed changes

  • Emit working events for fresh live turns — ActivityEventState was widened to the full AgentStatusState union and a liveState input was threaded through buildPaneActivityEvents/resolvePaneBuild so a fresh live working turn now produces a feed event with working read receipts.
  • isHistoricalActivityState replaces isActivityEventState — history reconstruction stays bounded to done/blocked/waiting, so working liveness is established only from the current entry rather than from history.
  • Cache liveness guard — resolvePaneBuild now compares request.liveState and stateStartedAt (liveMatchesCache) so live-state transitions rebuild events instead of serving stale cached ones.
  • Working branches in presentation helpers — agentTitle/agentSummary/agentMeta gained working branches (search-text surface only).
  • Tests — added identity-reuse and bounded-history coverage for working-event read receipts and live-turn event counts.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Establishes consistent group ordering by introducing an attention-based ranking system, ensuring status groups maintain a fixed order regardless of thread recency. Consolidates thread status classification logic into `activityThreadStatusId` and simplifies group key naming.
Activity events now emit working state for current turns,
enabling attention ranking above historical states.
- Remove working-state events from cap logic so live turns stay visible
- Count fresh working/monitoring as unread in Activity badge
- Extract state-checking to activity-event-state module
- Use agentStatusEpoch for freshness-based invalidation
The unread receipt is keyed on turn boundaries (stateStartedAt), not
heartbeats (updatedAt). Only the epoch matters; read the status map
directly via getState() to avoid wasteful re-renders on same-turn
heartbeats.
Monitoring turns should surface only via the 'monitoring' snapshot in
the live state, not as separate working events that would contradict
the snapshot signal.
@AmethystLiang
AmethystLiang force-pushed the working-got-ranked-down branch from 69fd8d3 to 4b2e3dd Compare September 8, 2026 02:58

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

  • Monitoring turns no longer emit a working event — buildPaneActivityEvents now keys the live branch on args.liveState === 'working' rather than !== null, so background/monitoring turns surface only through their 'monitoring' snapshot. The prior row/header-disagreement finding is resolved and pinned by a regression assertion (expect(result.events).toHaveLength(0) for a monitoring turn).
  • Fresh working/monitoring turns count as unread — countActivityUnread now counts fresh live turns alongside historical done/blocked/waiting, with receipts keyed on stateStartedAt and freshness decay delegated to the shared freshActivityLiveAgentState.
  • Titlebar badge subscribes to agentStatusEpoch — the hook swapped sortEpoch for agentStatusEpoch, the signal the live reducer and freshness scheduler actually bump for the count's invalidation needs; a real-slice freshness test covers same-turn heartbeats, stale-boundary decay, and revive.
  • Working events bypass the history caps — capActivityEvents filters working events out of the per-pane/global caps before re-sorting them back in, so live turns never evict retained done/blocked/waiting history.
  • Extracted activity-event-state.ts — freshActivityLiveAgentState and isHistoricalActivityState are consolidated into a shared module used by the builder, pane-events, and unread count.

Verified the 8 changed/added test files locally (55 tests, all green).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang merged commit ba5f708 into main Sep 8, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant