Skip to content

Fix AIC usage cache always empty in activation job#39130

Merged
pelikhan merged 7 commits into
mainfrom
copilot/investigate-usage-cache-issue
Jun 14, 2026
Merged

Fix AIC usage cache always empty in activation job#39130
pelikhan merged 7 commits into
mainfrom
copilot/investigate-usage-cache-issue

Conversation

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

actions/cache is branch-scoped: caches written by the conclusion job on one PR branch are invisible to the activation job running on a different PR branch. Workflows triggered by pull_request (e.g. Matt Pocock Skills Reviewer) always run on unique branches, so the cache restore step always misses and the guardrail re-downloads all usage artifacts from scratch on every run.

Fix

Conclusion job — after actions/cache/save, upload the JSONL file as an artifact named aic-usage-cache (7-day retention). Artifacts are accessible cross-branch via the GitHub REST API.

Activation job — after actions/cache/restore, run a new restore_aic_usage_cache_fallback.cjs step that:

  • Is a no-op if the cache file already exists (same-branch hits remain fast)
  • Resolves the numeric workflow ID, lists recent completed runs, downloads the aic-usage-cache artifact from the most recent matching run
  • Is fully non-fatal — failure silently degrades to the existing per-artifact API path

Files

  • actions/setup/js/restore_aic_usage_cache_fallback.cjs — new fallback script
  • pkg/workflow/compiler_activation_job_builder.go — adds fallback step to activation job
  • pkg/workflow/notify_comment.go — adds artifact upload step to conclusion job


✨ PR Review Safe Output Test - Run 27478319746

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 106.7 AIC · ⌖ 25.5 AIC · ⊞ 8.1K ·


Fix AIC usage cache always empty in activation job

actions/cache is branch-scoped: caches written by the conclusion job on one PR branch are invisible to the activation job running on a different PR branch. Workflows triggered by pull_request (e.g. Matt Pocock Skills Reviewer) always run on unique branches, so the cache restore step always misses and the guardrail re-downloads all usage artifacts from scratch on every run.

Fix

Conclusion job — after actions/cache/save, upload the JSONL file as an artifact named aic-usage-cache (7-day retention). Artifacts are accessible cross-branch via the GitHub REST API.

Activation job — after actions/cache/restore, run a new restore_aic_usage_cache_fallback.cjs step that:

  • Is a no-op if the cache file already exists (same-branch hits remain fast)
  • Resolves the numeric workflow ID, lists recent completed runs, downloads the aic-usage-cache artifact from the most recent matching run
  • Is fully non-fatal — failure silently degrades to the existing per-artifact API path

Files

  • actions/setup/js/restore_aic_usage_cache_fallback.cjs — new fallback script
  • pkg/workflow/compiler_activation_job_builder.go — adds fallback step to activation job
  • pkg/workflow/notify_comment.go — adds artifact upload step to conclusion job


✨ PR Review Safe Output Test - Run 27478319746

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 106.7 AIC · ⌖ 25.5 AIC · ⊞ 8.1K ·

Changeset

  • Type: patch
  • Description: Fixed the AIC usage cache fallback so activation jobs can restore cached usage data across pull request branches.

Generated by 📋 Changeset Generator for issue #39130 · 9 AIC · ⊞ 16.2K ·



✨ PR Review Safe Output Test - Run 27480363196

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 64.9 AIC · ⌖ 9.07 AIC · ⊞ 8.1K ·

Copilot AI and others added 2 commits June 13, 2026 17:21
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Root cause: GitHub Actions actions/cache is branch-scoped. The Matt Pocock
Skills Reviewer triggers on pull_request events, each on a unique PR branch,
so caches saved by the conclusion job on branch A are never visible to the
activation job on branch B.

Fix:
- Add aic-usage-cache artifact upload in conclusion job (cross-branch accessible)
- Add artifact-based fallback step in activation job that downloads the most
  recent aic-usage-cache artifact when actions/cache/restore has a miss
- New restore_aic_usage_cache_fallback.cjs script implements the fallback
- Update WASM golden files and add unit tests

Fixes #39050

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix AIC usage cache always empty in activation job (branch-scoping issue) Fix AIC usage cache always empty in activation job Jun 13, 2026
Copilot AI requested a review from pelikhan June 13, 2026 17:36
@pelikhan pelikhan marked this pull request as ready for review June 13, 2026 17:47
Copilot AI review requested due to automatic review settings June 13, 2026 17:47

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

This PR fixes the “daily AIC usage cache always empty” behavior in activation jobs by adding an artifact-based fallback path to share the cached JSONL across branches (since actions/cache is branch-scoped for PR workflows).

Changes:

  • Upload the AIC usage cache JSONL as a short-lived artifact (aic-usage-cache) from the conclusion job.
  • Add an activation-job fallback step that downloads the most recent aic-usage-cache artifact when the cache file wasn’t restored from actions/cache.
  • Update compiler tests and golden/lock workflow fixtures to include the new steps.
