Skip to content

[q] fix(api-consumption-report): restore GitHub API rate limit data #40505

@github-actions

Description

@github-actions

Q Workflow Optimization Report

Triggered by: @pelikhan · discussion #40459

Root Cause (from live data)

GitHub API Consumption Report Agent

  • Run IDs analyzed: 27869705722 (2026-06-20), 27824516852 (2026-06-19), 27757718890 (2026-06-18 — failed), 27687758429 (2026-06-17)
  • Issue: github_rate_limit_usage.core_consumed was absent from all 169 run_summary.json files downloaded on 2026-06-20. The same field was absent in every run examined across the past week.
  • Root cause: The logs MCP tool defaults to --artifacts usage (the compact conclusion artifact). github_rate_limits.jsonl — the file the CLI parses to compute core_consumed — lives in the activation and agent artifacts, not in usage. Without artifacts=["github-api"], the rate limit file is never downloaded and github_rate_limit_usage is omitted from every run_summary.json.
  • Secondary issue: The metrics-aggregator sub-agent had a stale schema referencing aw_info.json with camelCase field names that don't match the actual PascalCase run_summary.json layout (run.workflowName, run.Duration, run.SafeItemsCount, etc.).
  • Null-vs-zero gap: The old instruction treated missing core_consumed as zero, silently conflating a data collection gap with zero API consumption in the trending history.
Changes Made

api-consumption-report.md — Step 1 (log collection)

  • Added artifacts=["github-api"] to both incremental and backfill logs() calls
  • Added explicit warning explaining why the parameter is required
  • Updated run directory file inventory to match actual files (run_summary.json, token_usage.jsonl, aw_info.json, github_rate_limits.jsonl)

api-consumption-report.mdmetrics-aggregator sub-agent

  • Replaced stale aw_info.json schema with the real run_summary.json field layout
  • Fixed field mappings: run.workflowName, run.conclusion, run.Duration / 1e9 for seconds, run.SafeItemsCount for safe output count
  • Changed null handling: when core_consumed is absent for every run in a batch, the day's github_api_calls is now recorded as null (not 0) to distinguish a data gap from zero consumption

Expected Improvements

  • github_rate_limit_usage.core_consumed will be populated on the next scheduled run
  • The trending history will correctly distinguish data-collection gaps (null) from zero-consumption days (0)
  • The metrics-aggregator will correctly parse run metrics without field-name mismatches

Validation

  • api-consumption-report compiled successfully (no errors, no warnings)

Note: .lock.yml regeneration will happen automatically 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 27881708288 -n agent -D /tmp/agent-27881708288

# Create a new branch
git checkout -b q/fix-api-consumption-report-rate-limit-artifacts-d329d384d69be4df main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-27881708288/aw-q-fix-api-consumption-report-rate-limit-artifacts.patch

# Push the branch and create the pull request
git push origin q/fix-api-consumption-report-rate-limit-artifacts-d329d384d69be4df
gh pr create --title '[q] fix(api-consumption-report): restore GitHub API rate limit data' --base main --head q/fix-api-consumption-report-rate-limit-artifacts-d329d384d69be4df --repo github/gh-aw

🎩 Equipped by Q · 251.2 AIC · ⌖ 14.9 AIC · ⊞ 7.6K ·

  • expires on Jun 22, 2026, 11:54 AM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions