fix: 修复 Skill 上传时 data_id 超长和 Jackson 反序列化超限问题 - #282
Open
Rito-w wants to merge 2 commits into
Open
Conversation
Issue higress-group#278: 在 uploadPackage 中增加前置校验,上传 ZIP 给 Nacos 前先本地 解析资源文件路径,用 NacosAiConfigKeyCodec.encodeSegment() 模拟 Nacos 的 编码逻辑,检查编码后长度是否超过 config_info.data_id 的 varchar(256) 限制。 超过则返回清晰的错误提示,避免请求打到 Nacos DB 层才报 DataIntegrityViolationException。 Issue higress-group#279: 新增 JacksonConfig 全局配置,通过 StreamReadConstraints.overrideDefaultStreamReadConstraints() 将 maxStringLength 从默认 20M 放宽到 50M,使 Nacos SDK 内部的 ObjectMapper 能正常反序列化包含大体积资源(如 Figma JSON)的 Skill 数据。 Fix higress-group#278 Fix higress-group#279
Rito-w
force-pushed
the
fix/skill-upload-278-279
branch
from
April 27, 2026 02:45
20c4aec to
62a7564
Compare
Collaborator
|
Thanks for the contribution. The fix direction looks reasonable for the Skill upload issues around Nacos To make this easier to land against the latest This PR currently also needs sign-off for the DCO check to pass. |
18 tasks
Collaborator
|
Opened #303 to carry this PR content forward against the latest Thanks again for the original contribution. |
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 21, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
learnerjohn
added a commit
to learnerjohn/himarket
that referenced
this pull request
May 22, 2026
Carry over the Skill upload remediation from higress-group#282. Validate encoded Nacos resource paths before upload so overlong data IDs fail with a clear parameter error, and raise the JVM-wide Jackson string constraint for large Skill resources returned by the Nacos SDK. Co-authored-by: Rito-w <1157530972@qq.com> Signed-off-by: zhaoh <yanyan.zh@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
修复 Agent Skill 上传/下载流程中的两个 Bug:
SkillServiceImpl.uploadPackage()中增加前置校验,上传 ZIP 给 Nacos 前先本地解析资源文件路径,用NacosAiConfigKeyCodec.encodeSegment()模拟 Nacos 的编码逻辑,检查编码后长度是否超过config_info.data_id的varchar(256)限制。超过则返回清晰的INVALID_PARAMETER错误提示,避免请求打到 Nacos DB 层才报DataIntegrityViolationExceptionJacksonConfig全局配置,通过StreamReadConstraints.overrideDefaultStreamReadConstraints()将maxStringLength从默认 20M 放宽到 50M,使 Nacos SDK 内部的ObjectMapper能正常反序列化包含大体积资源(如 Figma JSON)的 Skill 数据🔗 Related Issues
Fix #278
Fix #279
✅ Type of Change
🧪 Testing
手动验证步骤:
INVALID_PARAMETER错误(而非INTERNAL_ERROR)📋 Checklist
mvn spotless:applyfor backend)📚 Additional Notes
Issue #278 的根因在 Nacos Server 端:
NacosConfigAiResourceStorage.save()对含/的资源路径做全量 hex 编码(enc.+ 十六进制),导致长度翻倍。当原始路径超过 126 个 ASCII 字符时,编码后超过varchar(256)限制。本 PR 在 HiMarket 端做防御性校验,根本修复需要 Nacos 上游调整 DB schema 或编码策略。