[ISSUE #15201] Fix skill meta description sync on upload#15204
Conversation
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
|
This PR only fixes internal metadata synchronization for existing AI skill ZIP uploads. It does not add or change any API, configuration, default value, or user-facing usage. Therefore no docs update is required. |
There was a problem hiding this comment.
PR 主路径修复是对的,但 description 为空时的 CAS retry 语义确实有问题。第一次 CAS 失败后,如果并发请求已经把 ai_resource.c_desc 更新成新值,当前代码第二次重试仍会用最初 existedMeta.getDesc() 里的旧描述写回去,覆盖掉最新描述。
建议把 description 是否非空作为判断:
boolean syncDescription = StringUtils.isNotBlank(description);
newValue.setDesc(syncDescription ? description : existedMeta.getDesc());
...
if (!syncDescription) {
nv.setDesc(latest.getDesc());
}
这样非空描述表示“本次操作要主动同步描述”,空描述表示“本次只更新 versionInfo,desc 应跟随 latest 保留”。
影响范围:skill 和 agentspec 都受这个通用方法影响;prompt 现有 meta 创建草稿路径没走这个 existing-meta 分支,基本不受本 PR 影响。建议补一个 AiResourceManagerTest:空 description、第一次 CAS 失败、retry find 返回 latest.desc = new-desc,最终第二次 updateMetaCas 捕获到的 desc 应该是 new-desc。
0225224 to
e9d06cc
Compare
|
Fixed the CAS retry behavior from the review comment. Changes:
Verified with:
|
e9d06cc to
53f6b32
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
Fixes #15201.
This PR fixes inconsistent AI skill descriptions between the skill list page and the skill detail/version page after uploading a new ZIP version for an existing skill.
Previously, the uploaded
SKILL.mdfrontmatter description was saved into the version data, but the existing skill meta row only updatededitingVersion. The meta description used by the list page could remain stale while the detail/version page showed the new uploaded description.Brief changelog
Verifying this change
mvn -B clean package apache-rat:check spotbugs:check -DskipTestsmvn -pl ai -am "-Dtest=SkillOperationServiceImplTest#testUploadSkillFromZipShouldSyncMetaDescriptionForExistingSkill" "-Dsurefire.failIfNoSpecifiedTests=false" testmvn -pl ai -am "-Dtest=SkillOperationServiceImplTest" "-Dsurefire.failIfNoSpecifiedTests=false" testmvn -pl ai -am "-Dtest=AiResourceManagerTest" "-Dsurefire.failIfNoSpecifiedTests=false" testmvn -pl ai -am "-Dtest=SkillOperationServiceImplTest,AiResourceManagerTest" "-Dsurefire.failIfNoSpecifiedTests=false" testgit diff --checkmvn clean installwas also attempted locally, but it failed in existingnacos-commontests under JDK 21.0.1 withIllegalAccessException: static final field has no write access, unrelated to this change.Follow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check spotbugs:check -DskipTeststo make sure basic checks pass. Runmvn clean installto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.