mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 06:03:51 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The sidebar includes a Recents list that mixes recent tasks, agent chats, and projects. > - Opening an existing task or project from Recents currently writes `Date.now()` as its timestamp and jumps that item to the top. > - That breaks spatial stability when a person clicks through items in Recents, because every click re-sorts the list. > - This pull request stops passive opens and clicks from changing an existing item's recency timestamp, seeds unseen items from their latest activity timestamp, and records explicit user activity when a person takes action on a task. > - The benefit is a predictable Recents list that orders items by recent activity without shifting on click. ## Linked Issues or Issue Description **What happened?** When a person clicked an existing task or project in the sidebar Recents list, opening that item stamped it with `Date.now()` and moved it to the top of Recents. Clicking through several recent items constantly re-sorted the sidebar. **Expected behavior** Recents sorts items with the most recent activity at the top, and clicking or passively opening an existing item keeps the list order unchanged. Only real activity (such as creating, editing, commenting, approving/rejecting, or responding to an interaction on a task, or server-side updates on chats and projects) moves an item to the top. **Steps to reproduce** 1. Open the Coordinator workspace with at least two tasks or projects in the sidebar Recents list. 2. Click an older item lower in Recents. 3. Observe that the clicked item jumps to the top of Recents even though no activity occurred. **Paperclip version or commit** Reproduced on `master` (`b63445c8f1`). **Deployment mode** Local dev (source checkout). Related PRs: #22219, #22024. ## What Changed - Updated `recordRecentTask` in `ui/src/lib/recent-tasks.ts` so passive opens never change an existing entry's `recordedAt`, and unseen passive opens seed chronologically from `lastActivityAt` or `updatedAt` (falling back below existing history when no valid timestamp exists). - Removed visit-time `Date.now()` bumping in `ui/src/pages/IssueDetail.tsx` and centralized explicit local activity updates (`recordLocalTaskActivity`) across task edits, comments, approvals (captured at mutation start), interaction responses, and isolated re-issues for both Streamlined and Coordinator modes. - Enabled immediate recent-task recording on task creation in `ui/src/components/NewIssueDialog.tsx` when Coordinator mode is enabled (previously gated only on Streamlined mode). - Extracted `recordProjectRecentVisit` and `buildCoordinatorRecents` in `ui/src/components/CoordinatorSidebar.tsx` so revisiting a project keeps its existing entry unchanged, unseen projects seed from `project.updatedAt`, real project updates advance its sort time via `Math.max`, and memo inputs remain referentially stable. - Updated `DESIGN.md` and `doc/PRODUCT.md` to document activity-based Recents ordering without click-driven re-sorting. - Added and updated unit and component tests in `ui/src/lib/recent-tasks.test.ts`, `ui/src/components/CoordinatorSidebar.recents.test.ts` (including a linear-scan read-budget check across 450 items), and `ui/src/pages/IssueDetail.mobile.test.tsx`. ## Verification Tested on rebased commit `79f028344b56ec41092ad458b956c3fd02be0fe0`: - `pnpm --filter @paperclipai/ui typecheck` — passed (0 errors). - `pnpm --filter @paperclipai/ui exec vitest run src/lib/recent-tasks.test.ts src/hooks/useRecentTasks.test.tsx src/hooks/useRecentTaskOpenWarmup.test.tsx src/components/CoordinatorSidebar.recents.test.ts src/pages/IssueDetail.mobile.test.tsx` — passed (5 files, 68 tests). - `pnpm check:token-gates` — passed (all 4 token gates clean). - Broad typecheck, build, and full test coverage will be verified by GitHub CI on this PR. ## Risks - Low risk. Changes are scoped to client-side Recents ordering, state recording, and documentation. No database migrations, API schema changes, or permission changes. - Users who relied on clicking an old task solely to pin it at the top of Recents can use the existing sidebar pin control or take action on the task. ## Model Used - Antigravity (Google DeepMind agentic assistant) with code inspection, file editing, shell execution, Vitest, TypeScript, and GitHub CLI tools. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>