You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Limit telemetry hooks to Aspire-configured agents - #22078
aspire agent init now registers telemetry hooks per selected agent client instead of per detected environment. The install message names each client by its display name, so the Copilot App and Copilot CLI no longer appear as separate entries.
Installed Aspire agent telemetry hooks for: GitHub Copilot, Claude Code.
Hook locations:
GitHub Copilot: <COPILOT_HOME>\hooks\aspire-telemetry.json. One registration covers the Copilot App, the Copilot CLI, and VS Code.
Claude Code: a PostToolUse hook in <CLAUDE_CONFIG_DIR>\settings.json.
OpenCode: no hooks, because it has no verified hook schema.
When hooks install:
Only for global scope, which is the existing rule because hooks write to user-level locations. Project scope is handled later in the stack.
Only for selected clients that have the aspire@aspire-skills plugin or the Aspire MCP server configured, either from a previous run or from this one. Existing Aspire setup refreshes the hook even when both the skills and MCP choices are skipped. The hooks only report on that plugin's skills and Aspire MCP tools, so third-party skills alone produce no events, and ASPIRE_CLI_TELEMETRY_OPTOUT still disables reporting.
Re-running aspire agent init refreshes Aspire's hook and preserves unrelated user hooks and settings.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are reported for the client-based telemetry hook changes.
No open issues 🎉
What changed in this PR
This PR addresses #20014 by making aspire agent init report telemetry hooks by agent client display name rather than detected environment, clarifying that Copilot App and CLI share one registration.
Changes:
Tracks hook support, installation results, and skip messages per selected client.
Installs user-level hooks in either configuration scope when Aspire skills or MCP are configured.
Updates tests and documentation for client selection, VS Code detection, and display-name messages.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Telemetry hooks can be installed and reported as successful when neither skills nor MCP was configured for a client, and cross-process deduplication lacks automated regression coverage.
For a detected Copilot client, --scope project --skills none --mcp with malformed project .mcp.json reaches this call after MCP configuration fails. Passing all selectedClients still creates the global telemetry hook and reports it as installed, although neither Aspire skills nor MCP was configured for that client. Track successful Aspire skills/MCP configuration per client and pass only those clients here, including successful no-op configurations.
Ella Hathaway (ellahathaway)
changed the title
Name telemetry hooks by agent display name in aspire agent init
Name telemetry hooks by agent display name
Nov 10, 2026
Ella Hathaway (ellahathaway)
changed the title
Name telemetry hooks by agent display name
Install telemetry hooks only for Aspire-configured agents and name them in output
Nov 10, 2026
Ella Hathaway (ellahathaway)
changed the title
Install telemetry hooks only for Aspire-configured agents and name them in output
Limit telemetry hooks to Aspire-configured agents
Nov 10, 2026
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Re-running agent init now refreshes the telemetry hook for selected clients that already have the Aspire plugin or MCP server configured, even when this run does not configure them again.
Co-authored-by: Copilot App <[email protected]>
With --scope global and no skills or MCP selected, agent init returned at the
no-configuration guard before refreshing hooks for clients whose Aspire setup
already exists. Refresh those hooks before the early return; project scope is
unchanged.
Co-authored-by: Copilot App <[email protected]>
Global agent init now treats an aspire server in the VS Code or VS Code Insiders
user mcp.json (default and named profiles) as existing Aspire setup, so reruns
refresh the telemetry hook. These files are read-only and unreadable files are ignored.
Co-authored-by: Copilot App <[email protected]>
Directory enumeration of VS Code profile mcp.json files is lazy, so access errors can surface while iterating. Catch them so the best-effort existing-setup probe never fails agent init.
Co-authored-by: Copilot App <[email protected]>
## Description
Stack 3/3, on #22084. `aspire agent init --scope project` now installs
telemetry hooks too. The hooks are written at user scope
(`~/.copilot/hooks` and `~/.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
init` was run. The PostToolUse matcher from #22084 makes the client
launch `aspire` only for matching tool calls, and only Aspire skill, MCP
tool, and reference-file usage is reported. Users can opt out with
`ASPIRE_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 `aspire` process, so it must fire exactly
once per event. Today a project-level hook would make it fire more than
once (see #20480):
- **Copilot runs hooks from every source and doesn't dedupe them.** It
loads the repo's `.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/hooks` plus
the user hook that global init installs would launch `aspire` twice for
each event. Claude Code dedupes identical handlers across its settings
files, so this is a Copilot problem.
- **Copilot also runs Claude's project hooks.** Copilot reads the repo's
`.claude/settings(.local).json` and runs those hooks too, ignoring
Claude-only fields such as `if`. 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.
- **Install time can't avoid the duplicates.** Project hook files are
committed and shared, but user hooks belong to each machine. We can't
delete a user hook to make room for a project hook, because it also
serves the user's other repos. Skipping the project hook when a user
hook exists only helps the developer who ran init, not teammates who
clone the repo with their own user hooks.
- **Runtime dedupe is heavy.** Each invocation is an independent process
with no shared event ID. Deduping would mean hook processes coordinating
through shared state on every tool call, which is the hot path.
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
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] 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
- [x] 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
- [x] No
---------
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: b39716fb-e8ff-45f3-a048-a710d4f3052e
## 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 <[email protected]>
Copilot-Session: b39716fb-e8ff-45f3-a048-a710d4f3052e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed #20014
aspire agent initnow registers telemetry hooks per selected agent client instead of per detected environment. The install message names each client by its display name, so the Copilot App and Copilot CLI no longer appear as separate entries.Hook locations:
<COPILOT_HOME>\hooks\aspire-telemetry.json. One registration covers the Copilot App, the Copilot CLI, and VS Code.PostToolUsehook in<CLAUDE_CONFIG_DIR>\settings.json.When hooks install:
aspire@aspire-skillsplugin or the Aspire MCP server configured, either from a previous run or from this one. Existing Aspire setup refreshes the hook even when both the skills and MCP choices are skipped. The hooks only report on that plugin's skills and Aspire MCP tools, so third-party skills alone produce no events, andASPIRE_CLI_TELEMETRY_OPTOUTstill disables reporting.Re-running
aspire agent initrefreshes Aspire's hook and preserves unrelated user hooks and settings.Validation:
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*AgentInit*" --filter-class "*NewCommand*" --filter-class "*InitCommand*" --filter-class "*McpInit*" --filter-class "*TelemetryHook*" --filter-class "*AgentTelemetry*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"passed (1257 run; 3 flaky failures passed on rerun).Fixes #20014
Checklist
<remarks />and<code />elements on your triple slash comments?