Repository navigation
[PR] msgid: dsh full-resend turns onto the biliMsgIds envelope (#6525 step 1) - #6532
Closed
ranxianglei wants to merge 2 commits into
Closed
ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
Carrier ① (the envelope body field) had zero client wiring: the server consumes biliMsgIds on both wires (prepare-openai/anthropic, gated on pluginMode + the pluginLaneServerHistory rollout), but no client ever stamped it. dsh's stamping lived only on the anthropic-wire incremental lane (#4491), so every openai-wire full-resend turn — dsh's main path — arrived id-less and the store fell back to content-derived digests, which in turn leaves the fork msgid identity track (#6293) with nothing to match. maybeStampEnvelopeMsgIds now stamps full-resend model bodies (both wires) after the incremental lane had its chance. Resolution never re-implements the host's wire transforms: the pi-ai lockstep walkers (laneMsgIdsForWire / laneMsgIdsForOpenAiWire — the SAME functions the pi/omp lanes pin with) prove wire-element ⇔ host-message pairing by order-preserving fingerprints, bail all-or-nothing; the kernel's own converters then prove core-alignment via the #3642 wireIndex back-pointer (every non-leading wire element must own exactly one core — parallel tool calls / reasoning+text / text+image parts split one host message into N cores, and N cores cannot share one host id). System-role entries are excluded (they ride the hoisted/folded leading system, never 1:1 to a non-leading wire element). Any bail leaves the body byte-identical → content-derived ids, exactly today's behavior; with the rollout off the server strips the field, so default installs are untouched.
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9574-pr.6532.a2035ddThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6532.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This was referenced Nov 13, 2026
#6525 B7) dsh's flat host messages differ from the pi-ai shape the shared walker's host-side fingerprint assumes in two places (role tool vs toolResult, block tool-call vs toolCall), so every tool-bearing turn bailed the all-or-nothing envelope and the turn-1 host-pinned rows churned back to content digests on the next full-resend. Normalize dsh's shape for fingerprinting only, in the dsh resolver: the envelope ids still come from mm.id and the wire-side pairing is untouched, so no mis-pin is possible. Found via a real-dsh e2e dump (after turn 1: live rows 11/11 content digests). Now: live rows 11/11 host-pinned UUIDs. Two regression tests pin the accept (a dsh tool turn core-aligns and stamps) and the retained bail (parallel tool_calls still refuse, one host id cannot cover N cores).
This was referenced Nov 13, 2026
Owner
Author
ranxianglei
added a commit
that referenced
this pull request
Nov 14, 2026
…6539) Complements the client-side envelope wiring (#6532 shipped dsh openai+ anthropic). This is the 'record' half of the msgid lifecycle made whole across every wire: - prepare-google / prepare-responses: read + strip the biliMsgIds envelope before it can reach the upstream, then pin behind the same rollout gate as the openai/anthropic twins. A length/shape mismatch is rejected (bail) at the pin — never leaked, never mis-pinned. - handle.ts: a non-body id source (x-bili-msg-ids header / loopback harvest) now stamps the parsed body on EVERY wire, not just openai/anthropic, so the four pin-consumers all see it uniformly. - rollout: pluginLaneServerHistory 0% -> 100% (GA, owner ruling 2026-11-13). No client calls the co-gated /__bili/plugin/render endpoint yet, so flipping only activates pinning. Roll back with BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY=0. Three tests that pinned the old default-off contract now force the off state explicitly (env=0) instead of deleting the var.
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.
#6525 第一步:dsh 全量重发轮接上 biliMsgIds 信封通道
一句话
dsh 的主力流量(openai wire 全量重发)每轮都不带宿主消息号,导致存储层永远用内容摘要当身份、fork 的 msgid 身份轨(#6293)在真实 dsh 上永远匹配不上;这个 PR 把 dsh 的全量重发请求接上现成的信封通道(
biliMsgIds),让宿主号从第一轮就能落进存储。背景(为什么这么惨)
msgid 基建(docs/msgid-infrastructure.md)设计了四条递送通道,服务端消费侧全部就绪(两 wire 的 prepare 都会读
biliMsgIds并在 gate 打开时 pin 到messages.msg_id),但信封通道①从来没有客户端写过(issue #6525 的覆盖矩阵)。dsh 的送号只长在 anthropic wire 的增量车道上(#4491),而 dsh 走openai-completions时走的是全量重发——每轮都裸奔。结果:msg_id全是内容摘要h_...(真机实测:父会话 11 行 0 个宿主 UUID);rawId同摘要,客户端拿宿主 UUID 去比,恒 0 匹配 → 静默回退字节轨([PR] fork: msgid identity track for the plugin fork protocol (#6262) #6293 的 msgid 轨在真实 dsh 上从未点亮)。怎么做的
src/agent/dsh-native.ts新增maybeStampEnvelopeMsgIds(beforeSend 链,增量车道之后:车道换过 body 就不碰)与纯函数resolveEnvelopeMsgIds:laneMsgIdsForWire/laneMsgIdsForOpenAiWire,src/agent/pi-msgids.ts):按顺序保持的指纹把 wire 元素和宿主消息逐一对上,任何对不上 → 整轮 bail(全有或全无)。openaiToCore/anthropicToCore的 The intermediate message (core) is not protocol-agnostic: switching protocols/models causes identity churn; cross-protoc | 中间消息(core)没有做到协议无关:切协议/切模型制造身份 churn,补齐跨协议映射 #3642wireIndex回指:每个非 leading wire 元素必须恰好拥有 1 个 core(并行 tool_calls、reasoning+text、图文混排会把一条宿主消息拆成 N 个 core,N 个 core 不能共用一个宿主号,validateMsgIds 也拒重复);拆了就整轮 bail。bili-ps-N槽位、anthropic 上是独立system字段),永不与 1:1 的非 leading wire 元素对齐;openai wire 的 leading 槽位从信封里剥掉,保证信封长度 == 服务端校验的 post-hoist core 数。服务端零改动:字段本来就被 prepare-openai/anthropic 读取、转发前剥除、pin 受
pluginMode+pluginLaneServerHistoryrollout 门控(默认 0%,owner 裁定 2026-11-07)。默认安装的存量行为一字不变(rollout 关时字段被 strip,不 pin)。验证
npm run typecheck干净。tests/issue6525-dsh-envelope.test.ts13 例(真实内核 + 真实 walker):openai lead 去头 / 无 lead / 图文混排 bail(内核 wireIndex 证明独占)/ 并行 tool_calls bail / reasoning_content bail / 非 lead system bail / 宿主缺号 bail / 字节不符 bail / 重复 id bail / anthropic 1:1(system 字段分离 + tool_result 块)/ 非 openai-anthropic payload / 退化输入不抛。dsh-envelope-e2e.mjs):x-bili-plugin: dsh戳;BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY=1后,存储出现宿主 UUID pin 行(第一个非 watermark 请求必 pin, stamped 的宿主号确实落进messages.msg_id)——链路端到端打通;msgid envelope stamped on full-resend for <session> (N ids, openai wire))。边界(不在本 PR 内)
相关