Repository navigation
fix(#3516): keep jimp out of dist (P0 release blocker) + wire pi/omp guardrail knobs - #3524
Merged
Merged
Conversation
added 2 commits
October 17, 2026 16:26
…l dep + dist-no-zod build gate #3516 P0 (from #3511 final pre-release review): #3425's jimp swap was inlined via noExternal, carrying jimp's transitive zod import verbatim into dist/index.js & dist/agent/pi-native.js (16 static imports each). Installs without a node_modules tree (dsh profile bundles) then die at startup with ERR_MODULE_NOT_FOUND while model traffic silently bypasses compression. - jimp removed from tsup noExternal and added to explicit external (tsup only auto-externalizes dependencies/peerDeps, not optionalDependencies) - src/image-rescale.ts resolves jimp once at first use; a failed resolution is permanent per process and degrades rescaling to pass-through - jimp moved devDependencies -> optionalDependencies (sharp precedent: installed where possible, silently skipped where not) - new build gate scripts/check-dist-no-zod.mjs fails the build on any static zod import in dist (the original offender class, forever)
createBiliPlugin called wireToolGuardrails(pi) with no opts, so the owner-approved #3066/#3331 defaults never reached production: bash 60s timeout injection never fired, and the documented BILI_GUARDRAIL_* / guardrails.* switches had zero effect (disable switches dead too — wireToolGuardreads treats undefined as its 50KB default, so the knob's undefined(disabled) maps to 0(no cap)). Also register the existing FileConfig.guardrails field in KNOWN_TOP_LEVEL_KEYS so a user spelling it right is no longer flagged as an unknown key.
1 of 11 tasks
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4170-pr.3524.f73953eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3524.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Closed
…ernal-zod build gate Conflict resolution (#3519 vs #3524, same P0, two designs): - tsup.config.ts: keep jimp EXTERNAL + lazy-load degrade (this branch's design). Master's noExternal:["zod"] is dropped as moot — with jimp out of the bundle nothing statically imports zod, so bundling it had no effect anymore. dist/index.js shrinks 7.1MB -> 4.8MB. - package.json build line: keep master's check-dist-external-zod.mjs gate (stricter: flags literal import("zod") too, catches any future static zod leak). This branch's check-dist-no-zod.mjs + tests/dist-no-zod.test.ts removed as the weaker duplicate. - ework's optionalDependencies jimp + guardrail knob wiring unchanged. Verified: npm run build + dist-external-zod gate OK; thin install (bare dist, no node_modules) `node dist/index.js --version` exit 0; issue3400-image-rescale 18 + check-dist-external-zod 3 + opencode-native-v1 28 = 49 pass; typecheck clean.
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.530-master.6dc41f6 # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(ai: vllm-qwen/qwen3.8-27b)
Resolves P0 and P1-3 of #3516 (v0.1.198 release blockers found in the #3511 final pre-release review). One PR per issue per loop-guard; the remaining #3516 checklist items stay tracked there.
What & why
P0 — jimp dragged zod into dist (availability-level). #3425's image-rescale swap put jimp in
noExternal, so tsup inlined it — carrying jimp's transitiveimport { z } from "zod"verbatim intodist/index.jsanddist/agent/pi-native.js(16 static imports each, verified by building master). Installs without a node_modules tree (dsh profile bundles — the mainstream plugin install path) then crash at startup withERR_MODULE_NOT_FOUND: zodwhile model traffic silently bypasses compression. Violates AGENTS.md KDD#1 (dist entries dependency-free; only opencode-native may touch zod, lazily).Fix:
noExternal+ added to explicitexternal(tsup only auto-externalizes dependencies/peerDeps — an optionalDependency would still be bundled);src/image-rescale.tsresolves jimp once at first use; a failed resolution is permanent per process and degrades rescaling to pass-through (originals forwarded untouched, one warn log).devDependencies→optionalDependencies(the sharp precedent): installed where possible, silently skipped where not.scripts/check-dist-no-zod.mjs(chained intonpm run build) fails on ANY static zod import in dist — the offender class is now structurally impossible to re-land.P1-3 — guardrail knobs dead in production.
createBiliPlugincalledwireToolGuardrails(pi)with no opts, so the owner-approved #3066/#3331 defaults never reached production: bash 60s timeout injection never fired, and every documentedBILI_GUARDRAIL_*/guardrails.*switch was inert. The call site now passesguardrailBashTimeout()/guardrailMaxOutputBytes() ?? 0/guardrailRepetition()(the?? 0maps knob-undefined(disabled) → wireToolGuardrails' 0(no-cap); undefined there means its 50KB default). Also registers the existingFileConfig.guardrailsfield inKNOWN_TOP_LEVEL_KEYS(it was missing, so correctly-spelled user configs got unknown-key warnings).Verification (local, on this head)
node index.js --version→ERR_MODULE_NOT_FOUND: zod; after — prints version, exit 0.npm run build: both gates pass (dist-import-annotations: OK,dist-no-zod: OK);dist/index.js+dist/agent/pi-native.jseach carry exactly one DYNAMICimport("jimp"); zero static zod anywhere in dist.npm run typecheckclean; targeted suites green:tests/issue3400-image-rescale.test.ts+tests/tool-guardrails-pi.test.ts+tests/config-surface-guard.test.ts+tests/knobs-config-precedence.test.ts= 78/78.Behavior changes (flagged per policy)
BILI_GUARDRAIL_BASH_TIMEOUT=0/guardrails.*now genuinely disable each piece (old: switches had no effect in either direction).guardrails.*/BILI_GUARDRAIL_*were already documented in CONFIGURATION.md en+zh — they simply work now; no migration needed. No config-shape invention.Closes: n/a (checklist issue #3516 stays open for the remaining items)
Fixes: #3516 P0 + #3516 P1-3 items
Source review: #3511