Skip to content

test(session): regression coverage for #5894 (subagent tool calls now fire plugin hooks)#36238

Open
EbbuzRM wants to merge 1 commit into
anomalyco:devfrom
EbbuzRM:dev
Open

test(session): regression coverage for #5894 (subagent tool calls now fire plugin hooks)#36238
EbbuzRM wants to merge 1 commit into
anomalyco:devfrom
EbbuzRM:dev

Conversation

@EbbuzRM

@EbbuzRM EbbuzRM commented Jul 10, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #5894

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

I looked into #5894 planning to fix the plugin hooks not firing for
subagent tool calls, but I couldn't reproduce it on current dev.

I wrote two tests that delegate to a subagent via the task tool and
then have the subagent call another tool, checking that
tool.execute.before/after fire under the subagent's own session id
(not the parent's): one with a mocked Plugin.Service, one loading a
real plugin file through the actual plugin loader. Both already pass
on dev with no source changes.

I also manually tested the background: true path against a live
opencode serve instance with a real plugin file and it fired
correctly there too (not included as an automated test since it
depends on real timing against a live server).

How did you verify your code works?

bun test test/session/prompt.test.ts — 58 pass, 1 pre-existing skip
unrelated to this change, 0 fail. Also manually verified the
background subagent scenario against a running opencode serve
instance + the HTTP API.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…calls now fire plugin hooks)

Adds two tests proving tool.execute.before/after fire for tool calls made
from within a subagent's own session, scoped to the subagent's own
sessionID — the exact scenario reported in anomalyco#5894 as broken.

Both pass on current main. No source changes: the plugin hook
invocation appears to already fire correctly for subagent tool calls,
foreground and background, but there was no regression test locking
in the behavior.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

[BUG] Plugin hooks (tool.execute.before) don't intercept subagent tool calls - security policy bypass

1 participant