Repository navigation
Install user-scope telemetry hooks for project-scope agent init - #22093
Conversation
Fixes #20014 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fixes #20014 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Each agent client declares the environments that make it eligible for a telemetry hook, and the configurator registers one hook per eligible client instead of per detected environment. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
VS Code's Copilot harness reads user hooks from ~/.copilot/hooks, the same location the Copilot App and CLI use. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pass the selected clients to the telemetry hook configurator so detected but unselected clients are not modified, and cover the per-client skip messages at the command level. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Install hooks only for selected clients whose aspire-skills plugin registered or MCP setup succeeded, keep the global-only rule, and drop the unverified VS Code agent marker. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Register the Copilot user hook with a tool-name matcher for skill and Aspire MCP tools, and register Claude PostToolUse hooks for the Skill and Aspire MCP tools plus Read calls limited to Aspire skill paths through an if rule. Share settings merge helpers through TelemetryHookSettings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add a test that every canonical skill and reference path matches ClaudeReadIf, and split the merged matcher paragraph in the telemetry spec. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
d6dd47c to
477bd0e
Compare
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22093Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22093" |
…telemetry-hook-message
Move the Copilot and Claude matcher constants into their agent clients, drop the shared settings helper, and restore the clients to their base shape plus the matcher behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ook-message' into ellahathaway-telemetry-hook-matcher-scoping
…her-scoping' into ellahathaway-telemetry-hook-dedupe-events
…pe-events' into ellahathaway-telemetry-hooks-project-scope Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ook-message' into ellahathaway-telemetry-hook-matcher-scoping
…ook-message' into ellahathaway-telemetry-hook-matcher-scoping
…elemetry-hooks-project-scope Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ook-message' into ellahathaway-telemetry-hook-matcher-scoping Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…her-scoping' into ellahathaway-telemetry-hooks-project-scope
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…her-scoping' into ellahathaway-telemetry-hooks-project-scope
This comment has been minimized.
This comment has been minimized.
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
No actionable findings.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b39716fb-e8ff-45f3-a048-a710d4f3052e
Tests selector3 / 101 PR test projects · 4 PR jobs, from 23 changed files. Selected PR test projects (3 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed📦 affected project 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Pull request created: #2140
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#2140 targeting Documents that telemetry hooks are always written at user scope even with Note This draft PR needs human review before merging. |
## Description Backports of the PRs from https://github.com/microsoft/aspire/stack/22118: - #22078 - #22084 - #22093 ## Checklist - Is this feature complete? - [ ] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [ ] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [ ] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [ ] No - [ ] No --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b39716fb-e8ff-45f3-a048-a710d4f3052e
Description
Stack 3/3, on #22084.
aspire agent init --scope projectnow installs telemetry hooks too. The hooks are written at user scope (~/.copilot/hooksand~/.claude/settings.json) no matter which scope was requested. Skills and MCP configuration still follow the requested scope, and #22078's per-client gating still decides which clients get hooks.Because the hooks live in user-level configuration, they apply in every repository where that client runs, not only the one where
aspire agent initwas run. The PostToolUse matcher from #22084 makes the client launchaspireonly for matching tool calls, and only Aspire skill, MCP tool, and reference-file usage is reported. Users can opt out withASPIRE_CLI_TELEMETRY_OPTOUT=true. The install message now says the hooks were written to user-level configuration.Why we can't install project-level hooks today
Every hook launches a separate
aspireprocess, so it must fire exactly once per event. Today a project-level hook would make it fire more than once (see #20480):.github/hooks/*.json,~/.copilot/hooks,.github/copilot/settings(.local).json,~/.copilot/settings.json, and plugins, then runs all of them. A project hook in.github/hooksplus the user hook that global init installs would launchaspiretwice for each event. Claude Code dedupes identical handlers across its settings files, so this is a Copilot problem..claude/settings(.local).jsonand runs those hooks too, ignoring Claude-only fields such asif. A Claude project hook would fire in Copilot sessions on top of Copilot's own hook, even if the user set up only Claude for the project.Installing hooks only at user scope gives exactly one hook per client on each machine. We can revisit project hooks if Copilot starts deduping identical hook commands or applying precedence across hook sources.
Validation:
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.AgentInit*" --filter-class "*.TelemetryHook*" --filter-class "*.AgentTelemetry*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"passed (464/464). The E2E tests were not run.Checklist
<remarks />and<code />elements on your triple slash comments?