Skip to content

fix(skills): raise the per-file upload limit to 10 MiB - #1306

Merged
Robert0622 merged 5 commits into
mainfrom
codex/skill-file-10mb
Nov 25, 2026
Merged

Robert0622 merged 5 commits into
mainfrom
codex/skill-file-10mb

Conversation

@Robert0622

Copy link
Copy Markdown
Collaborator

Changes

  • Raise the per-file limit to 10 MiB for Skill file and folder uploads, ZIP entries, and SkillHub installs and updates.
  • Update the Skill uploader, English help text, and SkillHub installation warning. MCP uploads and SkillHub inline previews each use a separate 1 MiB limit.

Verification

  • API integration tests upload 10 MiB via multipart and ZIP, reject 10 MiB plus one byte with HTTP 400, and verify the saved file downloads byte-for-byte after rejection.
  • SkillHub integration tests install a package with a 2 MiB file and reject an oversized package. MCP tests check the 1 MiB boundary for multipart and ZIP uploads.
  • Passed the Skill and MCP Go regression tests, the full Go web package tests, and the Node tests for Skill files, the SkillHub market, and internationalized navigation.

@cocofhu00

Copy link
Copy Markdown
Contributor

结论:建议合入

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
crispinhu27 previously approved these changes Nov 24, 2026

@crispinhu27 crispinhu27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/repo and ./web all pass.
  • Front end: webtest passes 259/259.
  • Some tests in ./internal/runtime, ./internal/runner and ./internal/engine fail 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 CI core passes at this head.
  • CI is all green at this head, including core, first-run and the e2e jobs.
  • Real deployment: I ran the PR binary against MariaDB 11.8 (max_allowed_packet 16 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 toast SKILL.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.

roberttwang and others added 3 commits November 24, 2026 15:10
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>
@Robert0622

Copy link
Copy Markdown
Collaborator Author

CR + 部署实测(head ad9fcc8f)

这次推了 3 个提交

  1. Merge branch 'main':解决 web/i18n-en.js 的冲突。main 新增的 18 条「加入申请」文案和本分支的 10MB 帮助文案都保留,词条数量和 main 一致(3849 条)。

  2. fix(skills): align migration 042 with the 10 MiB file limit:合并后的语义冲突。main 上 fix(skills): store catalog bodies as files #1296 带进来的 migrations/042_skill_bodies_to_files.sql 写死了 1 MiB(body_exceeds_1_mib / 1048576),所以合并后:

    • 1–10 MiB 的旧技能正文,服务端已经能接收,迁移预检却会拦下;
    • TestMySQLSkillBodyMigrationPreflight 断言 migratedSize == domain.SkillFileMaxBytes,在 MySQL 8.4.7 上实测失败(size=1048576)。

    改法:阈值改成 10 MiB,原因名改为 body_exceeds_10_mib,同步改测试边界和 docs/api/registry.md。修复后这个测试通过。

  3. fix(runner): deliver skill files at the 10 MiB cap to remote runners:上限放到 10 MiB 以后,远端执行机跑不了带大文件的技能。有两个原因:

    • 认领 SQL:ClaimRunnerTask / RunnerTasks 按 created_at 排序时,把整行(含 payload)一起排序。payload 超过 sort_buffer_size(默认 256KB)时,MySQL 报 Error 1038 Out of sort memory。实测带 10 MiB 技能文件的任务,执行机日志里一直刷这个错,run 卡在 running。
    • 执行机客户端:认领响应只读 8 MiB,技能文件转成 base64 以后放不下,报 decode ... unexpected end of JSON input。

    改法:认领和列表查询只对 id 排序;认领响应的读取上限加上技能和 MCP 文件总上限的 base64 大小(domain.RunnerTaskAssetWireLimit)。新增的 TestMySQLRunnerTaskWithLargeSkillFileIsListedAndClaimed 和 TestClaimDecodesSkillFilesAtUploadLimits,修复前失败、修复后通过。(这个提交的补丁由同一定时任务的另一轮评审给出,我这边复现后合进来。)

部署实测(本机原生部署 PR 和 main 两个实例,MySQL 8.4.7,全新库)

场景 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 crispinhu27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 500 Error 1038 (HY001): Out of sort memory.
    • main 91bcf98 with 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.
  • TestMySQLRunnerTaskWithLargeSkillFileIsListedAndClaimed: passes at the head on MySQL 8.4. Ported to the merge-base, it fails with task list dropped the large runner task.
  • TestMySQLSkillBodyMigrationPreflight (empty database): passes at the head (10 MiB boundary and body_exceeds_10_mib) and at the merge-base.
  • ./internal/repo full suite on MySQL 8.4: the only failures are TestMySQLReadsObserveExternalChangesWithoutReload and TestMySQLGitSSHCredentialLifecycle, 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 ./... and go vet pass. ./internal/domain, ./web, and the ./internal/runner TestClaim* tests (including the new TestClaimDecodesSkillFilesAtUploadLimits) pass. The full ./internal/runner suite 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_EN from main and from the head. The only difference is the help text key, which changed from 1MB to 10MB, and assets.js uses 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/domain and ./web all 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.

@cocofhu00

Copy link
Copy Markdown
Contributor

结论:建议合入

GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。

SkillFileMaxBytes 提高到 10MiB,MCPFileMaxBytes 仍是 1MiB,SkillHub 预览用单独的 1MiB 上限,安装包走技能文件上限。readBoundedPart 和 readSkillZipBytes 按传入上限拒绝多出来的 1 字节,技能总大小仍受 64MiB 限制。范围就是上传上限。与 main 无冲突,检查项均成功。可以合入。

@Robert0622
Robert0622 merged commit 56d57e8 into main Nov 25, 2026
16 checks passed
@Robert0622
Robert0622 deleted the codex/skill-file-10mb branch November 25, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants