Repository navigation
feat(daily-spending-forecast): replace ASCII charts with matplotlib and clarify P10/P50/P90 terminology - #49978
Merged
Merged
Conversation
…P90 terminology - Import shared/trending-charts-simple.md to provide Python environment (NumPy, Pandas, Matplotlib, Seaborn, SciPy) with cache-memory support and upload-asset safe-output capability - Replace ASCII chart requirement with two matplotlib PNG charts: 1. Spending Trend (line chart, last 30 days, per-workflow series + rolling avg) 2. Forecast Distribution (horizontal bar, P10/P50/P90 per workflow) - Add Terminology section defining P10/P50/P90 with plain-English explanations (optimistic/median/conservative) to appear in every report section - Update Report section to embed charts inline and use self-explanatory percentile labels throughout - Recompile: daily-spending-forecast.lock.yml updated Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update daily spending forecast with improved charts and terminology
feat(daily-spending-forecast): replace ASCII charts with matplotlib and clarify P10/P50/P90 terminology
Aug 3, 2026
pelikhan
marked this pull request as ready for review
August 3, 2026 12:46
Contributor
There was a problem hiding this comment.
Pull request overview
Adds rendered forecast charts and clearer percentile terminology to daily spending reports.
Changes:
- Adds Python chart generation and asset uploads.
- Defines P10/P50/P90 terminology and restructures reports.
- Regenerates the compiled workflow.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/daily-spending-forecast.md |
Adds charting and reporting instructions. |
.github/workflows/daily-spending-forecast.lock.yml |
Compiles the imported Python and asset-upload infrastructure. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Suppressed comments (1)
.github/workflows/daily-spending-forecast.md:239
- The forecast JSON has no
projection.weekly_aic_p*fields. Weekly percentiles are inweekly_monte_carlo.p10_projected_aic,p50_projected_aic, andp90_projected_aic(pkg/cli/forecast_types.go:60-64andforecast_montecarlo.go:69-76). The current code therefore renders every bar as zero even when valid forecast data exists.
for wf in forecast.get("workflows", []):
proj = wf.get("projection", {})
rows.append({
"workflow": wf.get("workflow_id", "unknown")[-30:],
"p10": proj.get("weekly_aic_p10", 0),
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Balanced
Comment on lines
+178
to
+189
| data_file = "/tmp/gh-aw/python/data/run_samples.json" | ||
| chart_file = "/tmp/gh-aw/python/charts/spending_trend.png" | ||
|
|
||
| # Load data written from forecast.json (run_samples list) | ||
| with open(data_file) as f: | ||
| samples = json.load(f) | ||
|
|
||
| df = pd.DataFrame(samples) | ||
| df["run_started_at"] = pd.to_datetime(df["run_started_at"]) | ||
| df["date"] = df["run_started_at"].dt.date | ||
|
|
||
| top5 = df.groupby("workflow_id")["aic"].sum().nlargest(5).index |
| daily = grp.groupby("date")["aic"].mean() | ||
| ax.plot(daily.index, daily.values, marker="o", linewidth=1.5, | ||
| label=name, color=palette[idx], alpha=0.8) | ||
| rolling = daily.rolling(7, min_periods=1).mean() |
| P90 (90th percentile — conservative) forecast totals; | ||
| - the two rendered chart images embedded inline using the asset URLs from the | ||
| `upload_asset` calls above — include a descriptive alt-text for each; | ||
| - a workflow table showing sample count, observed AIC, P50/P90 per-run AIC, projected |
Contributor
|
🎉 This pull request is included in a new release. Release: |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Daily spending forecast reports used ASCII art charts and bare
P10/P50/P90labels with no explanation, making them hard to read and the percentile semantics opaque.Changes
Python charting via
shared/trending-charts-simple.mdimportupload-assetsafe-outputSelf-explanatory percentile terminology
## Terminologysection defines each term once with a plain-English label the agent must echo at first use per section:P10→ 10th percentile — optimistic (9/10 months cost at least this much)P50→ 50th percentile — median/expectedP90→ 90th percentile — conservative (only 1/10 months exceeds this)Report structure update
overview → charts → metrics → collapsible detail → next actionsupload_assetURLs; workflow table retains P50/P90 per-run AIC columns