test(kit): Add test for GetToolsForSubagent()#73
Conversation
|
Connected to Huly®: KIT-74 |
📝 WalkthroughWalkthroughAdds a new test for ChangesGetToolsForSubagent test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/kit/kit_test.go`:
- Around line 675-676: The HelloInput.Query struct field in kit_test.go uses a
non-standard JSON tag, so update its tag to follow the repository’s snake_case
convention and keep the schema key consistent; locate the Query field in
HelloInput and change the json tag to a snake_case name, using omitempty if that
field is optional.
- Around line 695-711: The subagent test is asserting model prose in
result.Response instead of the actual tool selection, so update the test around
host.Subagent and host.GetToolsForSubagent() to directly inspect the returned
tool set and verify the expected tools are present or absent. Use the
SubagentConfig setup as-is, but replace the “hello”/“subagent” string checks
with assertions on the tool list/filtering behavior so the test validates
GetToolsForSubagent() deterministically.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
bc7f670 to
6e2c5ca
Compare
`GetToolsForSubagent()` was added in commit: Make subagent inherit tools from parent (mark3labs#51) ef072f6 to collect all tools from the main agent but exclude the 'subagent' tool. The resulting tool list may be passed to the `Tools` argument of `SubagentConfig`. The test works as follows: 1. The main 'kit' instance is configured with a `CoreToolList` only containing 'subagent' and 'bash'. 2. A 'hello' tool is provided as `ExtraTools` in `kit.Options`. In this case, the main 'kit' instance will only have the 'subagent', 'bash' and 'hello' tool. `GetToolsForSubagent()` should filter out the 'subagent' tool. `GetToolsForSubagent()` is called and the result is checked against the expected list. Signed-off-by: Egbert Eich <eich@suse.com>
6e2c5ca to
d0437f9
Compare
|
The linter issues seen in the CI are false positives and not related to the changes I've submitted: apparently, the linter doesn't recognize that a call to |
GetToolsForSubagent()was added in commit:Make subagent inherit tools from parent (#51)
ef072f6
to collect all tools from the main agent but exclude the 'subagent' tool. The resulting tool list may be passed to the
Toolsargument ofSubagentConfig.The test works as follows:
CoreToolListonly containing 'subagent' and 'bash'.ExtraToolsinkit.Options. In this case, the main 'kit' instance will only have the 'subagent', 'bash' and 'hello' tool.GetToolsForSubagent()should filter out the 'subagent' tool.GetToolsForSubagent()is called and the result is checked against the expected list.Summary by CodeRabbit