Skip to content

fix: resolve Claude hooks.json validation error and add telemetry debug logging - #3021

Merged
Tom Meschter (tmeschter) merged 6 commits into
microsoft:mainfrom
tmeschter:tmeschter-refactored-fiesta
Aug 6, 2026
Merged

fix: resolve Claude hooks.json validation error and add telemetry debug logging#3021
Tom Meschter (tmeschter) merged 6 commits into
microsoft:mainfrom
tmeschter:tmeschter-refactored-fiesta

Conversation

@tmeschter

Copy link
Copy Markdown
Member

Summary

Two plugin/hooks changes, both related to #2957:

1. Resolve Claude hooks.json validation error

Claude additively loads the default hooks/hooks.json regardless of the hooks path declared in the manifest, so the Copilot-format file living there failed claude plugin validate (hooks.PostToolUse.0.hooks: expected array, received undefined).

  • Renamed plugin/hooks/hooks.jsonplugin/hooks/copilot-hooks.json (content unchanged).
  • Referenced it explicitly from .plugin/plugin.json via "hooks": "./hooks/copilot-hooks.json" (the documented Copilot CLI / VS Code / OpenPlugin form).
  • Updated the README client support matrix.

Nothing now sits at the shared default hooks/hooks.json path, so each client loads only its own hooks file (claude-hooks.json, cursor-hooks.json, copilot-hooks.json).

2. Telemetry debug logging + local plugin-root skill detection

Applied symmetrically to track-telemetry.ps1 and track-telemetry.sh:

  • Opt-in debugging via AZURE_SKILLS_TELEMETRY_LOG_DIR: raw JSON inputs are written to a raw-input/ subdirectory, and MCP args are appended to telemetry.log.
  • Honor AZURE_SKILLS_PLUGIN_ROOT so skills loaded via --plugin-dir are recognized for reference_file_read events.
  • Generalized reference-path extraction to match any skills/ root.

Notes

Related to #2957.

Claude additively loads the default hooks/hooks.json regardless of the manifest's hooks path, so the Copilot-format file there failed 'claude plugin validate'. Rename it to hooks/copilot-hooks.json and reference it explicitly from .plugin/plugin.json (Copilot/VS Code). Nothing now sits at the shared default path, so each client uses its own hooks file.

Addresses the hooks portion of microsoft#2957; the unpinned npx launcher is handled separately.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7ace74d0-93aa-4f8c-a9ef-0a928b7d50ad
Add opt-in debugging to the telemetry hook scripts, controlled by the AZURE_SKILLS_TELEMETRY_LOG_DIR env var: raw JSON inputs are written to a raw-input/ subdirectory and MCP args are appended to telemetry.log. Also honor AZURE_SKILLS_PLUGIN_ROOT so skills loaded via --plugin-dir are recognized for reference_file_read events, and generalize reference-path extraction to match any skills/ root. Applied symmetrically to track-telemetry.ps1 and track-telemetry.sh.

Related to microsoft#2957

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7ace74d0-93aa-4f8c-a9ef-0a928b7d50ad
Copilot AI lite review requested due to automatic review settings August 5, 2026 20:03
@tmeschter
Tom Meschter (tmeschter) requested a review from a team as a code owner August 5, 2026 20:03

Copilot AI left a comment

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.

Pull request overview

This PR updates the Azure plugin hook configuration to avoid cross-client hooks.json validation conflicts (notably for Claude) and enhances hook telemetry scripts with opt-in debug logging plus improved local-plugin path detection.

Changes:

  • Explicitly configures Copilot hooks via plugin/.plugin/plugin.json./hooks/copilot-hooks.json and updates the README client support matrix accordingly.
  • Adds opt-in telemetry debugging (AZURE_SKILLS_TELEMETRY_LOG_DIR) to persist raw hook inputs and append MCP args to a log file.
  • Improves skill/reference path recognition for local plugin development via AZURE_SKILLS_PLUGIN_ROOT, and generalizes reference path extraction to any */skills/* root.
Show a summary per file
File Description
README.md Updates the client support matrix to reference the new Copilot hooks file path.
plugin/hooks/scripts/track-telemetry.sh Adds opt-in debug logging and local plugin-root detection for reference-file reads.
plugin/hooks/scripts/track-telemetry.ps1 Mirrors the debug logging + local plugin-root detection changes for PowerShell.
plugin/hooks/copilot-hooks.json Introduces a Copilot-format hooks file used by Copilot clients.
plugin/.plugin/plugin.json Points the plugin manifest at ./hooks/copilot-hooks.json explicitly.

Review details

  • Files reviewed: 4/5 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread plugin/hooks/scripts/track-telemetry.sh Outdated
Comment thread plugin/hooks/scripts/track-telemetry.ps1
Comment thread plugin/hooks/scripts/track-telemetry.ps1 Outdated
Comment thread plugin/hooks/scripts/track-telemetry.ps1 Outdated
- Use printf instead of echo for raw-input dumps in track-telemetry.sh so JSON is written losslessly without escape-sequence interpretation.

- Use local time (no trailing Z) for the debug log timestamp in both scripts.

- Fix a stale comment that referenced AZURE_SKILLS_TELEMETRY_LOG instead of AZURE_SKILLS_TELEMETRY_LOG_DIR.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7ace74d0-93aa-4f8c-a9ef-0a928b7d50ad
…d-fiesta

# Conflicts:
#	hooks/copilot-hooks.json
#	hooks/hooks.json
#	plugin/hooks/hooks.json
@JasonYeMSFT

Copy link
Copy Markdown
Member

This doc needs to be updated with the new hooks manifest location. https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/main/docs/hooks.md

Reflect the rename of the Copilot/VS Code hooks manifest away from the default hooks/hooks.json path and explain why (Claude's additive hooks discovery), per issue microsoft#2957.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7ace74d0-93aa-4f8c-a9ef-0a928b7d50ad
@tmeschter

Copy link
Copy Markdown
Member Author

This doc needs to be updated with the new hooks manifest location. https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/main/docs/hooks.md

JasonYeMSFT (@JasonYeMSFT) Done.

@JasonYeMSFT

Copy link
Copy Markdown
Member

scripts/src/plugin/bootstrap.ts script also needs to be updated. It currently creates .plugin/plugin.json without an explicit hooks property.

New plugins scaffolded by bootstrap.ts now set \hooks: ./hooks/copilot-hooks.json\ so no Copilot-format manifest sits at the default hooks/hooks.json path, consistent with issue microsoft#2957.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7ace74d0-93aa-4f8c-a9ef-0a928b7d50ad
@tmeschter

Copy link
Copy Markdown
Member Author

scripts/src/plugin/bootstrap.ts script also needs to be updated. It currently creates .plugin/plugin.json without an explicit hooks property.

JasonYeMSFT (@JasonYeMSFT) I believe I have addressed this. Let me know if it matches your expectations now.

@tmeschter
Tom Meschter (tmeschter) merged commit 049bede into microsoft:main Aug 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants