Skip to content

feat(mysql): add MysqlSkillRepository and associated tests for skill …#600

Open
jianjun159 wants to merge 15 commits intoagentscope-ai:mainfrom
jianjun159:skill_mysql
Open

feat(mysql): add MysqlSkillRepository and associated tests for skill …#600
jianjun159 wants to merge 15 commits intoagentscope-ai:mainfrom
jianjun159:skill_mysql

Conversation

@jianjun159
Copy link
Contributor

…management

AgentScope-Java Version

[The version of AgentScope-Java you are working on, e.g. 1.0.7, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]

version: 1.0.7

Description

[Please describe the background, purpose, changes made, and how to test this PR]

feat(mysql): add MysqlSkillRepository and associated tests for skill management #599

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

@jianjun159 jianjun159 requested a review from a team January 19, 2026 07:53
@gemini-code-assist
Copy link

Summary of Changes

Hello @jianjun159, 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 introduces a significant enhancement to the AgentScope-Java framework by integrating MySQL as a persistent storage solution for agent skills. It provides a robust and secure mechanism for managing skill metadata and associated resources, allowing for scalable and reliable skill management within AgentScope applications. This addition expands the data persistence options available for AgentScope components.

Highlights

  • New Module Introduction: A new Maven module, agentscope-extensions-skill-mysql, has been added to provide MySQL database integration for skill management.
  • MySQL Skill Repository Implementation: The MysqlSkillRepository class implements the AgentSkillRepository interface, enabling AgentSkill objects and their associated resources to be stored, retrieved, updated, and deleted in a MySQL database.
  • Robust Database Operations: The repository supports automatic table creation, full CRUD operations, transaction management for atomic operations, and robust identifier validation to prevent SQL injection vulnerabilities.
  • Flexible Configuration: A builder pattern is provided for flexible configuration of the MysqlSkillRepository, allowing customization of database and table names, and read/write permissions.
  • Comprehensive Unit Testing: Extensive unit tests have been added to cover constructor behavior, CRUD operations, read-only mode, repository information, and critical SQL injection prevention mechanisms.
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 introduces a MysqlSkillRepository for persisting agent skills in a MySQL database. The implementation is robust, with good practices like using a builder pattern, transaction management, and validation to prevent SQL injection. The accompanying unit tests are comprehensive and well-structured.

I've identified a few areas for improvement, primarily concerning data integrity, performance, and transactional behavior. My key recommendations are:

  • Enforcing data integrity by adding the documented foreign key constraint to the database schema.
  • Optimizing the getAllSkills method to resolve an N+1 query issue.
  • Revisiting the transaction logic in the save method to handle lists of skills more predictably.
  • A minor performance enhancement in resource insertion and a correction in the corresponding unit test.

Overall, this is a solid contribution. Addressing these points will make the repository more performant and resilient.

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 99 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e/skill/repository/mysql/MysqlSkillRepository.java 72.72% 88 Missing and 11 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@AlbumenJ AlbumenJ left a comment

Choose a reason for hiding this comment

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

@fang-tech PTAL

@fang-tech
Copy link
Contributor

@fang-tech PTAL

👌

Copy link
Contributor

@fang-tech fang-tech left a comment

Choose a reason for hiding this comment

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

LGTM, tks for your contribution!


Bind Tools to Skills for on-demand activation. Avoids context pollution from pre-registering all Tools, only passing relevant Tools to LLM when the Skill is actively used.

**Lifecycle of Progressively Disclosed Tools**: Tool lifecycle remains consistent with Skill lifecycle. Once a Skill is activated, Tools remain available throughout the entire session, avoiding the call failures caused by Tool deactivation after each conversation round in the old mechanism.
Copy link
Contributor

Choose a reason for hiding this comment

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

do not change this statement

Copy link
Contributor

Choose a reason for hiding this comment

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

update here, do not change this

@fang-tech
Copy link
Contributor

Update the unnecessary modifications in the English document

@jianjun159
Copy link
Contributor Author

Update the unnecessary modifications in the English document

Ok. Now the content of the Chinese document and the English document is consistent

@fang-tech
Copy link
Contributor

@AlbumenJ help to merge

*
* @return the number of skills deleted
*/
public int clearAllSkills() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

clearAllSkills() currently does not check the writeable flag. Given that both save() and delete() enforce this check to prevent write operations in read-only mode, is it intentional that clearAllSkills() bypasses it?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not the case. This check really needs to be conducted. It was overlooked.

@LearningGp
Copy link
Collaborator

image

# Conflicts:
#	agentscope-distribution/agentscope-all/pom.xml
@jianjun159
Copy link
Contributor Author

image

The latest branch code has been merged and this conflict has been resolved

@LearningGp
Copy link
Collaborator

Please ensure all review comments are resolved before we proceed. Kindly take another look.

@jianjun159
Copy link
Contributor Author

Please ensure all review comments are resolved before we proceed. Kindly take another look.

All the review comments have been resolved. Thank you for your 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.

5 participants