feat(copilot): add agentStop/subagentStop hook events and prompt-file agent frontmatter - #1896
Merged
Merged
Conversation
… agent frontmatter Part A: Extend the Copilot cloud coding-agent hook surface (.github/hooks/) to the upstream-documented eight events by mapping canonical `stop` to `agentStop` and `subagentStop` to `subagentStop`. `subagentStart` remains unsupported as it is not part of the documented cloud-agent surface. Part B: Add first-class `agent` prompt-file frontmatter for Copilot commands (VS Code values ask/agent/plan/custom), keeping the deprecated `mode` accepted and migrating it to `agent` on import (explicit `agent` wins). Closes #1880 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
@dyoshikawa Thank you! |
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Follow-up on GitHub Copilot upstream updates for the cloud coding-agent target (
copilot,.github/hooks/). This does not touchcopilotcli, which already mapped these events.Part A —
agentStop/subagentStophook eventsGitHub now documents an eight-event surface for
.github/hooks/*.json(sessionStart,sessionEnd,userPromptSubmitted,preToolUse,postToolUse,agentStop,subagentStop,errorOccurred).stopandsubagentStoptoCOPILOT_HOOK_EVENTS.stop → agentStopandsubagentStop → subagentStoptoCANONICAL_TO_COPILOT_EVENT_NAMES(the reverse map is derived and auto-updates).subagentStartis intentionally not added — it is not part of the documented cloud-agent surface (—in the matrix).copilot-hooks.tsreads these constants generically, so no adapter logic change was needed.Part B — prompt-file
agentfrontmatterVS Code prompt-file frontmatter now uses
agent(ask|agent|plan| custom agent name), replacing the deprecatedmode.agent: z.optional(z.string())toCopilotCommandFrontmatterSchema.modeis still accepted for backward compatibility and is migrated toagenton import; when both are present, the explicitagentvalue wins.agentis preserved on both generate and import via thecopilotrulesync section.Docs & tests
Copilotcolumn to ✅ for thestopandsubagentStoprows indocs/reference/file-formats.md(leftsubagentStartas—); updated the hook-mapping prose and the commands frontmatter example; re-syncedskills/rulesync/.copilote2e generate case to assertagentStop, added a dedicated e2e test forstop/subagentStop→agentStop/subagentStop.copilot-hooks.test.ts(both directions) andcopilot-command.test.ts(mode→agentmigration, explicit-agentprecedence, andagentround-trip).Validation evidence
Verification
pnpm cicheckis fully green (fmt, oxlint, typecheck, 6414 tests across 267 files, cspell, secretlint, skill-docs sync).Closes #1880
🤖 Generated with Claude Code