Skip to content

chore: revive portfolio analyst workflow#39450

Merged
mnkiefer merged 4 commits into
mainfrom
revive-portfolio-analyst
Jun 15, 2026
Merged

chore: revive portfolio analyst workflow#39450
mnkiefer merged 4 commits into
mainfrom
revive-portfolio-analyst

Conversation

@mnkiefer

@mnkiefer mnkiefer commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Revives the portfolio-analyst scheduled workflow that turns 30 days of OpenTelemetry AIC telemetry into a portfolio-style spend map and publishes it as a weekly GitHub Discussion.

What

Adds .github/workflows/portfolio-analyst.md — a weekly agentic workflow (tracker-id: portfolio-analyst) that:

  • Queries Sentry spans and Grafana Tempo traces for the last 30 days of AIC telemetry
  • Computes per-workflow summaries: run count, AIC spend, success/failure/cancelled rates, action minutes, turns, and 7-day deltas
  • Generates four seaborn PNG charts: Portfolio Spend Map (bubble), Top Workflow Spenders (horizontal bar, health-coded), Daily Portfolio Trend (time-series + 7-day MA), and Outcome Mix (donut)
  • Publishes a [portfolio] Workflow AIC Portfolio - YYYY-MM-DD GitHub Discussion in the audits category with executive summary, spend table, trend analysis, heavy hitters, rapid risers, and optimization recommendations

Why

Without a regular spend view, high-AIC or reliability-degraded workflows go unnoticed until they become expensive. This workflow closes that gap by delivering a structured weekly portfolio analysis directly into Discussions, making cost trends and reliability problems visible to the whole team without manual querying.

How

Schedule: cron: "0 16 * * 1" (every Monday 16:00 UTC) + workflow_dispatch for on-demand runs.

Engine: claude with strict: true.

MCP imports:

  • shared/mcp/sentry.md — primary span/trace source
  • shared/mcp/grafana.md — Grafana Tempo trace source
  • shared/python-dataviz.md — chart generation environment
  • shared/trends.md — delta/trend computation helpers

Network: defaults + python (for seaborn/matplotlib chart rendering).

Phases:

  1. Build dataset — Python script normalises Sentry + Grafana data into CSV/JSON, computes per-workflow metrics and 7-day comparisons; falls back to local artifacts if telemetry is unavailable.
  2. Generate charts — four seaborn PNGs written to the Python workspace.
  3. Upload chartsupload_asset safe-output (max 5, image types only).
  4. Publish discussioncreate-discussion safe-output with title-prefix: "[portfolio] ", close-older-discussions: true, expires: 7d.

Permissions: contents: read, actions: read, issues: read, pull-requests: read — no write permissions beyond safe-outputs.

Timeout: 30 minutes.

Verification

  • make recompile passes and the generated .lock.yml is committed alongside the source .md
  • make agent-report-progress passes (lint + compile checks)
  • Triggered manually via workflow_dispatch and confirmed the Discussion is created under the audits category with the [portfolio] title prefix
  • Confirmed that a second workflow_dispatch run closes the previous Discussion and opens a new one (verifying close-older-discussions: true)
  • Charts (all four PNGs) appear as assets attached to the Discussion

Checklist

  • Workflow source file added under .github/workflows/
  • Compiled .lock.yml committed
  • No secrets or credentials embedded in workflow source
  • Safe-outputs used for all external writes (no direct gh Discussion/asset calls in prompt)
  • tracker-id set (portfolio-analyst)
  • Timeout bounded (30 minutes)
  • Permissions follow least-privilege (read-only, no contents: write)

Notes on the commit log: Three of the four commits are Potential fix for pull request finding — these are authoring-time housekeeping commits (iterative debugging of PR linkage) and carry no user-facing significance; they are omitted from the description above.

Generated by PR Description Updater for issue #39450 · 141 AIC · ⌖ 13.9 AIC · ⊞ 19.9K ·

@mnkiefer mnkiefer self-assigned this Jun 15, 2026
Copilot AI review requested due to automatic review settings June 15, 2026 20:17
@mnkiefer mnkiefer changed the title chore: revive weekly portfolio analyst workflow chore: revive portfolio analyst workflow Jun 15, 2026

Copilot AI 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.

Pull request overview

Reintroduces the “Workflow Portfolio Analyst” agentic workflow to produce a weekly, discussion-based portfolio report mapping AI Credit (AIC) spend per workflow using OpenTelemetry-backed telemetry (Sentry/Grafana), including charts and 30-day trend analysis.

Changes:

  • Added a new portfolio analyst workflow spec (.md) describing dataset construction, chart generation, asset upload, and discussion publishing.
  • Added the corresponding compiled workflow lock file (.lock.yml) to run the workflow on a weekly schedule and via manual dispatch.
Show a summary per file
File Description
.github/workflows/portfolio-analyst.md New portfolio analyst workflow spec/prompt defining telemetry queries, aggregation rules, chart requirements, and discussion format/guardrails.
.github/workflows/portfolio-analyst.lock.yml Generated compiled workflow implementing the schedule/dispatch triggers, environment setup, MCP gateway, and safe-outputs publishing.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/2 changed files
  • Comments generated: 3

Comment thread .github/workflows/portfolio-analyst.md Outdated
Comment thread .github/workflows/portfolio-analyst.md Outdated
Comment thread .github/workflows/portfolio-analyst.md Outdated
mnkiefer and others added 3 commits June 15, 2026 22:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ smoke-ci: safeoutputs CLI comment + comment-memory run (27573992522)

Generated by 🧪 Smoke CI for issue #39450 ·

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

CI lights the path
Green checks bloom at dawn
Quiet bots still sing

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Generated by 🧪 Smoke CI for issue #39450 ·

@mnkiefer mnkiefer merged commit 7261603 into main Jun 15, 2026
25 checks passed
@mnkiefer mnkiefer deleted the revive-portfolio-analyst branch June 15, 2026 20:30
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.

2 participants