Skip to content

feat(monitoring): redesign monitoring page — overview cards, Top Agents/Automations, Threads tab#2953

Merged
viktormarinho merged 35 commits into
mainfrom
rafavalls/monitoring-redesign
Mar 31, 2026
Merged

feat(monitoring): redesign monitoring page — overview cards, Top Agents/Automations, Threads tab#2953
viktormarinho merged 35 commits into
mainfrom
rafavalls/monitoring-redesign

Conversation

@rafavalls
Copy link
Copy Markdown
Collaborator

@rafavalls rafavalls commented Mar 30, 2026

What is this contribution about?

Redesigns the monitoring page with a new card-based layout matching Figma specs. Introduces top-level overview stats cards, replaces Top Connections/Tools leaderboards with Top Agents and Top Automations, adds a Threads tab with search/filter/conversation view, and makes Agent Sessions and Automation Runs follow the same pattern as Tool Calls. Clickable rows navigate to detail views.

Screenshots/Demonstration

UI changes — screenshots recommended.

How to Test

  1. Navigate to any org's monitoring page
  2. Verify overview cards display stats (tool calls, agent sessions, automation runs, AI usage)
  3. Check Top Agents and Top Automations leaderboard cards
  4. Switch to the Threads tab and verify search, filters (status/agent/user/model), and conversation view work
  5. Click leaderboard rows and verify navigation to filtered views

Migration Notes

N/A

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Redesigned the Monitoring page with Figma‑aligned overview cards and a new Threads tab to browse agent/model/user activity, usage, and read‑only conversations. Unified Audit/Threads UX (click row → slide‑over) and upgraded charts; stats interval now accepts flexible strings like 5m or 2h.

  • New Features

    • Overview: Tool Calls (full width), Latency + Errors (half width), and an AI Usage section with model leaderboards; header adds Live indicator and inline tabs/controls.
    • Top Agents and Top Automations cards with clickable rows and “See all” links to Threads/Audit.
    • Threads tab: paginated list, debounced search, filters (status/agent/user/model), time range; token usage/model aggregated from logs; slide‑over conversation viewer.
    • Thread APIs: added startDate, endDate, search, status, agentId; router/query keys for the threads tab.
    • Charts: area/stacked variants with improved axes/grid/tooltips.
  • Refactors & Bug Fixes

    • Unified table UX: removed inline expand; click row opens details; consistent row sizing; Select/TimeRangePicker triggers standardized to 32px.
    • Layout: constrained Audit/Threads width, tightened header/content spacing, moved search into the page body for consistency.
    • Threads: fixed ISO date filtering; infinite pagination for messages and model logs; resolved chat context error via useOptionalChatStream; hide headers while loading; limit agent/user filters to single‑select to match backend.
    • Leaderboards: corrected percentage calculations; connection/tool rows navigate to detail pages.
    • Schema/Data: restored Thread.run_config to z.record; removed stale agent_ids in favor of virtual_mcp_id.
    • Docs/Cleanup: added local Postgres querying steps to AGENTS.md; removed unused analytics/home components and dead code; un‑exported internal helpers; removed duplicate typescript in apps/docs; reconciled bun.lock.

Written for commit 47c620d. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 30, 2026

Release Options

Suggested: Minor (2.228.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.227.1-alpha.1
🎉 Patch 2.227.1
❤️ Minor 2.228.0
🚀 Major 3.0.0

Current version: 2.227.0

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 26 files

rafavalls and others added 27 commits March 31, 2026 10:09
…igma

Update Card component to remove default hover and lighten title weight.
Rebuild monitoring overview with MonitoringMetricCard pattern: Tool Calls
(full width), Latency + Errors (half width), Top Tools + Top Agents,
AI Usage section with model leaderboards. Update header with Live
streaming indicator and inline tabs/controls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…conversation view

Adds a new Threads tab to the Monitor page showing a paginated list of
threads with their associated agent, model (resolved from decopilot
monitoring logs), user, status, and token usage (in/out/total). Clicking
a thread opens a slide-over panel with the full conversation rendered
using the existing chat UI components in read-only mode.

Made-with: Cursor
…onsistent table header to Threads tab

- Search by title (backend ILIKE)
- Filter by status, user, agent (all backend), model (client-side from logs)
- FiltersPopover matches Audit tab visual style
- Fix empty threads bug: updated_at is TEXT so compare as ISO string, not Date
- Table headers now match Audit tab style (uppercase monospace muted)

Made-with: Cursor
- Use PersistedRunConfigSchema.passthrough() for run_config in ThreadEntitySchema instead of loose record type
- Replace ThreadMessagesContent with self-contained ThreadConversationPanel that owns its header, eliminating the onModelResolved-during-render anti-pattern
- Paginate thread messages (100/page with infinite scroll) to support long threads
- Paginate decopilot monitoring logs internally until hasMore=false to avoid 500-log truncation for model/usage aggregation
- Debounce search input (300ms) to avoid firing a query on every keystroke
- Switch threads list and model logs queries from useSuspenseInfiniteQuery/useSuspenseQuery to useInfiniteQuery/useQuery so ThreadsTabContent never suspends (fixing search input focus loss)
- Hide table header when threads list is empty or loading

Made-with: Cursor
…atibility

PersistedRunConfigSchema.passthrough() infers required fields (models, agent,
temperature, toolApprovalLevel) that are incompatible with the Kysely storage
type Thread.run_config: Record<string, unknown> | null, breaking all thread
tool handlers. Revert to z.record() with a comment directing callers to use
PersistedRunConfigSchema for typed access at the point of use.

Made-with: Cursor
The column was added by migration 052 but missing from the TypeScript types,
causing TS2345 errors in threads.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MessageAssistant used useChatStream() which throws when rendered outside
ActiveTaskProvider. Threads in the monitoring view display read-only
historical messages with no active stream context, so isRunInProgress
now safely defaults to false via useOptionalChatStream().
Migration 057 already replaced agent_ids with virtual_mcp_id but leftover
references remained in types, storage queries, schema, and monitoring UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…reads width

- Reduce top padding in overview tab (py-6 → pt-2 pb-6) to close the
  gap between header controls and the first card
- Wrap audit tab content in max-w-[1200px] container with px-4/md:px-10
  to match the members page table layout
- Apply same container constraint to threads tab

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Select component: change default height from h-10 to h-8 (32px) to
  match button default size; xs size from h-7 to h-6
- Header controls: remove size="sm" overrides so buttons use default
  h-8 (32px) consistently
- Reduce header-to-content gap (gap-4 → gap-3)
- Move search to shared header area below tabs for audit/threads
- Convert audit from accordion (inline expand) to Sheet (slide-over
  panel) matching the threads pattern
- Remove ThreadFiltersPopover from threads tab
- Remove chevron expand column from LogRow, simplify to click-to-select
- Both audit and threads now use the same interaction: click row → Sheet

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Card component (MonitoringMetricCard):
- gap-8 (32px) between header and content sections
- Title: text-sm font-normal text-foreground/70
- Value: text-4xl font-normal (36px, weight 400)
- Content children: gap-6 (24px) between chart and table

Leaderboard tables (Connection, Tool, Model):
- Row height: h-10 (40px) with border-b border-border/50
- Row padding: px-3 (12px)
- Icon: 24x24 with border, shadow-sm, rounded-md
- Name: text-sm text-muted-foreground
- Percentage: text-sm text-foreground/30 (opacity 0.3)
- Count: text-sm text-foreground font-normal (not semibold)
- No gap between rows, only 0.5px border separator
- "See all": px-4, text-sm text-muted-foreground + arrow icon

Select trigger: w-[120px] matching Figma spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move SearchInput from a standalone div between header and content into
the Page.Body container, below the tabs row. Uses w-full md:w-[375px]
matching the Members page search pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove size="sm" and h-7 override from the trigger button so it uses
the default h-8 (32px) height, matching all other header controls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change Page.Body from pb-0 to !pb-3 so there's a consistent small gap
between the search input and the table content below.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bump flex gap from gap-3 to gap-5 (20px) for better spacing between
title, tabs row, and search input. Also pb-3 → pb-4.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Overview skeleton: use SkeletonCard component matching the actual card
structure (gap-8, proper title/value sizes, border-b table rows with
icon placeholders, "See all" row). Mirrors the full overview layout
with full-width and half-width card rows.

Table skeleton: wrap in max-w-[1200px] container matching the actual
audit/threads table layout. Match row height (h-14) and column
structure (no expand chevron column).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The search was outside the gap-5 div, so the gap wasn't applying
between tabs and search. Now it's a sibling of the title and tabs
row inside the same flex-col gap-5 container.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Connection rows in leaderboard tables are now clickable — navigate
  to the connection detail page via getConnectionSlug
- Tool rows navigate to their parent connection detail page
- "See all" links navigate to the Audit tab
- All clickable rows have hover:bg-accent/50 transition
- AI Usage section: added border-t divider separating it from tool
  call metrics; restructured from full-width + 2-col to a single
  3-column row (AI Calls, AI Latency, AI Errors) with shorter charts
- Updated skeleton to match new 3-column AI layout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The percentage was dividing the metric value (e.g. avgDurationMs=117)
by total (e.g. totalCalls=2) giving nonsensical results like 5825%.

Now per mode:
- requests: calls / totalCalls (proportion of traffic)
- latency: calls / totalCalls (proportion of traffic) + latency value
- errors: errorRate % + formatted metric value

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eader

Top Tools / Top Connections:
- Replaced MonitoringMetricCard (with giant hero number) with simple
  Card containers — just a label + the ranked list
- Renamed "Top Agents Used" to "Top Connections" (more accurate)
- Reduced gap-8 to gap-4 for compact list style

AI Usage divider:
- Replaced bare border-t with a centered section header:
  horizontal lines + "AI USAGE" label in uppercase tracking-wider
- Added pt-4 for breathing room above

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…yout

- Remove redundant "Top Connections" card (already shown in Tool Calls)
- Add "Top Agents" card listing active virtual MCPs with icons, each
  clickable to navigate to the agent page; "See all" goes to Threads tab
- New AgentLeaderboardTable component using IntegrationIcon and
  virtualMcps data
- Pass virtualMcps prop through to OverviewTabContent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rafavalls and others added 4 commits March 31, 2026 10:10
- Remove Top Tools card and ToolLeaderboardTable (tool data already
  visible in the Tool Calls connection breakdown)
- Remove useMonitoringTopTools hook usage and analyticsDateRange
- Top Agents card: uses MonitoringMetricCard with chart + agent list,
  shows active virtual MCPs count as hero metric
- Top Automations card: new AutomationsCard component using
  useAutomationsList hook, shows automation name, trigger count,
  active/inactive status; clickable rows navigate to the agent page
- Both cards in a 2-column layout with charts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pattern

Both cards now match the Tool Calls card structure: big hero metric +
chart + ranked leaderboard table with the same row styling.

Agent Sessions: total calls metric, chart, agent leaderboard
Automation Runs: active count metric, chart, automation leaderboard
  showing % share of triggers + trigger count per automation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@viktormarinho viktormarinho force-pushed the rafavalls/monitoring-redesign branch from ca39c6c to 4a70a77 Compare March 31, 2026 13:13
viktormarinho and others added 4 commits March 31, 2026 12:14
… local postgres docs

Merge the two redundant virtual_mcp_id WHERE clauses in thread queries
so they never conflict. Also add CLAUDE.md instructions for querying the
embedded postgres during development.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bun.lock had textual conflicts from dependency changes on both sides.
Resolved by taking main's version and running bun install to reconcile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Delete analytics-top-tools.tsx (unused file) and its useMonitoringTopTools hook
- Delete home-grid-cell.tsx (no remaining consumers after skeleton removal)
- Remove StackedConnectionChart, MonitoringStatsRowSkeleton (dead code)
- Un-export internal helpers in utils.ts (NICE_INTERVALS, intervalToMs, etc.)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ckend

The backend only accepts singular agentId/userId strings, but the UI
allowed multi-select. Cap both filters to one value so the UI matches
the API capability.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@viktormarinho viktormarinho merged commit f82f853 into main Mar 31, 2026
15 checks passed
@viktormarinho viktormarinho deleted the rafavalls/monitoring-redesign branch March 31, 2026 16:57
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.

3 participants