Skip to content

refactor: centralize tool plugin hooks + add agent to hook input #13524

Closed

Description

@ArmirKS

Description

prompt.ts has the same before/after plugin hook logic inline in 3 separate places, and none of them pass agent to the hooks. This means plugins can't tell which agent made a tool call — a blocker for any plugin that needs per-agent policy (audit logging, permission enforcement, etc).

Steps to reproduce

  1. Create a plugin that hooks tool.execute.before and logs the input
  2. Trigger tool calls from different agents (primary + subagents via task)
  3. Observe that the hook input has no agent field — the plugin can't distinguish who made the call

Fix

PR #13521 adds Tool.invoke() that centralizes hook wrapping and adds agent to the hook input.

The original batch bypass issue is moot since batch is experimental and being deprecated.

Activity

  1. changed the title [-]bug: batch sub-tool calls bypass plugin hooks (tool.execute.before/after)[/-] [+]refactor: centralize tool plugin hooks + add agent to hook input[/+] on Feb 14, 2026
  2. changed the title [-]refactor: centralize tool plugin hooks + add agent to hook input[/-] [+]centralize tool plugin hooks + add agent to hook input[/+] on Feb 15, 2026
  3. changed the title [-]centralize tool plugin hooks + add agent to hook input[/-] [+]refactor: centralize tool plugin hooks + add agent to hook input[/+] on Feb 15, 2026
  4. github-actions commented on Apr 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions