Repository navigation
refactor(#2607): remove compress.stripImages — default media folding replaces it - #2688
Conversation
…replaces it Default archivable-media folding (#2640) made the opt-in wire-side image strip redundant, and the strip itself broke the prompt cache every turn on three of four wires (sliding cutoff moves the byte boundary per turn; only anthropic had the fold-anchored boundary). Media handling now has exactly one path: fold + archive + decompress({ imageRef }) recovery. - kernel: strip-images.ts (stripHistoricalImages) retired; wire barrel and wire-google tests updated; acp-kernel 0.0.113 -> 0.0.114 (kernel-change: removing a public wire export that exists only for the removed host policy; no compression behavior changes) - host: strip wiring, fold-anchored cutoff, and DEFAULT_STRIP_IMAGES_KEEP_RECENT removed from handle.ts/server.ts/compress-settings.ts; image-restore.ts keeps the always-on index + spill + decompress machinery (that is the default-fold recovery path, not the strip's) - config: compress.stripImages / compress.stripImagesKeepRecent dropped from the type, whitelist, and parser; old configs get a one-time INERT warning (warnInertStripImages) instead of silent no-op - docs: seeds + generated tables regenerated; EN/ZH prose sections replaced with removal notes; decompress error texts no longer reference the flag - tests: strip-images / strip-images-compact / strip-log-observability / strip-cutoff-anchor suites deleted; compress-settings cascade/parse cases removed; new strip-images-removal.test.ts pins the INERT notice + silence Closes #2608 (archival-failure-still-strips existed only on the strip path; with the strip gone there is nothing to fail)
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2903-pr.2688.46853b8This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2688.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review nit from the PR review: the #618 note above prepareResponsesCompact still described the removed conditional re-serialization ("forward the re-serialized post-strip work instead so dropped images don't ride along"). With the strip gone the call always forwards bodyBuffer unchanged, so the note now matches the code (byte-identical passthrough when no bili compaction item is present).
[bot] 🏷 Review 完成:可合(等新 head 的 CI 全绿)。我拉了分支逐文件通读 diff、本地定向验证、并对最新 master 做了 rebase 检查。结论:方向正确、执行干净,未发现回归;顺手修了一个小问题(stale 注释)已推到 PR 分支。 验证证据
顺手小修(独立标注 commit
既有行为回归清点(逐项)
高危域点名核查:自动更新/自更新路径未触碰;版本与 lockfile — 仅 结构化八问
补充:kernel 改动属 human-only review 层(碰了 判定:可合 —— 待新 head |
[bot] 🏷 CI 全绿确认:rebase 后的新 head 之前 最终判定维持:可合。合并请由 @ranxianglei 本人执行(kernel 改动属 human-only 层)。合并后 #2608 随之关闭。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.236-master.9d1b9d2 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…semantics Supplement to 990cbe8 (which fixed only the tsc errors): under post-#2688 semantics there is no wire-side image reduction left, so the two tests that asserted the removed stripImages recovery path (200 + reduced rebuilt body) fail at runtime with the forward-stage 413. Adapt them to assert the actual contract: over-budget rebuilt bodies stop at stage=forward / request_too_large without touching upstream, whether images sit in messages or tool outputs; the admission-slot flow ends at the same forward guard once a slot is released. Also fix reference/request-body-budget.md (en+zh), which still told users to configure the removed compress.stripImages. Verified locally: tsc --noEmit clean; node --import tsx --test --test-concurrency=1 tests/image-request-budget.test.ts tests/request-body-budget.test.ts -> 10/10 pass.
…-request-budget test ranxianglei#2688 removed compress.stripImages/stripImagesKeepRecent from CompressSettings, but ranxianglei#2613's image-request-budget test (merged after ranxianglei#2688) still referenced them, breaking master typecheck. Drop the dead keys from the fixture config and the inert stripImages=false toggle line; keep every assertion intact (over-budget rebuilt request -> forward-stage 413, no upstream contact). Zero behavioral change.
…rebase (#2671) Rebase onto master (47 commits) surfaced two machine-dependent seams and one real timing bug: 1. Test hermeticity (storage-corpus / storage-unified / golden-storage-drive / web-sessions): these suites point SessionStore at the REPO corpus dirs or tmp dirs and assert on directory contents. On a developer machine whose real billion-context.json sets storage.unified=full (exactly the dogfood setup this PR exists to enable), the config-file tier leaked into every test that cleared the env expecting legacy: stray index.db files inside tests/golden/storage-corpus (breaking the no-orphans pin and being cpSync'd into downstream tmp dirs), sidecars inside web-sessions tmp dirs tripping the #1937/#2180 foreign-content alarms. Pin BILI_CONFIG_FILE to a missing tmp path and clear BILI_STORAGE_UNIFIED at module top of each suite — same pattern master's #2673 established for XDG state. 2. Eager storage-mode stamp: the kernel write chain may invoke the record builder on a later tick than the caller (serialized write chains, #2674). guardedBuild captured effectiveFileStorageMode() inside the deferred thunk, so a save enqueued under one mode could be STAMPED under whatever the env said when a background chain reached the build. Capture the stamp eagerly at enqueue time and thread it into buildRecord. 3. storage-render goldens regenerated (stateDigest + metadata section only; state/blockContents/stats sections unchanged): master #2688 removed compress.stripImages from the effective config, which is mirrored into persisted session metadata.effectiveConfig. Battery: 69/69 (golden-storage-render, storage-corpus, storage-unified, web-sessions, config-file-cache, config-surface-guard, admin-origin, image-request-budget), tsc clean, unused-export gate clean (2 waived). storage-unified passes even with a hostile BILI_STORAGE_UNIFIED=full exported into the test process.
…rebase (#2671) Rebase onto master (47 commits) surfaced two machine-dependent seams and one real timing bug: 1. Test hermeticity (storage-corpus / storage-unified / golden-storage-drive / web-sessions): these suites point SessionStore at the REPO corpus dirs or tmp dirs and assert on directory contents. On a developer machine whose real billion-context.json sets storage.unified=full (exactly the dogfood setup this PR exists to enable), the config-file tier leaked into every test that cleared the env expecting legacy: stray index.db files inside tests/golden/storage-corpus (breaking the no-orphans pin and being cpSync'd into downstream tmp dirs), sidecars inside web-sessions tmp dirs tripping the #1937/#2180 foreign-content alarms. Pin BILI_CONFIG_FILE to a missing tmp path and clear BILI_STORAGE_UNIFIED at module top of each suite — same pattern master's #2673 established for XDG state. 2. Eager storage-mode stamp: the kernel write chain may invoke the record builder on a later tick than the caller (serialized write chains, #2674). guardedBuild captured effectiveFileStorageMode() inside the deferred thunk, so a save enqueued under one mode could be STAMPED under whatever the env said when a background chain reached the build. Capture the stamp eagerly at enqueue time and thread it into buildRecord. 3. storage-render goldens regenerated (stateDigest + metadata section only; state/blockContents/stats sections unchanged): master #2688 removed compress.stripImages from the effective config, which is mirrored into persisted session metadata.effectiveConfig. Battery: 69/69 (golden-storage-render, storage-corpus, storage-unified, web-sessions, config-file-cache, config-surface-guard, admin-origin, image-request-budget), tsc clean, unused-export gate clean (2 waived). storage-unified passes even with a hostile BILI_STORAGE_UNIFIED=full exported into the test process.
Removes
compress.stripImages/compress.stripImagesKeepRecententirely. Default media folding (#2640) made the opt-in wire-side image strip redundant, and the strip itself was a turn-over-turn prompt-cache breaker on three of four wires: its sliding cutoff (len - keepRecent) moves the outgoing byte boundary every turn, so the cache forks at the most expensive content each round (only anthropic had the fold-anchored boundary). Media handling now has exactly one path: fold + archive +decompress({ imageRef })recovery.kernel-change: acp-kernel 0.0.113 → 0.0.114 —
stripHistoricalImages(kernel/src/wire/strip-images.ts) was a public wire export that existed only for this removed host policy; no compression behavior changes.Why now (evidence, not taste)
compress.stripImages默认开启——否则带图消息不可压缩会形成只升不降的输入地板撑爆上下文 #2607's follow-ups landed: archivable media folds by default, pixels spill to<state>/retrieve/img/<session>/BEFORE the fold,decompress({ imageRef })restores them (Archive-then-fold: default folding for archivable media (Closes #2607, Fixes #2609) #2640, kernel 0.0.113).Changes
strip-images.tsdeleted; wire barrel export removed;wire-googlestrip tests removed; version bump.foldAnchoredCutoff+DEFAULT_STRIP_IMAGES_KEEP_RECENTremoved (handle.ts,server.ts,compress-settings.ts).image-restore.tskeeps the always-on index/spill/decompress machinery — that is the default-fold recovery path.[acp-config] … is INERT … was removedwarning (warnInertStripImages, pattern ofwarnInertResignPassthrough).strip-images/strip-images-compact/strip-log-observability/strip-cutoff-anchorsuites deleted; compress-settings cascade/parse cases removed; newstrip-images-removal.test.tspins the INERT notice (fires once, names the keys) and that clean configs stay silent.Verification
check:unused-exportsclean;gen-config-docs check-coverageokCloses #2608