Skip to content

Revert "Add hook to Canvas plugin to encourage using the sync tool on every turn start" - #327

Merged
Akshay Maloo (akshaymaloo) merged 1 commit into
mainfrom
revert-320-lesaltzm/synchook
Jul 28, 2026
Merged

Revert "Add hook to Canvas plugin to encourage using the sync tool on every turn start"#327
Akshay Maloo (akshaymaloo) merged 1 commit into
mainfrom
revert-320-lesaltzm/synchook

Conversation

@lesaltzm

Copy link
Copy Markdown
Contributor

Reverts #320. The hooks change broke in Claude

Copilot AI review requested due to automatic review settings July 28, 2026 15:05
@lesaltzm
McCall Saltzman (lesaltzm) requested a review from a team as a code owner July 28, 2026 15:05
@lesaltzm

Copy link
Copy Markdown
Contributor Author

Copilot change the versions to be 2.2.1

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 reverts the canvas-apps prompt hook introduced in #320 because it broke in Claude, restoring the plugin to a no-hooks configuration while keeping the newer unified /canvas-app skill as the recommended entrypoint.

Changes:

  • Remove the canvas-apps lifecycle hook registration and its .NET prompt-transform implementation.
  • Update canvas-apps plugin manifests to drop the hooks field and revert the plugin version.
  • Add/restore a deprecated generate-canvas-app skill stub that redirects users to /canvas-app.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plugins/canvas-apps/skills/generate-canvas-app/SKILL.md Adds a deprecated skill wrapper that instructs users to use /canvas-app instead.
plugins/canvas-apps/hooks/inject-sync-reminder.cs Removes the .NET hook that injected a sync reminder into prompts.
plugins/canvas-apps/hooks/hooks.json Removes hook registration for Claude/Copilot prompt events.
plugins/canvas-apps/AGENTS.md Updates plugin architecture docs to remove the hooks section and references.
plugins/canvas-apps/.plugin/plugin.json Removes hooks registration and reverts the plugin version.
plugins/canvas-apps/.claude-plugin/plugin.json Mirrors the Open Plugins manifest change (remove hooks, revert version).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akshaymaloo
Akshay Maloo (akshaymaloo) merged commit 384363f into main Jul 28, 2026
4 of 5 checks passed
@akshaymaloo
Akshay Maloo (akshaymaloo) deleted the revert-320-lesaltzm/synchook branch July 28, 2026 15:09
Ryan Gammon (rggammon) added a commit to rggammon/power-platform-skills that referenced this pull request Jul 29, 2026
Re-applies the hook from microsoft#320, which was reverted in microsoft#327 because it broke
Claude Code. The hook logic (inject-sync-reminder.cs) is restored byte-for-byte;
only the registration wiring changed.

Two defects in microsoft#320, either one fatal:

1. `"hooks": "hooks/hooks.json"` in .claude-plugin/plugin.json. Claude Code's
   manifest schema rejects a string path, failing installation outright with
   `Validation errors: hooks: Invalid input`. Claude auto-discovers
   hooks/hooks.json, so the field is unnecessary — model-apps and power-pages
   both ship working hooks without it.

2. The `userPromptTransformed` key in hooks/hooks.json. Claude Code reads that
   file too and rejects unrecognized event keys. The resulting hook-load-failure
   silently discards the whole file, and also disables the plugin's
   canvas-authoring MCP server:
     [ERROR] Failed to load hooks for canvas-apps
     [DEBUG] Plugin not available for MCP - error type: hook-load-failed

Registration is now split by host. Claude Code reads only
.claude-plugin/plugin.json; Copilot CLI prefers .plugin/plugin.json and falls
back to .claude-plugin/ only when absent. So the Copilot-only event lives inline
in .plugin/plugin.json, where Claude Code never sees it:

  Claude Code | hooks/hooks.json (auto-discovered) | UserPromptSubmit
  Copilot CLI | .plugin/plugin.json (inline)       | userPromptTransformed

Two events are required because the hosts share no usable one: Copilot accepts
UserPromptSubmit as an alias for userPromptSubmitted, but that event has no
output processing, so the reminder would be generated and silently discarded.

Also re-applies microsoft#320's removal of the deprecated generate-canvas-app skill,
which the revert restored, and corrects the AGENTS.md claim that Claude Code
"ignores the Copilot-only event and continues loading UserPromptSubmit" — the
behaviour that caused this outage.

Verified on Claude Code 2.1.220 and Copilot CLI 1.0.76-1: plugin installs and
loads (status enabled, MCP intact) and the reminder reaches the model in both
hosts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Ryan Gammon (rggammon) added a commit to rggammon/power-platform-skills that referenced this pull request Jul 29, 2026
Re-applies the hook from microsoft#320, which was reverted in microsoft#327 because it broke
Claude Code. The hook logic (inject-sync-reminder.cs) is restored byte-for-byte;
only the registration wiring changed.

Two defects in microsoft#320, either one fatal:

1. `"hooks": "hooks/hooks.json"` in .claude-plugin/plugin.json. Claude Code
   rejects the path unless it is `./`-relative, failing installation with
   `Validation errors: hooks: Invalid input`. Even written as
   `"./hooks/hooks.json"` it is redundant — Claude auto-discovers the file, then
   reports the explicit reference as a duplicate hook source and disables the
   plugin's MCP servers. model-apps and power-pages ship working hooks with no
   `hooks` field at all.

2. `userPromptTransformed` in hooks/hooks.json. Claude Code reads that file and
   rejects unrecognized event names, silently discarding the whole file and
   disabling the plugin's canvas-authoring MCP server:
     [ERROR] Failed to load hooks for canvas-apps
     [DEBUG] Plugin not available for MCP - error type: hook-load-failed

Registration now uses the two documented plugin hook formats, so each host reads
only the events it supports:

  Claude Code | hooks/hooks.json (Claude format)      | UserPromptSubmit
  Copilot CLI | hooks.json at plugin root (Copilot)   | userPromptTransformed

Two events are required because the hosts share no usable one: Copilot accepts
UserPromptSubmit as an alias for userPromptSubmitted, but that event has no
output processing, so the reminder would be generated and silently discarded.
Both manifests stay byte-identical mirrors, so the legacy compatibility check is
unaffected.

Also re-applies microsoft#320's removal of the deprecated generate-canvas-app skill,
which the revert restored, and corrects the AGENTS.md claim that Claude Code
"ignores the Copilot-only event and continues loading UserPromptSubmit" — the
behaviour that caused this outage.

Verified on Claude Code 2.1.220 and Copilot CLI 1.0.76-1: plugin installs and
loads (status enabled, MCP intact) and the reminder reaches the model in both
hosts. All four repository validation scripts pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Ryan Gammon (rggammon) added a commit that referenced this pull request Jul 29, 2026
Re-applies the hook from #320, which was reverted in #327 because it broke
Claude Code. The hook logic (inject-sync-reminder.cs) is restored byte-for-byte;
only the registration wiring changed.

Two defects in #320, either one fatal:

1. `"hooks": "hooks/hooks.json"` in .claude-plugin/plugin.json. Claude Code
   rejects the path unless it is `./`-relative, failing installation with
   `Validation errors: hooks: Invalid input`. Even written as
   `"./hooks/hooks.json"` it is redundant — Claude auto-discovers the file, then
   reports the explicit reference as a duplicate hook source and disables the
   plugin's MCP servers. model-apps and power-pages ship working hooks with no
   `hooks` field at all.

2. `userPromptTransformed` in hooks/hooks.json. Claude Code reads that file and
   rejects unrecognized event names, silently discarding the whole file and
   disabling the plugin's canvas-authoring MCP server:
     [ERROR] Failed to load hooks for canvas-apps
     [DEBUG] Plugin not available for MCP - error type: hook-load-failed

Registration now uses the two documented plugin hook formats, so each host reads
only the events it supports:

  Claude Code | hooks/hooks.json (Claude format)      | UserPromptSubmit
  Copilot CLI | hooks.json at plugin root (Copilot)   | userPromptTransformed

Two events are required because the hosts share no usable one: Copilot accepts
UserPromptSubmit as an alias for userPromptSubmitted, but that event has no
output processing, so the reminder would be generated and silently discarded.
Both manifests stay byte-identical mirrors, so the legacy compatibility check is
unaffected.

Also re-applies #320's removal of the deprecated generate-canvas-app skill,
which the revert restored, and corrects the AGENTS.md claim that Claude Code
"ignores the Copilot-only event and continues loading UserPromptSubmit" — the
behaviour that caused this outage.

Verified on Claude Code 2.1.220 and Copilot CLI 1.0.76-1: plugin installs and
loads (status enabled, MCP intact) and the reminder reaches the model in both
hosts. All four repository validation scripts pass.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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