Skip to content

Preserve hooks in Copilot custom-agent frontmatter - #341712

Merged
Martin Aeschlimann (aeschli) merged 5 commits into
mainfrom
copilot/fix-agent-hooks-issue
Oct 19, 2026
Merged

Martin Aeschlimann (aeschli) merged 5 commits into
mainfrom
copilot/fix-agent-hooks-issue

Conversation

Copilot AI commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Custom-agent frontmatter hooks were dropped during conversion to Copilot SDK configuration, so session-start hooks did not run and pre-tool denials were bypassed. This also affected selected agents from file-based plugins.

  • Changes
    • Forward hook mappings from each agent’s frontmatter into its SDK config.
    • Keep hook mappings scoped to their individual agents, including selected plugin agents.
hooks:
  SessionStart:
    - type: command
      command: echo "session started"
  PreToolUse:
    - type: command
      command: echo '{"permissionDecision":"deny"}'

Copilot AI balanced review requested due to automatic review settings October 15, 2026 08:14

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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

Copilot AI changed the title [WIP] Fix dropped custom agent frontmatter hooks Preserve hooks in Copilot custom-agent frontmatter Oct 15, 2026
@aeschli
Martin Aeschlimann (aeschli) marked this pull request as ready for review October 18, 2026 20:28
@aeschli

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Base: 2ad7418e Current: 0d189ffd

No screenshot changes.

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.

🟡 Changes recommended

Malformed entries discard valid hooks, and runtime execution, denial enforcement, and agent-switch isolation remain untested.

2 open issues

Review effort: Balanced

...(isCustomAgentReasoningEffort(reasoningEffort) ? { reasoningEffort } : {}),
tools: tools && tools.length > 0 ? tools : null,
...(skills !== undefined ? { skills } : {}),
...(hooks ? { hooks } : {}),

Copilot AI commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Resolved by merging current main and preserving the updated plugin-agent catalog behavior. Merge commit: 4546ee7.

Skip malformed custom-agent hook entries without discarding valid commands for the event. Add regression coverage for mixed entries and entirely malformed events.

Co-authored-by: Copilot <[email protected]>
@aeschli
Martin Aeschlimann (aeschli) merged commit c5f8b15 into main Oct 19, 2026
49 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.

Copilot Agent Host: custom agent frontmatter hooks are dropped

6 participants