Skip to content

[q] Improve daily-spending-forecast: charts + clearer P10/P90 terminology #49977

Description

@github-actions

Q Workflow Optimization Report

Triggered by /q comment on issue #49951 (Daily spending forecast report), requesting: use shared aw to download logs, generate pretty graphs, and improve confusing P10/P90 terminology.

Issues Found

Daily Spending Forecast (.github/workflows/daily-spending-forecast.md)

  • The report only produced ASCII bar charts in fenced code blocks; no rendered graphics were generated even though the repo has a standard shared Python data-visualization stack (shared/python-dataviz.md) used by other workflows for chart generation + asset upload.
  • The report referenced P10, P50, P90 as bare percentile labels with no explanation. These are frequently misread as confidence percentages rather than points in the Monte Carlo AIC distribution (P10 = low-end estimate, P50 = median, P90 = high-end/conservative-budget estimate). The issue explicitly called this out as confusing.
  • Re: "use shared aw to download logs" — the workflow already uses the agentic-workflows MCP server (agentic-workflows: true tool) as its log/audit fetch mechanism, consistent with other workflows in the repo (e.g. daily-agentrx-trace-optimizer.md, daily-safe-output-optimizer.md use shared/aw-logs-24h-fetch-setup.md, a thin wrapper around the same gh-aw logs CLI). Since this workflow's job is macro-level cost forecasting (via gh aw forecast) rather than per-run log analysis, the 24h-logs shared import isn't a fit; the existing prefetch step using the gh-aw forecast CLI is the correct existing mechanism and was left unchanged.
Changes Made

daily-spending-forecast.md

  • Added imports: [shared/python-dataviz.md] to bring in the standard Python (NumPy/Pandas/Matplotlib/Seaborn/SciPy) chart-generation environment and upload_asset safe-output, matching the pattern used by other reporting workflows in this repo.
  • Updated the Report section to require a rendered PNG chart (daily spending trend + P10/P50/P90 forecast distribution) uploaded via upload_asset and embedded in the report, falling back to the existing ASCII chart only if chart generation/upload fails.
  • Added explicit terminology guidance in both the Analysis and Report sections: P10/P50/P90 must be labeled with their plain-language meaning ("P10 (low-end estimate)", "P50 (median/most likely)", "P90 (high-end estimate)") instead of bare percentile names, to avoid readers mistaking them for confidence levels.

Expected Improvements

  • Reports will include an actual rendered chart image (not just ASCII art), improving readability of trend and forecast-distribution data.
  • P10/P50/P90 terminology will be self-explanatory in every generated report, addressing the confusion raised in the issue.

Validation

Compiled successfully with the existing gh-aw binary (./gh-aw compile daily-spending-forecast) — 1 workflow succeeded (pre-existing unrelated permissions warning for pull-requests: read was already present before this change and is out of scope). Only the .md source file was modified; the generated .lock.yml is left for automatic recompilation after merge.

References


Warning

Protected Files — Push Permission Denied

This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.

Protected files

The push was rejected because GitHub Actions does not have workflows permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.

Create the pull request manually
# Download the patch from the workflow run
gh run download 30812269186 -n agent -D /tmp/agent-30812269186

# Create a new branch
git checkout -b q/spending-forecast-improvements-3d4d4469f4fda8a6 main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-30812269186/aw-q-spending-forecast-improvements.patch

# Push the branch and create the pull request
git push origin q/spending-forecast-improvements-3d4d4469f4fda8a6
gh pr create --title '[q] Improve daily-spending-forecast: charts + clearer P10/P90 terminology' --base main --head q/spending-forecast-improvements-3d4d4469f4fda8a6 --repo github/gh-aw

🎩 Equipped by Q · auto · 73 AIC · ⌖ 15.1 AIC · ⊞ 11.5K ·
Comment /q to run again

  • expires on Aug 5, 2026, 4:20 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions