feat: add PR insights analytics dashboard#23215
Merged
Conversation
87f5d5b to
74d01a5
Compare
Contributor
Documentation CheckNew Documentation Needed
Automated review via Coder Tasks |
74d01a5 to
7be5a1b
Compare
DanielleMaywood
approved these changes
Mar 18, 2026
Contributor
DanielleMaywood
left a comment
There was a problem hiding this comment.
stamping so we can iterate, will definitely need to ensure we review this properly if we keep though
deansheather
approved these changes
Mar 18, 2026
Member
deansheather
left a comment
There was a problem hiding this comment.
Mostly backend review, didn't really check the frontend
| avatar: "https://avatars.githubusercontent.com/u/14044910", | ||
| }, | ||
| { | ||
| login: "deansheather", |
| COALESCE(SUM(cc.cost_micros), 0)::bigint AS total_cost_micros, | ||
| COALESCE(SUM(cc.cost_micros) FILTER (WHERE cds.pull_request_state = 'merged'), 0)::bigint AS merged_cost_micros | ||
| FROM chat_diff_statuses cds | ||
| JOIN chats c ON c.id = cds.chat_id |
Member
There was a problem hiding this comment.
Is there only ever one diff row per chat? If so, this is fine, otherwise we probably should COUNT(DISTINCT c.id) in the counts above instead...
Member
Author
There was a problem hiding this comment.
Yes, exactly one row per chat — chat_diff_statuses PK is chat_id, so it's a strict 1:1 relationship. No risk of double-counting.
00cac68 to
c9b6c5a
Compare
8e8f671 to
be722a4
Compare
Adds a new admin-only PR Insights page for the /agents analytics view, giving engineering leaders visibility into code shipped by AI agents. Backend: - New SQL queries in chatinsights.sql aggregating chat_diff_statuses with chat cost data (summary, time series, per-model, recent PRs) - New GET /api/v2/chats/insights/pull-requests endpoint (admin-only) - SDK types for PRInsightsResponse and related structs - Auto-generated TypeScript types Frontend: - PRInsightsView component with stat cards, stacked area chart (created/merged/closed using git color tokens), model performance table with inline merge rate bars, and recent PRs table - Time range filter (7d/14d/30d/90d) using Button component group - Review badges with contextual icons (approved/changes requested/reviewing) - 4 Storybook stories (Default, HighPerformance, LowVolume, NoPRs)
be722a4 to
cd3201f
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What
Adds a new admin-only PR Insights page for the
/agentsanalytics view — a dashboard for engineering leaders to understand code shipped by AI agents.Backend
GET /api/v2/chats/insights/pull-requests— admin-only endpointchatinsights.sqlaggregatingchat_diff_statusesjoined with chat cost data (via root chat tree rollup)Frontend (
PRInsightsView)git-added-bright,git-merged-bright,git-deleted-bright)Data source
All PR data comes from the existing
chat_diff_statusestable (populated by thegitsync.Workerbackground job that polls GitHub every 120s). No new data collection required.Screenshot
View in Storybook:
pages/AgentsPage/PRInsightsView