fix(sdk): raise browser daemon bundle budget to 126 KiB - #5801
Conversation
The workspace permissions rules API (QwenLM#5743) added workspacePermissions and the set/add/remove rule methods plus their types to the browser-facing DaemonClient (~718 bytes minified) without raising MAX_DAEMON_BROWSER_BUNDLE_BYTES. On top of the 125 KiB budget set in QwenLM#5775, the daemon SDK bundle grew to 128651 bytes and exceeded the 128000-byte cap, breaking `npm run build` on main (E2E Tests fail at the bundle assertion). These are public class methods on DaemonClient and are not tree-shakeable, so the bytes ship regardless of consumers. Raise the cap one notch to 126 KiB (129024 bytes), following the established per-feature bump pattern.
|
Thanks for the PR, @wenshao! Template: the PR body doesn't follow the repo's PR template headings (missing "What this PR does", "Why it's needed", "Reviewer Test Plan", "Risk & Scope", "Linked Issues"). That said, the description is thorough and the change is trivially small — not blocking on template compliance for a one-line constant bump. On direction: this is a clear CI fix — On approach: the change is exactly what's needed — 中文说明感谢 @wenshao 的 PR! 模板:PR 正文没有使用仓库的 PR 模板标题(缺少 "What this PR does"、"Why it's needed"、"Reviewer Test Plan"、"Risk & Scope"、"Linked Issues")。不过描述内容充分,且改动极小——对于一行常量的修改,不因模板问题阻塞。 方向:明确的 CI 修复—— 方案:改动恰到好处—— — Qwen Code · qwen3.7-max |
Code ReviewThe diff is a textbook-minimal fix: one constant bump ( My independent proposal before reading the diff: same approach — bump Reuse check: N/A — this is a constant adjustment, not logic. TestingThis is a build-script constant change with no user-visible behavior — tmux real-scenario testing is not applicable. The CI environment doesn't have a fully bootstrapped SDK build pipeline, but the math is straightforward to verify:
The PR author independently reproduced the failure locally (esbuild 0.25.12, bundle = 128,651 bytes, byte-identical to CI) and confirmed the fix passes the build. Root cause analysis (isolating the permissions API delta via esbuild metafile) is thorough and convincing. 中文说明代码审查Diff 是最小化的标准修复:一处常量上调( 我在阅读 diff 之前的独立方案:同样的做法——上调 复用检查:不适用——这是常量调整,非逻辑代码。 测试这是构建脚本的常量修改,无用户可见行为——tmux 真实场景测试不适用。CI 环境没有完整的 SDK 构建流水线,但数学验证很简单:
PR 作者独立在本地复现了故障(esbuild 0.25.12,bundle = 128,651 字节,与 CI 完全一致),并确认修复后构建通过。根因分析(通过 esbuild metafile 隔离 permissions API 增量)严谨且有说服力。 — Qwen Code · qwen3.7-max |
|
Stepping back: this is exactly the kind of fix you want to see when The PR matches my independent proposal perfectly. The root cause analysis is more detailed than I'd expect for a one-line fix (esbuild metafile isolation, byte-identical local reproduction), which gives high confidence the diagnosis is correct. The fix does exactly what it says: bump the budget by 1 KiB following the established pattern. The only minor note: the PR body doesn't follow the repo template, and the 373-byte headroom is tight — but neither is worth blocking. The next feature that touches the SDK bundle will likely need another bump regardless, and at that point someone should probably audit whether any dead surface can be trimmed rather than continuing to bump the cap. Clean fix, ships what it promises, unblocks 中文说明退一步看:这正是 PR 方案与我的独立方案完全一致。根因分析的深度超出一行修复的预期(esbuild metafile 隔离、本地字节级复现),令人高度确信诊断正确。修复做了它说要做的事:按既有惯例上调 1 KiB 预算。 唯一的小备注:PR 正文没有遵循仓库模板,373 字节余量偏紧——但都不值得阻塞。下一次涉及 SDK bundle 的功能添加时很可能需要再次上调上限,届时应该审计是否有废弃代码可以裁剪,而不是一直提高上限。 干净的修复,实现了承诺,解除了 — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
wenshao
left a comment
There was a problem hiding this comment.
No issues found. Downgraded from Approve to Comment: self-PR; CI still running. LGTM! ✅
— qwen3.7-max via Qwen Code /review
Resolve MAX_DAEMON_BROWSER_BUNDLE_BYTES conflict: keep both bump reasons (workspace permissions API + prompt clientId self-heal). Both land in the merged bundle (measured 129228 bytes), which exceeds 126 KiB, so the budget must be 127 KiB.
7248ab7
Summary
mainis red on the E2E Tests workflow — every job fails in Install dependencies at the SDK build step:Root cause
The browser-facing daemon SDK bundle has a hard size budget,
MAX_DAEMON_BROWSER_BUNDLE_BYTES, currently 125 KiB (128000 bytes). The workspace permissions rules API (#5743) addedworkspacePermissionsand theset/add/removerule methods plus their types toDaemonClient(~718 bytes minified) but did not raise the budget. #5775 had just set the budget to 125 KiB while adding its own surface; #5743 was cut from an earlier base and stayed green on its own CI, so the two only combined over the budget once both landed onmain. The bundle is now 128651 bytes — 651 over.The voice-dictation merge (#5755) that the failing run points at did not touch
sdk-typescriptat all; it was simply the first push afterward to run the build and surface the pre-existing breakage.Fix
Raise
MAX_DAEMON_BROWSER_BUNDLE_BYTESone notch to 126 KiB (129024 bytes), following the established per-feature bump pattern documented in the same file. The permissions methods are public class methods onDaemonClientand are not tree-shakeable, so the bytes ship regardless of consumers — trimming is not an option without splitting the client.Verification
src/types/types.ts) are not in the bundle.npm run build --workspace=packages/sdk-typescriptpasses (bundle 128651 ≤ 129024, 373 bytes headroom).中文说明
概述
main分支的 E2E Tests 工作流全部失败,每个 job 都在 Install dependencies 的 SDK 构建步骤报错:根因
面向浏览器的 daemon SDK bundle 有一个硬性体积上限
MAX_DAEMON_BROWSER_BUNDLE_BYTES,当前为 125 KiB(128000 字节)。workspace permissions rules API(#5743)向DaemonClient新增了workspacePermissions以及set/add/remove规则方法和相关类型(压缩后约 718 字节),但没有同步上调上限。#5775 在加入自身代码时刚把上限设为 125 KiB;而 #5743 基于更早的分支,单独跑 CI 时是绿的,两者各自合入后在main上叠加才超出预算。当前 bundle 为 128651 字节,超出 651 字节。报错那次构建指向的语音听写合并(#5755)根本没有改动
sdk-typescript,它只是之后第一个触发构建、从而暴露这个既有问题的 push。修复
按文件中既有的「每个功能上调一档」惯例,将
MAX_DAEMON_BROWSER_BUNDLE_BYTES上调一档到 126 KiB(129024 字节)。这些 permissions 方法是DaemonClient上的 public 类方法,无法被 tree-shaking 移除,无论是否有调用方都会进入 bundle —— 不拆分 client 就无法削减。验证
src/types/types.ts)并不在 bundle 内。npm run build --workspace=packages/sdk-typescript通过(bundle 128651 ≤ 129024,余量 373 字节)。