Copilot telemetry hook write replaces all of ~/.copilot/hooks/aspire-telemetry.json

Open Beginner friendly
#22,218 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
cli

Research direction

Read src/Aspire.Cli/Agents/Copilot/CopilotAgentClient.cs, especially ConfigureTelemetryHookAsync, and compare how the Claude settings.json path merges existing content. Check the existing tests for Copilot hook configuration and add coverage for preserving a hand-added hook across aspire agent init. Done means Aspire-managed entries are updated while other file content remains intact.

Written by the indexing model from the issue text.

Description

needs-area-label
Is there an existing issue for this?
  • I have searched the existing issues
Describe the bug

CopilotAgentClient.ConfigureTelemetryHookAsync builds a new JSON object and writes it over the whole ~/.copilot/hooks/aspire-telemetry.json file. Any entries a user adds to that file by hand are lost each time aspire agent init runs, including a global refresh where no agents are selected. This whole-file write has been on main since #18009 and moved into CopilotAgentClient in #20946.

The file is named for Aspire and owned by it, and Copilot reads every file in ~/.copilot/hooks, so users can keep their own hooks in other files. Even so, merging into existing content (as the Claude settings.json path already does) would be safer.

Raised in review on #22078: https://github.com/microsoft/aspire/pull/22078#discussion_r4555641036

Expected Behavior

Running aspire agent init updates only the Aspire-managed hook entries in aspire-telemetry.json and preserves any other content in the file.

Steps To Reproduce
  1. Run aspire agent init and configure Copilot so ~/.copilot/hooks/aspire-telemetry.json is created.
  2. Add a custom hook entry to that file by hand.
  3. Run aspire agent init again.
  4. The custom entry is gone.
Exceptions (if any)

N/A

Aspire doctor output

N/A

Anything else?

Relevant code: src/Aspire.Cli/Agents/Copilot/CopilotAgentClient.cs (ConfigureTelemetryHookAsync).

Dominant language
C#
Stars
6.4k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
435

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/aspire

All issues in microsoft/aspire

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.