Skip to content

feat: add agent activity feed functionality - #356

Merged
pikann merged 3 commits into
masterfrom
feature/add-agent-activity-feed-functionality
Aug 4, 2026
Merged

feat: add agent activity feed functionality#356
pikann merged 3 commits into
masterfrom
feature/add-agent-activity-feed-functionality

Conversation

@pikann

@pikann pikann commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an "Activity" tab to the agent detail page: a unified, cursor-paginated, filterable feed of every task and doc activity a given agent has performed across the project, styled like a log viewer with infinite scroll.

Backend

  • New GET /projects/:projectId/agents/:agentId/activities endpoint (services/api/internal/transport/http/handler/agent_handler.go) resolves the agent's project_members.id via memberRepo.FindMemberByAgent, then lists a keyset-paginated (created_at, id) page combining task_activities and doc_activities, filterable by type (task/doc), created_after/created_before, and free-text search (matches the linked task/doc title or activity content).
  • AgentRepository.ListAgentActivities (services/api/internal/repository/postgres/agent_repository.go) implements this with a single UNION ALL CTE over both tables joined to tasks/documents for the display title, mirroring the existing conversations cursor-pagination pattern.
  • New domain types/cursor in domain/agent/activity_feed.go and cursor.go; new AgentActivityResponse DTO; new AGENT_ACTIVITY_INVALID_CURSOR error code.
  • Migration 000030_add_activity_actor_cursor_indexes.sql adds composite (actor_id, created_at DESC, id DESC) indexes on both activity tables (doc_activities previously had no actor index at all).

Frontend

  • New AgentActivityTab / AgentActivityFilters components, modeled on the existing Conversations page's IntersectionObserver-driven infinite scroll and filter popover.
  • New agentActivitiesQueryOptions cursor-paginated query in agent-api.ts, keyed separately from the "agents" prefix so realtime invalidation can target every agent's feed without over-invalidating other agent caches.
  • Exported and lightly narrowed the existing activityDescription/describeDocActivity renderers so the new tab reuses the same activity copy instead of duplicating it.
  • Wired a new "Activity" tab into the agent detail page; wired task.*/doc.* realtime events to invalidate the activity feed.
  • Translated into all 9 locales (en, es, fr, ja, ko, pt-BR, ru, vi, zh-CN).

Test plan

  • go build ./..., go vet ./..., and go test ./... in services/api — new coverage for the query mapping, service passthrough, and every handler branch (missing member repo, wrong project, member not found, invalid type filter, success).
  • golangci-lint run ./... in services/api — clean.
  • tsc -b, biome check ., and vitest run in apps/web — all clean (345 tests passing).
  • Manually verified against the running dev stack: confirmed the new indexes applied to the live DB, and exercised the live endpoint end-to-end (base fetch, type filter, invalid type → 400, search hit/miss, date filter, malformed cursor → 400).

- Introduced a new activity feed feature for agents, allowing users to view activities related to tasks and documents.
- Added localization support for activity feed in Chinese (zh-CN).
- Implemented backend logic for listing agent activities, including pagination and filtering options.
- Created necessary database structures and indexes to support efficient querying of activity data.
- Updated API endpoints to handle requests for agent activities, including validation and error handling.
- Enhanced frontend components to display the activity feed within the agent detail view.

@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

This PR adds the agent activity feed feature end-to-end: a new "Activity" tab on the agent detail page, a backend GET /projects/:projectId/agents/:agentId/activities endpoint, and supporting database indexes. The key changes:

  • Frontend UIagent-activity-tab.tsx (infinite-scrolling feed, row links) and agent-activity-filters.tsx (search, source-type checkboxes, date-range popovers).
  • Data layer — new AgentActivity* types, agentActivitiesQueryOptions, and localDateStartISO/localDateExclusiveEndISO date conversion in agent-api.ts.
  • Cache invalidationuse-project-realtime.ts targets the agentActivities query-key prefix on task.*/doc.* events.
  • Copy reuseactivityDescription and describeDocActivity are exported and narrowed to the fields the new feed actually needs.
  • i18n — new agents.detail.activity.* keys added to all eight locale files.
  • Backend API — cursor codec, domain/repository/service methods, DTO, handler validation, error mapping, and route wiring.
  • Database — migration 000030 replaces the single-column idx_task_activities_actor_id with partial composite indexes (actor_id, created_at DESC, id DESC).

ℹ️ Deployment note

000030 drops the old idx_task_activities_actor_id and creates a partial composite index on each activity table. The CREATE INDEX IF NOT EXISTS statements are idempotent, but on a very large task_activities/doc_activities table index creation can lock while it builds. Plan deploy sequencing accordingly for high-traffic tables.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@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

This run covered the two commits since the last pullfrog review (3cbb6a38). The latest changes harden the activity feed around deleted sources and member/sprint name resolution:

  • Deleted-source handling — added a source_deleted boolean to the backend ActivityFeedItem, repository CTE, response DTO, and frontend AgentActivity type. The backend now computes (t|d).deleted_at IS NOT NULL in each UNION branch; the UI renders deleted task/document titles as plain text instead of links.
  • Member/sprint name resolutionAgentActivityTab now loads projectMembersQueryOptions and sprintsQueryOptions once per project and passes a memoized {members, sprints} lookup map into the shared activityDescription helper, so task activity copy shows names instead of truncated IDs.
  • Frontend tests — added agent-activity-filters.test.tsx (search debounce, type toggle, clear-all) and agent-activity-tab.test.tsx (name resolution, fallback IDs, deleted source).
  • Backend tests — added TestActivityFeedItemFromRecord_PreservesSourceDeleted and updated existing mapping assertions to cover the new field.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@pikann
pikann merged commit f601092 into master Aug 4, 2026
6 checks passed
@pikann
pikann deleted the feature/add-agent-activity-feed-functionality branch August 4, 2026 09:54
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