Repository navigation
perf(deps): upgrade zod to 4.6.7 to shrink the Host's schema memory - #1110
Conversation
The Host loads 20 Harness plugin bundles, and each builds its own zod schemas. A zod 4.4.3 schema instance costs about 5.2 KB (30,426 instances held about 150 MB of a 278 MB live heap); 4.6.7 keeps the same schema in about 1 KB. Cold Host footprint drops from about 428 MB to about 253 MB and the live heap after GC from 251 MB to 111 MB. zod 4.6.7 carries an npm SLSA provenance attestation from zod's release workflow at the commit tagged 4.6.7. The Claude Code bundle still contains the 4.4.3 copy that @anthropic-ai/claude-agent-sdk inlines.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
已核对全仓依赖版本锁定、Zod 变更兼容与供应链审计,内存收益显著且无冲突,已合入 main。 |
Summary
zodfrom4.4.3to4.6.7in the root and the nine workspacepackage.jsonfiles that pin it, and changes only thezodentries inpackage-lock.json.apps/web-uideclares^4.4.3in 29 places, so the Web UI now resolves to 4.6.7 too.registry/desktop-extensionsis outside the workspace with its own lockfile and stays on 4.4.3.@anthropic-ai/claude-agent-sdkinlines.@github/copilot-sdkand@qwen-code/sdkkeep their own nested copies, which are not bundled into the plugins.Measurements
Isolated Web instance with a throwaway data directory, Node v24.18.0, cold Host, usage statistics not triggered.
maincommits, and the "after" figures are a single run, so treat the difference as an estimate.zod behavior changes
I read the 4.5.0–4.6.7 release notes and ran 63 zod usage patterns from this repository against both versions. 56 behave identically. The differences that matter here:
z.iso.datetime()/.datetime()rejects times without seconds, such as06:15ZupdatedAt,fetchedAt,installedAt,publishedAt,observedAttoISOString()or GitHub'spublished_at, both with seconds. A hand-written file that omits seconds would now be rejected..max()is used widely.min(1)is unaffected, and.min(n>1)calls were not enumerated.__proto__key reportsunrecognized_keysinstead of dropping it__proto__passes..max()reports onlytoo_bigremote-sessions.tsusestoo_bigto detect an oversized requesttoJSONSchemaoutput changedNo other difference showed up: common error messages,
z.prettifyError, email and URL acceptance, record keys and recursive JSON schemas all matched.Supply chain
[email protected]is the npmlatest, published 2026-10-12, and has an SLSA provenance attestation naming zod'srelease.ymlworkflow and commitb500a2ee, the commit tagged 4.6.7.npm audit signaturesverified all 818 registry signatures in this lockfile.mainon 2026-09-21 with a compromised git credential, were reverted the same day, and were never published to npm.Not included
I also tried building the bundles as ASCII-only to avoid the double-width in-memory copy of their source text, but the bundles still hold 10–100 non-ASCII characters each (regex literals, tagged templates, third-party comments), so Node keeps storing them as UTF-16 and nothing is saved. That change was dropped.
Related issues
N/A
UI Demo
No visual changes: dependency upgrade.
Test plan
These ran before the branch was rebased onto current
main; the rebase was clean.npm run build:typescript(tsc -bplus the plugin build): passed.packages/shared-contracts/test,packages/protocol-core/test,packages/harness-adapter/test, plusgrok-questions.test.tsandrenderer-schema-config.test.ts: 65 files, 783 tests passed. No test failed on a changed zod message.tests/release(host-bundle,payload,npm-package,lockfile-registry): 102 passed, 1 skipped.npm ci --dry-runconfirmed that the lockfile matches everypackage.json.