Skip to content

Conversation

@fang-tech
Copy link
Contributor

@fang-tech fang-tech commented Jan 21, 2026

AgentScope-Java Version

1.0.7

Description

refactor(skill): simplify skill lifecycle and improve tool group activation

BREAKING CHANGE: Skill tool groups now persist across conversation turns

Changes:

  • Remove skill deactivation logic from SkillHook's PreCallEvent/PostCallEvent handlers
  • Move tool group activation from SkillHook to SkillToolFactory
  • Add Toolkit binding to SkillToolFactory for direct tool group management
  • Simplify SkillHook to only handle skill prompt injection in PreReasoningEvent

Test improvements:

  • Refactor SkillHookTest to focus on unit testing hook responsibilities
  • Add SkillRuntimeIntegrationTest for end-to-end skill activation flow
  • Add tests for SkillBox.bindToolkit() method
  • Add tests for tool group activation when loading skills
  • Remove redundant integration tests from SkillHookTest

This change ensures that once a skill is loaded, its associated tools remain
available throughout the conversation, eliminating the need to reload skills
in each turn. The tool group is now automatically activated when a skill is
loaded through the load_skill_through_path tool.

Fixes: Tool groups being deactivated between conversation turns

relate #584

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@fang-tech fang-tech requested review from a team and Copilot January 21, 2026 04:54
@gemini-code-assist
Copy link

Summary of Changes

Hello @fang-tech, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the skill management system to simplify its lifecycle and enhance the persistence of tool groups. By centralizing tool group activation within the SkillToolFactory and removing deactivation logic from the SkillHook, skills and their associated tools now remain active throughout a conversation once loaded. This change resolves an issue where tools would be prematurely deactivated, leading to a more robust and intuitive skill interaction experience. The accompanying test improvements ensure comprehensive validation of these new behaviors.

Highlights

  • Simplified Skill Lifecycle: The SkillHook has been streamlined, removing its responsibilities for skill deactivation and tool group state synchronization. It now primarily focuses on injecting skill prompts.
  • Persistent Tool Group Activation: Skill tool groups are no longer deactivated between conversation turns. Once a skill is loaded, its associated tools remain active, addressing a previous issue where tools would become unavailable.
  • Centralized Tool Group Management: The responsibility for activating skill tool groups has been moved from SkillHook to SkillToolFactory, which now directly manages the Toolkit binding. This ensures tool groups are activated precisely when a skill is loaded.
  • Enhanced Test Coverage: The testing suite has been improved with a refactored SkillHookTest focusing on unit responsibilities and the introduction of SkillRuntimeIntegrationTest to validate the end-to-end skill activation and usage flow, including multi-turn persistence.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the skill lifecycle management, simplifying the SkillHook and moving tool group activation logic to SkillToolFactory. The goal is to make skill tool groups persist across conversation turns. The changes are well-organized and supported by improved unit tests and new integration tests. However, I've identified a potential issue in the new activation logic where loading a new skill might deactivate previously loaded ones, which seems to contradict the main goal of this refactoring. Please see my specific comment for details.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the skill lifecycle management to simplify how skills and their associated tool groups are activated. The main change is moving tool group activation from SkillHook to SkillToolFactory, ensuring that once a skill is loaded, its tools persist throughout the conversation instead of being deactivated between turns.

Changes:

  • Removed skill deactivation logic from SkillHook (previously triggered on PreCallEvent/PostCallEvent)
  • Tool group activation now happens in SkillToolFactory when a skill is loaded via load_skill_through_path
  • SkillHook simplified to only inject skill prompts during PreReasoningEvent

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
SkillToolFactory.java Added Toolkit binding support and tool group activation when loading skills
SkillHook.java Removed PreCallEvent/PostCallEvent handlers, now only handles PreReasoningEvent for prompt injection
SkillBox.java Added bindToolkit() method with documentation to support ReActAgent's deep-copied Toolkit
SkillRuntimeIntegrationTest.java New integration test suite for end-to-end skill activation flow
SkillHookTest.java Refactored to focus on unit testing prompt injection behavior
SkillBoxToolsTest.java Enhanced tests to verify tool group activation when loading skills
SkillBoxTest.java Added tests for bindToolkit() functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AlbumenJ AlbumenJ merged commit 24201af into agentscope-ai:main Jan 22, 2026
5 checks passed
@fang-tech fang-tech deleted the refactor/skill/tool-lifespan branch January 23, 2026 02:50
Alexxigang pushed a commit to Alexxigang/agentscope-java that referenced this pull request Jan 25, 2026
…vation (agentscope-ai#615)

## AgentScope-Java Version

1.0.7

## Description

refactor(skill): simplify skill lifecycle and improve tool group
activation

BREAKING CHANGE: Skill tool groups now persist across conversation turns

Changes:
- Remove skill deactivation logic from SkillHook's
PreCallEvent/PostCallEvent handlers
- Move tool group activation from SkillHook to SkillToolFactory
- Add Toolkit binding to SkillToolFactory for direct tool group
management
- Simplify SkillHook to only handle skill prompt injection in
PreReasoningEvent

Test improvements:
- Refactor SkillHookTest to focus on unit testing hook responsibilities
- Add SkillRuntimeIntegrationTest for end-to-end skill activation flow
- Add tests for SkillBox.bindToolkit() method
- Add tests for tool group activation when loading skills
- Remove redundant integration tests from SkillHookTest

This change ensures that once a skill is loaded, its associated tools
remain
available throughout the conversation, eliminating the need to reload
skills
in each turn. The tool group is now automatically activated when a skill
is
loaded through the load_skill_through_path tool.

Fixes: Tool groups being deactivated between conversation turns

relate agentscope-ai#584

## Checklist

Please check the following items before code is ready to be reviewed.

- [x]  Code has been formatted with `mvn spotless:apply`
- [x]  All tests are passing (`mvn test`)
- [x]  Javadoc comments are complete and follow project conventions
- [x] Related documentation has been updated (e.g. links, examples,
etc.)
- [x]  Code is ready for review
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.

2 participants