Fix Nacos skill marketplace latest label resolution#1589
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5d30ed0 to
d5a17cf
Compare
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR correctly identifies the root cause — Nacos's getSkillVersionDetail API expects an actual version string, not a label name — and routes the call through getSkillMeta first to resolve a real version from the labels map. The control flow, null/blank guards, and the clear IllegalStateException on unresolvable labels are all reasonable.
However, the fix as written likely will not work end-to-end against Nacos's standard publish flow. In Nacos (com.alibaba.nacos.ai.constant.AiResourceConstants) the canonical label key for the latest published version is "latest" (lowercase), set automatically by SkillOperationServiceImpl#publish(...) when updateLatestLabel=true. The PR reuses the existing LATEST_VERSION = "LATEST" (uppercase) constant as the lookup key into skillMeta.getLabels(), which will miss the canonical label and trip the new IllegalStateException for any skill published the normal way. The test steps in the PR description ("create a skill with a LATEST label") effectively work around the bug by asking the tester to set a non-standard label.
Secondary items: the class Javadoc still describes the old getSkillVersionDetail(..., "LATEST") behavior and should be refreshed; the constant LATEST_VERSION is now semantically a label key, not a version, so renaming it (e.g. to LATEST_LABEL) keeps intent clear.
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
All previously raised review comments have been addressed.
AgentScope-Java Version
main branch
Description
Background
When using the Builder Nacos marketplace, skill preview/install can fail while loading a skill version detail.
The previous implementation passed the label name
LATESTdirectly as theversionargument togetSkillVersionDetail(namespaceId, skillName, version). However, the Nacos skill version detail API expects the actual skill version value, not the label name.This could produce a request equivalent to:
Nacos then returns an error similar to:
Purpose
This PR fixes Nacos-backed Builder marketplace preview/install by resolving the real skill version from the skill metadata labels before loading the skill version detail.
Changes Made
LATESTlabel in the skill metadata.getSkillVersionDetail(...).LATESTlabel cannot be resolved.How to Test
LATESTlabel pointing to an online skill version.Expected result:
version=LATEST.Local validation:
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)