Repository navigation
fix(skills): raise the per-file upload limit to 10 MiB - #1306
Conversation
|
结论:建议合入 GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。 核对了技能单文件上限从 1MB 提到 10MB,MCP 上传和 SkillHub 预览仍是 1MB。multipart、ZIP 和入库三处都按传入的上限截断,超限会拒绝且不会留下半截文件;测试断言了正好 10MB 可下载、多 1 字节返回 400,以及 MCP 仍拒绝超过 1MB。英文帮助文案已改成 10MB。CI 的 core 仍在跑,其余检查已通过,与 main 可合并。 |
crispinhu27
left a comment
There was a problem hiding this comment.
Reviewed head 9a0d7375 (base main be35aff, which is also the merge-base). This is a first review.
Scope: the full diff. I traced the per-file cap through the multipart and ZIP upload paths (readBoundedPart, readSkillZip, readSkillZipBytes), repo.writeSkillFileRow, the SkillHub install and preview paths, and the MCP file paths that now use their own MCPFileMaxBytes. I also checked the skill_files.content MEDIUMBLOB column (16 MiB), the request body limit (64 MiB + 1 MiB), and the front-end checks in assets.js and skillhub.js.
Verification:
- Go tests (offline sandbox):
go test ./internal/httpapi -run 'Skill|MCPFile|Skillhub|Runner', plus./internal/domain,./internal/repoand./weball pass. - Front end:
webtestpasses 259/259. - Some tests in
./internal/runtime,./internal/runnerand./internal/enginefail locally. These need Docker, Chromium or a bwrap sandbox, which this container does not have. They fail the same way at the merge-base, and CIcorepasses at this head. - CI is all green at this head, including
core,first-runand the e2e jobs. - Real deployment: I ran the PR binary against MariaDB 11.8 (
max_allowed_packet16 MiB) with synthetic data.POST /api/skills/:id/files: a single 10 MiB file returns 200, and 10 MiB + 1 byte returns 400超过 10MB 限制. A ZIP with a 10 MiB entry returns 200, and a ZIP with a 10 MiB + 1 byte entry returns 400.- The downloaded file's sha256 matches the upload.
- A single request with 6 × 10 MiB files (60 MiB total) returns 200, and the content is intact.
- MCP files: 1 MiB returns 200, and 1 MiB + 1 byte returns 400
超过 1MB 限制, for both multipart and ZIP uploads.
- Browser (Chromium): the skill page help text reads
单文件 ≤10MB. A 10 MiB + 1 byte SKILL.md is blocked in the browser with the toastSKILL.md 超过 10MB 限制, and no request is sent. A 10 MiB SKILL.md goes through the overwrite confirmation and uploads with HTTP 200. The DB row is 10485760 bytes.
Non-blocking note: this limit existed before this PR. The task claim response is read with responseLimit := 8 << 20 in internal/runner/client.go. Once a skill's files reach about 7 MiB in total, the base64-encoded Assets.SkillFiles makes the claim response larger than that limit. The runner then fails to parse it (decode POST /runners/tasks/claim response: unexpected end of JSON input).
- I reproduced this at the merge-base be35aff with 7 × 1 MiB files, so this PR does not introduce it and the 64 MiB total skill cap is unchanged.
- With this PR, a single file of 7 MiB or more hits it. A file of 6 MiB or less claims normally.
- If running large skills on remote runners is a goal, consider a follow-up to raise that limit or have the runner fetch skill files separately.
I did not test a real SkillHub upstream (no service available). The SkillHub install and update paths are covered by the integration tests in this PR, which pass. I found no blocking issues, so I'm approving.
Resolve the web/i18n-en.js conflict by keeping main's new project join request strings and this branch's 10 MiB Skill file help text. Co-Authored-By: Claude Code <noreply@anthropic.com>
Main's migration 042 moves legacy catalog bodies into skill_files and blocks bodies over 1 MiB, matching the old per-file cap. With the cap raised to 10 MiB, the preflight would reject bodies the server now accepts, and TestMySQLSkillBodyMigrationPreflight fails because the migrated size no longer equals domain.SkillFileMaxBytes. Raise the migration threshold to 10 MiB, rename the blocker reason to body_exceeds_10_mib, update the MySQL test boundaries, and fix the API registry note. Co-Authored-By: Claude Code <noreply@anthropic.com>
The claim response was read with an 8 MiB limit, so a task carrying a skill file of about 6 MiB or more failed to decode on the runner. Allow the base64 size of the skill and MCP upload caps on claims. On MySQL, claiming and listing runner tasks sorted whole rows and failed with "Out of sort memory" once a payload outgrew sort_buffer_size. Sort only the task ids instead. Co-Authored-By: Claude Code <noreply@anthropic.com>
CR + 部署实测(head
|
| 场景 | PR | main |
|---|---|---|
| multipart 上传刚好 10 MiB / 6 MiB / 1 MiB+1 | 200,下载后 sha256 一致 | 400 |
| multipart 上传 10 MiB+1 | 400「超过 10MB 限制」 | 400 |
| zip 内条目 10 MiB / 10 MiB+1 | 200 / 400,被拒后原有文件集不变 | 400 |
| 单独上传 3 MiB 的 SKILL.md | 200 | 400 |
PUT /api/skills 带 1.5 MiB content(#1296 的 SKILL.md 落文件路径) |
200,SKILL.md 大小正确 | 400 |
| MCP 文件 1 MiB / 1 MiB+1 | 200 / 400(仍是 1MB 限制) | 同 |
| 远端执行机跑引用 10 MiB 技能文件的 Agent 节点 | 认领成功,.agentflow/skills/<id>/payload.bin 落盘 10485760 字节,sha256 一致 |
修复前:认领一直报 1038,任务不下发 |
回归
go test ./...:PR 和 main 失败的用例完全相同(26 项,都是本机缺 Chromium、git 身份等环境原因),没有新增失败。go vet ./...、scripts/check-public.py通过;webtest 283/283 通过。
遗留(不阻塞,main 上本来就有):一个 Agent 的技能文件合计超过 MySQL max_allowed_packet(8.4 默认 64MB)时,runner 任务写不进库。建议另开 issue 处理。
结论:冲突已解决,发现的 2 处问题已修复并复测通过,可以合入。推送后之前的 Approve 已经失效,需要其他 reviewer 重新批准;CI 16 项检查已全部通过。
crispinhu27
left a comment
There was a problem hiding this comment.
Re-review of head ad9fcc8f (base main 91bcf98). My earlier APPROVE on 9a0d7375 was dismissed by the new push. This review covers the three new commits: the merge from main (1f1d6001), migration 042 aligned to 10 MiB (22f2f3fb), and the runner claim fix (ad9fcc8f). I also re-checked the earlier changes after the merge.
Scope: the web/i18n-en.js conflict resolution; migrations/042_skill_bodies_to_files.sql and its MySQL test; RunnersRepo.RunnerTasks / ClaimRunnerTask (sort ids only, claim selects id/attempt and then reloads the row through takeRunnerTask); the claim response limit RunnerTaskAssetWireLimit in internal/runner/client.go; and how the claim payload reaches the runner (engine/assets.go → runtime/skill_tree.go).
Verification (offline sandbox, MySQL 8.4.9 with default settings: sort_buffer_size 256 KiB, max_allowed_packet 64 MiB, same major version as compose.yaml):
- Real HTTP claim: I ran an in-process httpapi server on MySQL 8.4, registered a runner with a bootstrap token, queued a runner task carrying a 10 MiB skill file, and claimed it with
runner.Client.Claim.- Head
ad9fcc8f:RunnerTasks()lists the task, the claim returns 200, the runner gets all 10485760 bytes, and the sha256 matches. - Previous head
9a0d7375: the list drops the task, and the claim returns 500Error 1038 (HY001): Out of sort memory. - main
91bcf98with a 1 MiB file: same 1038 error. So this was already broken on main for files over the sort buffer, and this PR fixes it.
- Head
TestMySQLRunnerTaskWithLargeSkillFileIsListedAndClaimed: passes at the head on MySQL 8.4. Ported to the merge-base, it fails withtask list dropped the large runner task.TestMySQLSkillBodyMigrationPreflight(empty database): passes at the head (10 MiB boundary andbody_exceeds_10_mib) and at the merge-base../internal/repofull suite on MySQL 8.4: the only failures areTestMySQLReadsObserveExternalChangesWithoutReloadandTestMySQLGitSSHCredentialLifecycle, and they fail the same way at the merge-base.- Skill, SkillHub and MCP httpapi tests, pointed at MySQL 8.4 instead of SQLite: all 20 pass, including the 10 MiB / 10 MiB + 1 byte multipart and ZIP boundaries.
go build ./...andgo vetpass../internal/domain,./web, and the./internal/runnerTestClaim*tests (including the newTestClaimDecodesSkillFilesAtUploadLimits) pass. The full./internal/runnersuite has the same 25 failures at the head and the merge-base, all because there is no bwrap or Chromium here.webtest: 283/283 pass.- i18n merge: I loaded
LF_I18N_ENfrom main and from the head. The only difference is the help text key, which changed from 1MB to 10MB, andassets.jsuses the new key. All of main's new strings are kept. - Latest main
177d8815(#1295): the PR merges cleanly. On the merged tree, the build, the two MySQL tests above,TestClaim*, the skill/runner httpapi tests,./internal/domainand./weball pass. - CI: all 16 checks pass at this head.
Not covered: a real SkillHub upstream, and a real remote runner executing an Agent node end to end (the claim was checked over real HTTP with the real client, but no CLI ran). Pre-existing and not blocking: one Agent's total skill payload can still exceed MySQL max_allowed_packet once base64-encoded. That was already true before this PR.
I found no blocking issues in this revision, so I'm approving.
|
结论:建议合入 GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。
|
Changes
Verification
webpackage tests, and the Node tests for Skill files, the SkillHub market, and internationalized navigation.