Skip to content

Add telemetry for detecting whether AI coding agents have Cloudflare skills installed#13868

Draft
dario-piotrowicz wants to merge 2 commits into
dario/DEVX-2607/wrangler-install-cloudflare-skillsfrom
dario/DEVX-2608/currentAgentSkillsInstalled
Draft

Add telemetry for detecting whether AI coding agents have Cloudflare skills installed#13868
dario-piotrowicz wants to merge 2 commits into
dario/DEVX-2607/wrangler-install-cloudflare-skillsfrom
dario/DEVX-2608/currentAgentSkillsInstalled

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz commented May 8, 2026

Fixes https://jira.cfdata.org/browse/DEVX-2608

Wrangler now includes a currentAgentSkillsInstalled property in telemetry events that reports whether the current AI coding agent has Cloudflare skills present on disk. The value distinguishes between skills installed automatically by Wrangler ("automatic"), skills installed manually by the user ("manual"), no skills present (false), or no supported agent detected (null). Skill names are fetched from the GitHub Contents API with a 24-hour disk cache to avoid rate limits.

Note

This merges on top of the changes in #13846, so 13846 needs to be merged first


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: included in telemetry.md (34c9efd)

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

🦋 Changeset detected

Latest commit: f62f04d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✅ All changesets look good

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13868

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13868

miniflare

npm i https://pkg.pr.new/miniflare@13868

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13868

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13868

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13868

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13868

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13868

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13868

wrangler

npm i https://pkg.pr.new/wrangler@13868

commit: f62f04d

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR adds telemetry to detect whether the current AI coding agent has Cloudflare skills installed, reporting "automatic", "manual", false, or null to telemetry events.

Issues (ranked by severity)

  1. Bug: Cache filename mismatch between tests and production code — The constant SKILLS_REPO_CACHE_FILENAME is "cloudflare-skills-repo-cache.json" (line 223 of agents-skills-install.ts), but both cache tests write to "skills-repo-cache.json". This means the production code never finds the cache file during tests. I confirmed both "uses cached GitHub API response within TTL" and "falls back to stale cache when GitHub API returns an error" fail locally.

  2. Bug: Missing metadata.accepted check may misclassify "manual" installs as "automatic"computeTelemetryCurrentAgentSkillsInstalled (line 409) returns "automatic" when isInNeedingInstall && !isInCopyFailed, but doesn't verify metadata.accepted === true. The installCloudflareSkillsGlobally function writes agentsNeedingInstall to the metadata file even when the user declines the prompt (accepted: false). If the user declines Wrangler's prompt but later installs skills manually, the telemetry would incorrectly report "automatic" instead of "manual".

const configDir = getGlobalWranglerConfigPath();
mkdirSync(configDir, { recursive: true });
writeFileSync(
path.join(configDir, "skills-repo-cache.json"),
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.

Bug: The production constant is "cloudflare-skills-repo-cache.json" but this uses "skills-repo-cache.json". The cache is never found, so fetchSkillNamesFromGitHub hits the (missing) MSW mock and the test fails. Same issue on line 866.

Suggested change
path.join(configDir, "skills-repo-cache.json"),
path.join(configDir, "cloudflare-skills-repo-cache.json"),

const configDir = getGlobalWranglerConfigPath();
mkdirSync(configDir, { recursive: true });
writeFileSync(
path.join(configDir, "skills-repo-cache.json"),
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.

Same filename mismatch as above:

Suggested change
path.join(configDir, "skills-repo-cache.json"),
path.join(configDir, "cloudflare-skills-repo-cache.json"),

(agent) => agent.globalSkillsPath === matchingAgent.globalSkillsPath
);

if (isInNeedingInstall === true && !isInCopyFailed) {
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.

This should also check metadata.accepted === true. When the user declines the install prompt, installCloudflareSkillsGlobally still writes the metadata with accepted: false and a populated agentsNeedingInstall array. If the user later manually installs skills, this condition passes and telemetry reports "automatic" instead of "manual".

Suggested change
if (isInNeedingInstall === true && !isInCopyFailed) {
if (metadata.accepted && isInNeedingInstall === true && !isInCopyFailed) {

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 8, 2026

Review submitted successfully on PR #13868 with three actionable findings:

  1. Cache filename mismatch (high severity) — Two tests write cache files as "skills-repo-cache.json" but the production constant is "cloudflare-skills-repo-cache.json". Both cache tests fail. Suggestions provided for lines 821 and 866.

  2. Missing metadata.accepted check (medium severity) — The telemetry function can misclassify manually-installed skills as "automatic" when the user previously declined the install prompt, because agentsNeedingInstall is written to metadata regardless of accepted. Suggestion provided for line 409.

github run

@dario-piotrowicz dario-piotrowicz force-pushed the dario/DEVX-2608/currentAgentSkillsInstalled branch from 34c9efd to f62f04d Compare May 8, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants