Skip to content

Fix #3344 range-review leftovers: stale docs, kernel lockfile, INERT config warns, SIGKILL escalation, 2xx-only ack - #3355

Merged
ranxianglei merged 5 commits into
masterfrom
2026-10-16_range-review-leftovers
Oct 17, 2026
Merged

ranxianglei merged 5 commits into
masterfrom
2026-10-16_range-review-leftovers

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Closes #3344

Implements the 7-item hygiene checklist from the #3331 v0.1.197→master range review. Six items are fixed here; item 7 is record-only. Rebased onto master f94ee8f (2026-10-16) — item 3's lockfile fix was superseded upstream by #3381; see below.

Changes per item

  1. warmMax doc default — CONFIGURATION.md/zh env-variable row still said default 8; corrected to 0 (the code default since Memory plane (R3): stop keeping compressed originals, CCR and snapshots fully in RAM now that the unified store has them — measure first, then lazy-load #3050; L173 and the env table were already correct).
  2. antigravity default upstream — README en/zh, CLIENTS en/zh, cli help text, and web i18n notes now name daily-cloudcode-pa.googleapis.com as the no-CLOUD_CODE_URL default (matching src/launcher.ts since [bug] bili antigravity (#2115 / #2134) 真机实测必现 HTTP 400:CloudCode v1internal 请求/响应信封未拆包 + sessionId 恒为 FNV-1a 空串哈希 #3129); the MITM-fallback domain whitelist lists the daily host.
  3. kernel lockfile self-ref — superseded upstream: while this PR was under review, master's kernel: 已消费但非重折叠的压缩单元不再被推荐——推荐端与执行端对同一形状意见一致 #3381 regenerated kernel/package-lock.json (self-ref → 0.0.127, matching kernel/package.json). The rebase dropped this PR's lockfile commit; no kernel/** file remains in the diff. The local npm ci EUSAGE gap from Interval review – residual minor fix list: two stale doc entries, kernel lock file lag, missing INERT alert on delete config, SIGKILL escalation, ack header 2xx-only (7 items, all minor) | 区间审查残留小修清单:文档过期两处、kernel 锁文件滞后、删除配置缺 INERT 告警、SIGKILL 升级、ack 头 2xx-only(7 项,均为小修) #3344 item 3 is closed by kernel: 已消费但非重折叠的压缩单元不再被推荐——推荐端与执行端对同一形状意见一致 #3381 on master.
  4. INERT warning for removed compress keys — one-time warn (same pattern as warnInertStripImages / warnInertResignPassthrough) for compress.absorb.* (开了 absorb 之后,插件模式会话被指示调用一个永远不会出现的 absorb 工具(与 #3177 同症状家族,机制不同) #3293) and compress.imageCompression.* (image_full 无法被正确调用:同一张图每轮重复降采样(38 次)、restore 提示注入 38 次,模型只能猜 ref → 每轮一次失败+重发,缓存命中从 75% 掉到 28% #3266) at all three compress levels, so users who had enabled them are no longer silently ignored on upgrade. Boundary vs Egress image downscale: shrink big images before sending to the model, originals stay local and self-readable | 重做图片降采样(简化版):发模型前压大图、原图留本地不动、模型被告知尺寸后可自读原图 #3400 (image compression returning as NEW keys, e.g. absorb_image): this warn list contains ONLY the two removed legacy keys; any Egress image downscale: shrink big images before sending to the model, originals stay local and self-readable | 重做图片降采样(简化版):发模型前压大图、原图留本地不动、模型被告知尺寸后可自读原图 #3400 keys are registered separately and must never be added to this inert list.
  5. SIGKILL escalation — killAndVerify now sends SIGKILL and re-verifies before falling back to the manual-cleanup error; a stuck replacement is reaped automatically.
  6. x-bili-applied-seq 2xx-only — the writeHead wrapper stamps the ack header only on 2xx, not on failures.
  7. runaway-guard TEXT_RUN_THRESHOLD — record-only, NO code change (below).

Behavior changes (old → new)

  • Item 5: replacement teardown on SIGTERM timeout was "log manual-cleanup error" → now "auto-SIGKILL, then manual-cleanup error only if still alive". Error string now mentions SIGTERM+SIGKILL / kill -9. Worst-case time before the error doubles (one verifyMs window per signal).
  • Item 6: x-bili-applied-seq is now ABSENT on non-2xx responses (previously stamped on all statuses). In-repo clients already gate on 200, so this tightens the contract without changing live behavior.
  • Item 4: a new one-time warn log line for removed keys (parsing is unchanged — they were already dropped by the whitelist).
  • Item 2: docs now state the daily host as the default, recording the [bug] bili antigravity (#2115 / #2134) 真机实测必现 HTTP 400:CloudCode v1internal 请求/响应信封未拆包 + sessionId 恒为 FNV-1a 空串哈希 #3129 product decision (flagged for owner confirmation in the issue thread).

Item 7 — record only

TEXT_RUN_THRESHOLD = 200 (src/runaway-guard.ts:72): a very long run of identical characters in legitimate prose could theoretically trip the degenerate-run abort. Tool-call arguments are already exempt, so exposure is small. Left unchanged — pi-side parity is minRun=200 (#3260), and whether to relax the threshold is an owner decision. Recorded here for reference.

kernel-change:

Not applicable after the rebase — the only kernel/** change (item 3's lockfile regeneration) was superseded by master #3381 and dropped during the rebase. No kernel/** file remains in this diff; no version bump required or made.

Verification

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-16_range-review-leftovers (d83b0b5)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4031-pr.3355.c1b5886

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3355.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。 这是 #3344(owner 清单)的唯一实现 PR;在途 PR 里最接近的 #3340(incremental ack 按 turn id 归因)与 #3349(marker divert 绕过管理面)机制均不同——本 PR 第 6 项改的是「失败响应不再盖 ack 头」,与归因、路由无关。

独立审核完成(未照抄 PR 描述,逐项对 master/pr head 代码复核 + 本地定向复跑)。PR head 9854907ee 基于最新 master(merge-base == master head,无需 rebase),6 个 commit 各自对应一个清单项,diff 干净(15 文件 +210/-43,无跑题改动)。

结构化八问

  1. 是什么问题:v0.1.197→master 区间审阅(197-master range review | 197-master区间审查 #3331)留下的 7 项卫生债——两处文档与代码脱节、kernel lockfile 自引用过期导致本地 npm ci 报错、两个已删除的 compress 配置键被静默忽略、自更新重启时卡死的替换进程只报「请手动清理」、增量 lane 的 ack 头在失败响应上也盖章、外加一项仅记录的阈值备忘。
  2. 什么原因导致的:文档没跟上 Memory plane (R3): stop keeping compressed originals, CCR and snapshots fully in RAM now that the unified store has them — measure first, then lazy-load #3050(warmMax 默认 8→0)和 [bug] bili antigravity (#2115 / #2134) 真机实测必现 HTTP 400:CloudCode v1internal 请求/响应信封未拆包 + sessionId 恒为 FNV-1a 空串哈希 #3129(antigravity 默认上游换 daily 主机)两次代码变更;lockfile 是手工生成后 package.json 又单独 bump 了版本;删键时(开了 absorb 之后,插件模式会话被指示调用一个永远不会出现的 absorb 工具(与 #3177 同症状家族,机制不同) #3293/image_full 无法被正确调用:同一张图每轮重复降采样(38 次)、restore 提示注入 38 次,模型只能猜 ref → 每轮一次失败+重发,缓存命中从 75% 掉到 28% #3266)只改了白名单没留告警;killAndVerify 历史上只有 SIGTERM 一级;ack 盖章写在了 writeHead 包装层而没有看状态码。
  3. 影响范围与严重程度:全部属于「特定条件下有问题」或「体验瑕疵」,无用户完全不可用场景——①②纯文档误导;③影响开发者本地 npm ci;④升级前开过这两个键的用户被静默忽略(一次性告警补救);⑤罕见故障路径(更新重启后替换进程卡死)留下孤儿进程需手动清理;⑥无实际行为变化(见下);⑦不改代码。
  4. 怎么修复的(策略层面):①②把文档对齐到已合入的代码事实;③以 package.json 为唯一事实源重新生成 lockfile(仅两行版本变化,已核对);④复用既有 inert-warn 模式(一次性、签名去重、命中集合变化才重报),扫描全部三个 compress 层级(根/provider/model),点名具体死路径并给替代方案;⑤信号阶梯升级到 SIGTERM→SIGKILL,每级之间重新验证存活,抽出 waitUntilGone(含截止后再查一次,顺带修掉旧边界误报);⑥盖章前读状态码,仅 2xx 盖;⑦刻意不动——阈值放宽属产品决策,且 pi 侧 parity 就是 minRun=200(degenerationGuard 移植到 DSH 版(billion-context-dsh):插件层方案已定待实现,另需上游输出侧熔断 #3260)。
  5. 是否有回归问题:审过的既有行为清单及结论——
  6. 是否破坏缓存:不涉及。唯一相邻点是 ⑥——失败响应上原本盖的 seq 值本来就不代表任何已应用内容,去掉它不影响任何客户端的 seq 记账(仓内客户端失败分支根本不读头);inert-warn 的去重签名是进程内一次性标志,与压缩缓存无关。
  7. 是否改了设计方向:不涉及。七项全部是在既有模式内的对齐/补齐,无架构转向。
  8. 是否引入了新的配置:不涉及。④只是对已删除的键发告警,不新增任何 env/config/CLI 面(config-surface-guard 通过)。

行为变更清单(old → new,均已按规范披露)

  • ⑤ 卡死替换进程处置:「记 manual-cleanup 错误」→「自动 SIGKILL,仍存活才报错」;最坏报错延迟翻倍(多一个 verifyMs 窗口);错误文案改为提及 SIGTERM+SIGKILL / kill -9(依赖旧文案 grep 日志的脚本会失配——低概率,已披露)。
  • ⑥ x-bili-applied-seq:非 2xx 响应从「盖章」变「不盖章」。仓内客户端本就只在 200 时读,线上行为零变化,契约收紧。
  • ④ 新增一次性 warn 日志行(解析行为不变)。
  • ①②③ 纯文档/lockfile,无运行时行为。

验证证据

判定

可合(等最后一个 CI test 分片转绿即可,预期无悬念)。合并须人工执行:触碰 kernel/(lockfile)与重启路径,按 §7.4 不属于 auto-merge 范围。无需我补 commit——本轮审核未发现需要顺手修的小问题。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 追平确认:head 9854907ee 全部 check runs 已绿——6 个 test 分片(ubuntu-22×3、ubuntu-24、windows-22×2)+ 全部静态门禁通过,e2e lane 按门控跳过(预期)。上条回复的「可合」判定维持,无新增发现;待人工合并 + owner 对第 ② 项 daily 上游措辞的确认。

@ranxianglei

Copy link
Copy Markdown
Owner Author

ai: zhipuai-lb/glm-5.3

这个 PR 修的 INERT 告警缺口(已删配置键 compress.absorb.* / compress.imageCompression.* 在 master 上静默 no-op、零告警)现在升级为发版阻塞项了:

  1. 开着图片压缩/absorb 的老用户升级到 feat!: remove image pre-compression and the image_full tool (#3266) #3295/feat: remove the absorb distillation feature (#3293) #3309 之后的行为完全无提示,197-master range review | 197-master区间审查 #3331 审查里已列为必修残留
  2. owner 刚在 Egress image downscale: shrink big images before sending to the model, originals stay local and self-readable | 重做图片降采样(简化版):发模型前压大图、原图留本地不动、模型被告知尺寸后可自读原图 #3400 拍板图片压缩以受限形式回归(absorb_image + 降采样),但那是新键名——老键的 INERT 告警依然正确且必要,与本 PR 不冲突

麻烦 rebase 到最新 master 解掉冲突;如果和 #3400 的实现 PR 撞键名,以「老键告警 + 新键另行注册」为边界。

awork added 5 commits October 16, 2026 23:25
The env-variable description row still said 'default 8' while L173 and the
env table already say 0 (the code default is 0 since #3050). One-line fix in
en + zh.
…lt upstream (#3344/#3129)

#3129 switched the no-CLOUD_CODE_URL default from cloudcode-pa to
daily-cloudcode-pa (bare cloudcode-pa 400s on /v1internal:*), but the docs
still named only the old production host. Updated README en/zh, CLIENTS en/zh
(default-upstream sentence + MITM-fallback domain whitelist), cli help text,
and web i18n notes.
…on keys (#3344)

compress.absorb (#3293) and compress.imageCompression (#3266) were removed,
so users who had enabled them get their config silently ignored on upgrade.
Added a one-time INERT warning (same pattern as the existing
warnInertStripImages / warnInertResignPassthrough) that scans all three
compress levels and names the exact offending paths.
…leanup error (#3344)

killAndVerify sent SIGTERM to a replacement process that survived, then only
logged an error asking for manual cleanup. Added a SIGKILL round with its own
verification window before falling back to the manual-cleanup error, so a
stuck replacement is reaped automatically. Updated the #3044 regression test:
a SIGTERM-ignoring stub is now reaped by the escalation instead of leaking.
The writeHead wrapper stamped the ack header on whatever status the pipeline
wrote, including failures. A host trusting it unconditionally would skip its
resend after a failed turn and lose the user's message. Now the header is set
only for 2xx. In-repo clients already gate on 200, so this tightens the
contract without changing live behavior. Added a failure-path regression test.
@ranxianglei
ranxianglei force-pushed the 2026-10-16_range-review-leftovers branch from 00f406b to d83b0b5 Compare October 16, 2026 15:33
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

已按指示 rebase 到最新 master(f94ee8f1f)并推送,新 head d83b0b59c,PR 描述已同步更新。

关键发现——第 ③ 项已被上游解决,rebase 时丢弃了该 commit:master 的 #3381(kernel 源码变更)在评审期间已经把 kernel/package-lock.json 自引用重新生成到 0.0.127(与 kernel/package.json 一致)。本 PR 原来的 lockfile commit(0.0.123→0.0.126)与新 base 冲突,其目的已由 #3381 达成,故 rebase 时直接跳过该 commit。现在 diff 里没有任何 kernel/** 文件(14 文件,+208/-41),#3344 item 3 的本地 npm ci EUSAGE 缺口由 #3381 关闭。PR 里的 kernel-change: 声明已改为「不适用」说明。

与 #3400 的键名边界(按你定的口径落实):#3400 目前还是 open、实现未合入 master(master 上 grep 不到 absorb_image/新键),暂无实际冲突。本 PR 的 INERT 告警列表只含两个已删老键 absorb / imageCompression(src/config.ts:2090),新键另行注册、绝不进这个 inert 列表——这条边界已写进 PR 描述 item 4。一个留给 #3400 的后续点:它合入后,本 PR 告警文案里「图片原样透传」的说法对新迁移用户会过时,#3400 的实现 PR 顺带把文案指向新键即可(不在本 PR 范围内动)。

结构化八问

  1. 是什么问题:owner 要求把本 PR rebase 到最新 master 解冲突,并处理与 Egress image downscale: shrink big images before sending to the model, originals stay local and self-readable | 重做图片降采样(简化版):发模型前压大图、原图留本地不动、模型被告知尺寸后可自读原图 #3400(图片压缩以新键名回归)的潜在键名撞车。
  2. 什么原因导致的:评审期间 master 前进了(kernel: 已消费但非重折叠的压缩单元不再被推荐——推荐端与执行端对同一形状意见一致 #3381 kernel 变更、fix: dsh 增量标记与 body 原子落位,补单飞行守卫——并发会话不再可能裸发增量体丢历史 #3378/fix: 一次瞬时 409/503 不再把增量压缩会话永久打回全量重发 #3377 incremental lane 修复等),其中 kernel: 已消费但非重折叠的压缩单元不再被推荐——推荐端与执行端对同一形状意见一致 #3381 恰好实现了本 PR 的第 ③ 项;Egress image downscale: shrink big images before sending to the model, originals stay local and self-readable | 重做图片降采样(简化版):发模型前压大图、原图留本地不动、模型被告知尺寸后可自读原图 #3400 尚未合入,无实际撞键。
  3. 影响范围与严重程度:仅本 PR 自身——6 commit 变 5 commit,去掉的是已被上游取代的 lockfile 改动;功能代码 5 项修复逐字节保留(rebase 无内容冲突,唯一文本冲突就是那个 lockfile)。对使用方零影响。
  4. 怎么修复的:rebase 时对唯一冲突(lockfile commit)判定「上游已达成同样目的」→ git rebase --skip 丢弃而非手工合并(保留会产生 0.0.126 vs 0.0.127 的版本倒退);INERT 列表按「老键告警 + 新键另行注册」边界保持不动并在 PR 描述固化。
  5. 是否有回归问题:rebase 后全量复核——typecheck 干净、build OK(dist-import-annotations OK)、三个定向套件重跑全绿;跨分支交互专门查过:fix: dsh 增量标记与 body 原子落位,补单飞行守卫——并发会话不再可能裸发增量体丢历史 #3378「200 响应无 x-bili-applied-seq 不得消费 pending entry」与本 PR 第 ⑥ 项(非 2xx 不盖章)作用在不同状态码路径,语义互补不打架;master 新增的 config.ts guardrails 段与本 PR 的 INERT 告警在同一文件不同区域,无交互。未发现回归。
  6. 是否破坏缓存:不涉及(同前次审核结论,rebase 未改任何逻辑)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

验证证据

  • rebase 后本地:npm run typecheck 干净;npm run build OK;定向套件 removed-compress-keys-inert 3/3、incremental-lane 18/18、auto-restart 16/16。
  • CI(新 head d83b0b59c):静态门禁已大面积绿(docs-sync / lock-sync / config-surface-guard / docs-coverage / test-import-graph / plan / unused-exports / build-artifact 通过,kernel-guard 等个别排队中),test 分片起跑中。lock-sync 通过即证明 kernel lockfile 与 package.json 一致。

判定

可合(等 CI test 分片转绿,预期无悬念)。合并仍须人工执行;第 ② 项 daily 上游措辞的确认也仍挂在你那边。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 追平确认:rebase 后 head d83b0b59c 全部 38 个 check runs 完成且全绿(6 个 test 分片 + 全部静态门禁,e2e lane 按门控跳过,预期)。上条「可合」判定维持,无新增发现;待人工合并。

@ranxianglei
ranxianglei merged commit f95d8b8 into master Oct 17, 2026
38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.509-master.f95d8b8 (rolling master tag).

npm install -g billion-context@0.0.509-master.f95d8b8  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Oct 17, 2026
Redoes the image pre-compression removed in #3295 in simplified form:
on every outbound request (after kernel folding, before protocol
encoding, one shared pass over the generic message structure) an image
whose longest edge exceeds 1600px (BILI_IMAGE_RESCALE_MAX_DIM) or whose
base64 body exceeds 100KB is re-encoded fit-inside (never upscaled,
original format kept) on an outbound COPY only - session storage keeps
the original bytes byte-exact. A re-encode saving less than 20% of the
bytes is discarded (keep-smaller), so small and low-benefit images pass
through untouched. Only PNG/JPEG/BMP are handled (pure-JS jimp encoder,
zero native dependencies - sharp does not return).

Each shrunken image carries a stable annotation beside it reporting
current vs original size. Lanes that register bili tools name
read_original_image("mNNNNN") in the annotation: proxy-injection lanes
get it via the per-protocol manifest lists, plugin lanes (DSH/opencode)
via handlePluginManifest; tool-rejecting lanes (codex) get size-only
notes and no tool. read_original_image returns the original bytes from
local session storage (incomingImageIndex spill files); its results are
structurally exempt from re-shrinking - the zero-state loop guard
against the #3266 guess-reject-resend disease.

Output is deterministic: content-hash encode cache (one encode per
unique image), stable note text derived only from dims/bytes/ref - the
same history produces byte-identical outbound bodies, so upstream
prefix caching is undisturbed (#3266 lesson). Observability: one log
line per unique image and one per original-image read (ref, sizes,
session cumulative count+bytes); no hard cap.

Knobs (config surface): top-level config key imageRescale (boolean,
default true), env BILI_IMAGE_RESCALE ("0"/"false" off, live-read),
env BILI_IMAGE_RESCALE_MAX_DIM (default 1600, env-only). Documented in
CONFIGURATION.md en+zh. Legacy compress.imageCompression.* INERT
warnings remain owned by #3344/#3355.

Also removes the dead external:["sharp"] leftover from #3295 in
tsup.config.ts and adds jimp to the inlined devDependencies list.
kernel/** untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant