Skip to content

fix: 修复 Skill 上传时 data_id 超长和 Jackson 反序列化超限问题 - #282

Open
Rito-w wants to merge 2 commits into
higress-group:mainfrom
Rito-w:fix/skill-upload-278-279
Open

fix: 修复 Skill 上传时 data_id 超长和 Jackson 反序列化超限问题#282
Rito-w wants to merge 2 commits into
higress-group:mainfrom
Rito-w:fix/skill-upload-278-279

Conversation

@Rito-w

@Rito-w Rito-w commented Apr 24, 2026

Copy link
Copy Markdown

📝 Description

修复 Agent Skill 上传/下载流程中的两个 Bug:

🔗 Related Issues

Fix #278
Fix #279

✅ Type of Change

  • Bug fix (non-breaking change which fixes an issue)

🧪 Testing

  • Manual testing completed

手动验证步骤:

  1. 构造一个资源文件路径超过 126 字符的 Skill ZIP 包上传,确认返回清晰的 INVALID_PARAMETER 错误(而非 INTERNAL_ERROR
  2. 构造一个路径正常的 Skill ZIP 包上传,确认上传成功不受影响

📋 Checklist

  • Code has been formatted (mvn spotless:apply for backend)
  • Code is self-reviewed
  • Comments added for complex code
  • Documentation updated (if applicable)
  • No breaking changes (or migration guide provided)
  • All CI checks pass

📚 Additional Notes

Issue #278 的根因在 Nacos Server 端:NacosConfigAiResourceStorage.save() 对含 / 的资源路径做全量 hex 编码(enc. + 十六进制),导致长度翻倍。当原始路径超过 126 个 ASCII 字符时,编码后超过 varchar(256) 限制。本 PR 在 HiMarket 端做防御性校验,根本修复需要 Nacos 上游调整 DB schema 或编码策略。

@CLAassistant

CLAassistant commented Apr 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Rito-w added 2 commits April 27, 2026 10:45
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
Rito-w force-pushed the fix/skill-upload-278-279 branch from 20c4aec to 62a7564 Compare April 27, 2026 02:45
@learnerjohn

learnerjohn commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. The fix direction looks reasonable for the Skill upload issues around Nacos data_id length and large Skill resource deserialization.

To make this easier to land against the latest main, we will carry the content of this PR into a new maintainer PR and reference this contribution there.

This PR currently also needs sign-off for the DCO check to pass.

@learnerjohn

Copy link
Copy Markdown
Collaborator

Opened #303 to carry this PR content forward against the latest main. We will continue the merge path there and keep this PR referenced for attribution.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants