test(session): regression coverage for #5894 (subagent tool calls now fire plugin hooks)#36238
Open
EbbuzRM wants to merge 1 commit into
Open
test(session): regression coverage for #5894 (subagent tool calls now fire plugin hooks)#36238EbbuzRM wants to merge 1 commit into
EbbuzRM wants to merge 1 commit into
Conversation
…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.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #5894
Type of change
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