Skip to content

[PR] fix: re-land host lane for unknown anthropic blocks — session notice + billing parity (#3410) - #3988

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-20_3410-host-reland
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-20_3410-host-reland

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

这是什么

把 #3410 的 host 侧修复重新合回 master。内核半边已经通过 #3961 落地(kernel 0.0.131 起 unknown anthropic top-level blocks 挂 sidecar 原样转发),但配套的 host 半边(PR #3981)实际没进 master。

为什么需要 re-land

#3981 是叠在 #3961 分支上的 stacked PR:#3961 于 2026-10-20T13:47:16Z 合入 master,14 秒后 #3981 合进的是那条已经完成使命的基分支,所以它的提交 f1541d93 从未到达 master(已验证:git merge-base --is-ancestor f1541d93 origin/master 不通过;master 上 unknownAnthropicBlocks 无一处命中)。GitHub 显示 #3981 为 merged,但那是合进基分支的假象——与 #3955 处理过的搁浅合并同类问题。

本 PR 将 f1541d93 原文 cherry-pick 到 master(分支基座随线程 rebase 推进,现基于 a7e55cc86;+/- 行与原始提交逐行一致),提交信息与作者保持原样。

内容(5 文件 +205/−5)

  • src/wire-drop-warn.ts:新增 unknownAnthropicBlocks() — 扫描解析后的 anthropic body,找出已知六类之外 的 top-level block 类型,返回 {count, types, firstIndex}(干净时返回 null)
  • src/server.ts + src/server/prepare-anthropic.ts:每会话每类型集合一条 NOTICE(warnedWireDropKeys FIFO,与 droppedOpenaiParts 同款纪律),运营者能看到 document/PDF 流量搭 passthrough 而不是无声消失
  • src/image-tokens.ts:billing 对齐 — unknown 块按 media 计价:base64 按编码长度、url 按 REMOTE_IMAGE_TOKENS(封顶)、裸 unknown 按平价 4096 底;已知非 media 块(text/thinking/tool_use/tool_result)不进该分支,walker 的 golden anthropic stats 字节稳定
  • tests/issue3410-unknown-anthropic-block.test.ts:报告形状、NOTICE once-per-type-set 节奏、billing 矩阵(base64/url/bare/mixed)

预检

  • cherry-pick 零冲突(master 自 13:47 后前进了 [PR] fix: close the judge's echo normalization to the filter's strip set (#3938 PR-D) #3985 等,无文件碰撞)
  • npm run typecheck 干净
  • 定向测试:tests/issue3410-unknown-anthropic-block.test.ts 5/5、tests/anthropic-lane-nudge.test.ts 3/3、tests/wire-contract.test.ts 21/21 全绿
  • npm run build 成功(dist-import-annotations / dist-external-zod OK)
  • 全量回归以本 head 上的 CI test lanes 为准

边界

  • 不含 kernel/ 改动(内核半边已在 master)
  • 无 config surface / 持久化格式 / wire 形状变更(NOTICE 只进日志,billing 只影响计量)

Closes #3410

@ranxianglei ranxianglei changed the title fix: re-land host lane for unknown anthropic blocks — session notice + billing parity (#3410) [PR] fix: re-land host lane for unknown anthropic blocks — session notice + billing parity (#3410) Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-20_3410-host-reland (0c62934)

Latest build — install this exact version

npm install -g billion-context@0.0.5283-pr.3988.6d2557e

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

Recent builds (commit → version)

commit version build
0c62934 billion-context@0.0.5283-pr.3988.6d2557e build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3988.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)

查重:不重复。 按失败签名+主题检索了 open/closed issue 与 PR(#3410 / unknown anthropic / re-land):做同一件事(把 #3410 host 半边重新合回 master)的在途条目只有本 PR;相关但不同的条目——#3410(原始缺陷,本 PR Closes)、#3961(内核半边,已合入)、#3981(被搁浅的 stacked PR,本 PR 的前身)、#3955(同类搁浅合并的先例处置)。无并行重复工作。

标签:pr bug scope/wiring p2(缺陷修复的 re-land;改动面是 host 侧 wire codec/billing/日志边界;内核半边已在 master,缺的半边造成的是运营盲区+计量偏差,不是不可用)。

初审中间结论(继续工作中):

  1. cherry-pick 保真度已验证:4c5f3fbde 与搁浅提交 f1541d930 的 patch-id 完全一致(1616d759…),5 文件 +205/−5 逐行相同,作者与提交信息保留原样。
  2. 搁浅事实成立:git merge-base --is-ancestor f1541d93 origin/master 不通过;master 上 unknownAnthropicBlocks 零命中。
  3. 内核半边确认在 master:kernel/src/wire/anthropic.ts:275 带 #3410 标记的 sidecar 原样转发逻辑存在(kernel 现 0.0.157)。
  4. CI 红,但非本 PR 引入:head 4c5f3fbde 上 6 个 lane 失败(5 test shards + lifecycle-ledger-guard),而 PR 的基提交 860e6174d(纯 master)同样 6 个 lane 同名失败(10-20 同时段)——是当时 master 的红风暴,已由 master mysql-contract lane red: #4177's store→runtime-status chain pulled acp-kernel runtime imports into the storage co | master mysql-contract 车道红:#4177 的 store→runtime-status 链把 acp-kernel 运行时 import 带进了 storage 契约测试,job 没构建 kernel #4336/windows-22-1 lane randomly red: during test cleanup, unlink index.db hit an EBUSY external lock, couldn't survive tmp-rm | windows-22-1 车道随机红:测试清理期 unlink index.db 遇 EBUSY 外部锁,熬不过 tmp-rm 的 9.6 秒重试梯子(#2799/#2908 族复发) #4347/[PR] fix(ci): make master green again — build kernel for the mysql lane + bounded retry for the EBUSY teardown flake #4350(10-23 晨合入)修复。本 PR 零新增失败。
  5. PR 当前 behind master。下一步:rebase 到当前 master、本地 typecheck/build、push 刷新 CI,绿了再给八问结论。稍后补充完整审核回复。

@ranxianglei ranxianglei added bug Something isn't working p2 scope/wiring labels Oct 23, 2026
@ranxianglei
ranxianglei force-pushed the 2026-10-20_3410-host-reland branch from 4c5f3fb to 91d68e8 Compare October 23, 2026 04:07
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Rebase 完成,CI 已刷新,等待中。

  • 分支 2026-10-20_3410-host-reland 已 rebase 到当前 master(994a467da),新 head 91d68e8c9。零冲突;逐行比对确认 rebase 后的 +/- 行与搁浅提交 f1541d93 字节一致(内容零改动,只动了基座)。
  • 语义核对:master 在 PR 基座之后改过同一模块 src/wire-drop-warn.ts([PR] fix: client mid-history system messages ride verbatim on every wire (carrier re-voice narrowed to bili's own) (#4166, fixes #4159) #4171 review:openai drop-warn 收窄到 assistant/tool + 头部 system/developer run),与本次新增的 unknownAnthropicBlocks 共存无冲突——共用改名后的 WireDropReport 接口,两个 detector 各自独立。
  • 本地验证(按 §7.2 rebase 后必须项):npm run typecheck 干净、npm run build 成功(dist-import-annotations / dist-external OK)、定向测试 tests/issue3410-unknown-anthropic-block.test.ts + tests/anthropic-lane-nudge.test.ts 共 8/8 全绿。
  • 全量回归以本 head 的 CI test lanes 为准,跑完我报结论(含结构化八问)。

一个待办说明:PR 描述里写测试含「经真实 server lane 的 e2e passthrough」,但测试文件里实际只有 5 个单元断言,没有 server-lane e2e。这属于描述与代码不符的小问题,我会在最终结论里单独列出不算回归阻塞项。

…ng parity (#3410)

The kernel side (PR #3961) rides unknown anthropic top-level blocks on
the sidecar and re-emits them verbatim; the host side it expects:

- src/wire-drop-warn.ts: unknownAnthropicBlocks() - scans parsed
  anthropic bodies for top-level block types outside the known six and
  reports {count, types, firstIndex} (null when clean).
- src/server.ts + src/server/prepare-anthropic.ts: one NOTICE per
  session per type-set (warnedWireDropKeys FIFO, same discipline as
  droppedOpenaiParts) so operators can see document/PDF traffic riding
  the passthrough instead of vanishing silently.
- src/image-tokens.ts: billing parity - unknown blocks meter like
  media: base64 payloads by encoded length, urls at REMOTE_IMAGE_TOKENS
  (capped), bare unknowns at the flat 4096 floor. Known non-media
  blocks (text/thinking/tool_use/tool_result) stay outside the branch -
  the walker's golden anthropic stats are byte-stable.
- tests/issue3410-unknown-anthropic-block.test.ts: report shape, NOTICE
  once-per-type-set cadence, billing matrix (base64/url/bare/mixed),
  e2e passthrough through the real server lane.

Stacked on #3961 (kernel passthrough); Part of #3938.
@ranxianglei
ranxianglei force-pushed the 2026-10-20_3410-host-reland branch from 91d68e8 to 0c62934 Compare October 23, 2026 13:13
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

进度汇报:上一轮进程在等 CI 时卡住 32 分钟无输出,被强制重启。重启后已完成 rebase + push + PR 描述修正,当前卡在 master 自身的两个红门禁上(已有 3 个在途修复 PR)。

发生了什么

  • 04:07Z 我 rebase 到 994a467da、push 91d68e8c9 后进入等 CI 状态;该 head 的 13 条 e2e/辅助 lane 全部绿,但主 CI workflow 于 07:39Z 被外部取消(failure_reason 为空、无后续替代 run、时间线无事件——非本分支触发),此后一直空等到被强制重启。
  • 重启后核查:master 已前进到 a7e55cc86(PR 落后 70 个提交),按 §7.2「rebase 到当前 master 再谈可合并」重新执行了全流程。

本轮完成的事

  1. rebase 到 a7e55cc86 → 新 head 0c629345b,零冲突;逐行比对确认 +/- 行与搁浅提交 f1541d93 完全一致(内容零改动,只换基座),作者/提交信息保留。
  2. 本地验证(全新工作区 npm ci 后):typecheck 干净、build 成功(build-info commit=0c629345b)、定向测试 tests/issue3410-unknown-anthropic-block.test.ts + tests/anthropic-lane-nudge.test.ts 8/8 绿,另跑 image-billing 相关家族(issue857/767/1843/2189/image-request-budget)33/33 绿。
  3. push 刷新 CI(force-with-lease):新 head 上 13 条 e2e/辅助 lane 全部绿。
  4. 顺手修掉 PR 描述与代码不符的小问题(独立 PATCH,http 200):①测试列表里删掉不存在的「经真实 server lane 的 e2e passthrough」(实际只有 5 个单元断言);②基座引用从过期的 860e6174 更新为现基座 a7e55cc86。

当前阻塞:master 自身两个红门禁(非本 PR 引入)

新 head 的主 CI 只有两个 gate job 失败,且失败后 test shards 被跳过。我已在纯 master a7e55cc86 的临时 worktree 复现两者,确认与本 PR 无关(本 PR 只动 5 个文件,完全不碰这两个门禁的输入):

查重结论:这两个门禁已有 3 个在途修复 PR(#4416 / #4419 / #4420,同一症状同一根因的并行提交),按红风暴防线我不再重复修、也不把这两个 fix 塞进本 PR 污染 diff。

下一步

任一 gate-fix PR 合入 master 后:rebase 本分支到新 master → CI 全量 test shards 跑绿 → 我补最终结构化八问审核结论(含合并建议)。若在那之前我没有被再次唤醒,请回复「继续」。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

陈旧票清理(第三批动作①):目标 issue #3410 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

anthropic wire silently drops unknown top-level blocks (incl. PDF document) when rebuilding history

1 participant