Skip to content

Pack identical APM skill bundle across all reusable workflows - #136

Merged
theletterf merged 1 commit into
mainfrom
fab/share-apm-skill-bundle
May 5, 2026
Merged

theletterf merged 1 commit into
mainfrom
fab/share-apm-skill-bundle

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

Workaround for github/gh-aw#30365: every APM-importing reusable workflow in this repo currently caches its skill bundle under the same key apm-copilot- when called from elastic/docs-content, so they overwrite each other's caches.

Why

The cache key formula in the lock files is:

key: apm-${{ needs.activation.outputs.engine_id }}-${{ hashFiles('.github/workflows/*.lock.yml') }}

That hashFiles(...) is evaluated in the caller's workspace (elastic/docs-content), which has no .lock.yml files — those live here. Hash segment evaluates to empty, so every APM-importing workflow ends up with the same key: apm-copilot-.

While docs-review was the only APM-importing workflow, this was benign — same producer/consumer, same bundle. After the sweep workflows landed (#123–#125), every additional workflow with a different packages: list started clobbering the cache. The next workflow to run hit the previous bundle and emitted Skill not found — see the May 5 docs-review run https://github.com/elastic/docs-content/actions/runs/25379248158:

✗ skill(docs-check-style) Skill not found: docs-check-style
✗ skill(docs-flag-jargon-skill) Skill not found: docs-flag-jargon-skill
✗ skill(docs-frontmatter-audit) Skill not found: docs-frontmatter-audit
✗ skill(docs-content-type-checker) Skill not found: docs-content-type-checker
✗ skill(docs-applies-to-tagging) Skill not found: docs-applies-to-tagging
…
◆ All skills are unavailable. I'll review the changes using my own judgment now.

Confirmed the regression is purely additive: an Apr 27 run on the same apm-copilot- key (when only docs-review existed) loaded all five skills cleanly.

Fix

Align every APM-importing workflow's packages: to the union of all skills used across the repo (7 packages). All five workflows now pack the same bundle, so cache collisions are no-ops.

Trade: each workflow downloads the full 7-skill bundle even when it only invokes one. Skills are tiny — negligible cost — and we get correctness back until upstream lands the proper fix (cache key should hash the inlined AW_APM_PACKAGES instead of caller-side lock files).

Filed upstream: github/gh-aw#30365. When that ships, revert this PR — each workflow goes back to its minimum packages: list.

Test plan

  • make compile → 0 errors, 0 warnings.
  • All five APM-importing lock files now embed the same AW_APM_PACKAGES JSON literal (verified with grep AW_APM_PACKAGES).
  • After merge: clear the stale apm-copilot- entry in elastic/docs-content (gh cache delete --repo elastic/docs-content apm-copilot-) and trigger one workflow at a time, checking the agent log for ✓ skill(...) (real success) and absence of Skill not found and All skills are unavailable.
  • Confirm both a sweep (e.g., docs-style-sweep) and a docs-review on a real PR succeed back-to-back.

🤖 Generated with Claude Code

@theletterf
theletterf requested a review from a team as a code owner May 5, 2026 14:12
@theletterf
theletterf requested a review from cotti May 5, 2026 14:12
@theletterf theletterf self-assigned this May 5, 2026
@theletterf theletterf added the fix label May 5, 2026
Every APM-importing reusable workflow in this repo currently caches its
skill bundle under the constant key `apm-copilot-` when called from
elastic/docs-content. The cache key formula
`apm-${engine}-${hashFiles('.github/workflows/*.lock.yml')}` is evaluated
in the caller's workspace, which has no lock files — so the hash segment
is empty for every workflow.

While only docs-review used APM this was benign. Once the sweeps landed
(#123-#125), every additional workflow with a different `packages:` list
started overwriting the same cache slot. The next workflow to run hit
the previous one's bundle and got `Skill not found` for the skills it
actually imports — with the agent ultimately falling back to manual
analysis ("All skills are unavailable. I'll review the changes using my
own judgment now.").

Workaround: align every APM-importing workflow's `packages:` to the
union of all skills used across the repo, so all five workflows pack
the same bundle and cache collisions are no-ops. Adds a small per-run
download cost (each workflow pulls all seven skills, uses one or two)
but restores correctness.

Filed upstream as github/gh-aw#30365 — when fixed there, we can revert
each workflow's `packages:` back to its minimum set.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@theletterf
theletterf force-pushed the fab/share-apm-skill-bundle branch from 59aa16b to 5ac7385 Compare May 5, 2026 14:14
@theletterf
theletterf merged commit 07dd56f into main May 5, 2026
3 checks passed
@theletterf
theletterf deleted the fab/share-apm-skill-bundle branch May 5, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant