Skip to content

[q] fix: use GH_AW_WORKFLOW_ID_SANITIZED in trending cache keys (prevent spaces breaking cache restore) #27125

@github-actions

Description

@github-actions

Root Cause

Cache keys in shared/trending-charts-simple.md and shared/charts-with-trending.md used ${{ github.workflow }} which expands to the workflow display name containing spaces (e.g. GitHub API Consumption Report Agent). GitHub Actions cache restore-keys prefix matching consistently fails for keys containing spaces, so every daily run started fresh with no historical data.

Evidence from Live Logs

Confirmed by auditing 18 consecutive runs of api-consumption-report:

# Every agent job logged:
Cache not found for input keys:
  memory-none-nopolicy-trending-data-GitHub API Consumption Report Agent-24616342976,
  memory-none-nopolicy-trending-data-GitHub API Consumption Report Agent-

Despite each run successfully saving its cache in update_cache_memory, the next run never found it. Run sizes grew only from git metadata (714 → 950 → 1288 bytes) — the history.jsonl file was never restored from a previous run.

The api-consumption-report discussion (#27113) correctly reported "This is the first recorded data point" on April 18 — even though the workflow had run 17 times before.

Fix

Replace ${{ github.workflow }} with ${{ env.GH_AW_WORKFLOW_ID_SANITIZED }} in both shared imports:

File Before After
shared/trending-charts-simple.md trending-data-${{ github.workflow }}-${{ github.run_id }} trending-data-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }}
shared/charts-with-trending.md charts-trending-${{ github.workflow }}-${{ github.run_id }} charts-trending-${{ env.GH_AW_WORKFLOW_ID_SANITIZED }}-${{ github.run_id }}

GH_AW_WORKFLOW_ID_SANITIZED is already set by the framework (e.g. apiconsumptionreport) — no spaces, no special characters, consistent with the default cache key format.

Affected Workflows

Workflows importing shared/trending-charts-simple.md:

  • api-consumption-report — confirmed broken across 18 runs
  • daily-firewall-report
  • audit-workflows
  • daily-performance-summary
  • python-data-charts

Workflows importing shared/charts-with-trending.md:

  • prompt-clustering-analysis
  • portfolio-analyst
  • stale-repo-identifier

Validation

All affected workflows compiled successfully (no errors or warnings) via the compile tool.

Note: .lock.yml files will be regenerated automatically after merge.


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 24617729414 -n agent -D /tmp/agent-24617729414

# Create a new branch
git checkout -b q/fix-cache-key-spaces-82be654b9355a57f main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-24617729414/aw-q-fix-cache-key-spaces.patch

# Push the branch and create the pull request
git push origin q/fix-cache-key-spaces-82be654b9355a57f
gh pr create --title '[q] fix: use GH_AW_WORKFLOW_ID_SANITIZED in trending cache keys (prevent spaces breaking cache restore)' --base main --head q/fix-cache-key-spaces-82be654b9355a57f --repo github/gh-aw

🎩 Equipped by Q · ● 7.3M ·

  • expires on Apr 21, 2026, 1:15 AM UTC

Metadata

Metadata

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