Show a summary per file
File Description
actions/setup/js/restore_aic_usage_cache_fallback.cjs New GitHub-script helper that restores the usage cache JSONL via artifact download when the cache file is missing.
actions/setup/js/restore_aic_usage_cache_fallback.test.cjs Adds unit tests for the new artifact fallback script.
pkg/workflow/compiler_activation_job_builder.go Emits a new activation step to run the artifact fallback after the cache restore step.
pkg/workflow/notify_comment.go Emits a new conclusion step to upload the cache JSONL as an artifact after saving it to actions/cache.
pkg/workflow/daily_aic_workflow_guardrail_test.go Extends tests to assert the new activation fallback + conclusion artifact upload steps exist in compiled output.
pkg/workflow/testdata//.golden Updates golden workflow fixtures to include the new activation fallback step.
.github/workflows/*.lock.yml Regenerates locked workflows to include the new activation fallback step and conclusion artifact upload step.

Copilot's findings

Tip

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

  • Files reviewed: 259/259 changed files
  • Comments generated: 1

},
});

const cacheArtifact = artifacts.find(a => a.name === AIC_USAGE_CACHE_ARTIFACT_NAME && !a.expired);
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GH_AW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this is not needed key already present

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the redundant GH_AW_GITHUB_TOKEN env entry from the fallback step — actions/github-script already exposes its github-token as GITHUB_TOKEN, and the fallback script already falls back to process.env.GITHUB_TOKEN. Regenerated all lock files in commit 3f6e1c8.

The `actions/github-script` action already exposes its `github-token`
as `GITHUB_TOKEN` env var. The fallback script already reads
`process.env.GITHUB_TOKEN` as a fallback, so the explicit
`GH_AW_GITHUB_TOKEN` env entry on the step was redundant.

Regenerated all 246 lock files and updated golden test fixtures.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

⚠️ Smoke Gemini failed. Gemini encountered unexpected challenges...

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed to deliver outputs! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed to deliver outputs! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

⚠️ Smoke Gemini failed. Gemini encountered unexpected challenges...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

Commit pushed: 7edb750

Generated by Changeset Generator · 9 AIC · ⊞ 16.2K

@github-actions

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq 4.53.3
curl 8.5.0
gh 2.93.0
node 22.22.3
python3 3.11.15 (PyPy 7.3.23)
go 1.24.13
java 21.0.11
dotnet 10.0.300

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test · 39.6 AIC · ⌖ 12.4 AIC · ⊞ 28.1K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Faint build lights hum
Cache winds turn the quiet keys
Smoke rises, then rests

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

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex · 38.1 AIC · ⌖ 3.2 AIC · ⊞ 10.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

💥 Smoke Test: Claude — Run 27480363196

Core #1-12: ✅ all passed
PR Review #13-18: ✅ all passed
#19 Close PR: ⚠️ skipped (no safe test PR)

Overall: PARTIAL (1 skipped, 0 failed) — Claude engine nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 64.9 AIC · ⌖ 9.07 AIC · ⊞ 8.1K ·

@github-actions github-actions Bot 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.

💥 Automated smoke test review - all systems nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 64.9 AIC · ⌖ 9.07 AIC · ⊞ 8.1K

@@ -0,0 +1,5 @@
---

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.

Smoke test review: Consider confirming the changeset summary clearly references the AIC usage cache fix. 💥

@@ -0,0 +1,5 @@
---
"gh-aw": patch
---

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.

Smoke test review: Nice — ensure the patch level matches the scope of the cache-scoping fix. 👍

@github-actions

Copy link
Copy Markdown
Contributor

Fix AIC usage cache always empty in activation job
1✅ 2✅ 3✅ 4✅ 5✅
6✅ 7✅ 8✅ 9✅ 10✅
11✅ 12✅ 13✅ 14✅ 15✅
Status: PASS
Author: app/copilot-swe-agent | Assignees: pelikhan, Copilot

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · 218.9 AIC · ⌖ 15.8 AIC · ⊞ 20.4K ·

Copilot AI and others added 2 commits June 13, 2026 22:58
…sage-cache-issue

# Conflicts:
#	.github/workflows/test-quality-sentinel.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and recompile

Done — merged main and recompiled all 246 workflows in commit Merge main and recompile lock files. One conflict in test-quality-sentinel.lock.yml (metadata hash) was resolved by taking the main version.

@github-actions

Copy link
Copy Markdown
Contributor

@copilot review all comments and address the unresolved review feedback on actions/setup/js/restore_aic_usage_cache_fallback.cjs, especially the expired handling in listArtifacts(). Please push the fix and rerun the activation job.

Generated by 👨‍🍳 PR Sous Chef · 39.5 AIC · ⌖ 1.01 AIC · ⊞ 17.4K ·

@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
@pelikhan pelikhan merged commit 94b6cd0 into main Jun 14, 2026
37 checks passed
@pelikhan pelikhan deleted the copilot/investigate-usage-cache-issue branch June 14, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants