Repository navigation
[PR] #5825 Identity Channel Wiring: Unified Consumption Seam + Six Lanes (opencode V2/goose/qwen/claude/codebuddy/mcode) | #5825 身份信道接线:统一消费缝 + 六条车道(opencode V2/goose/qwen/claude/codebuddy/mcode) - #5842
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8467-pr.5842.faf4a07This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5842.tgz
npm install -g packageInstall instructions are refreshed on each push. |
a008273 to
006cc1e
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 审核了 PR #5842(身份信道接线:统一采集缝 + claude-code/codebuddy/mcode 三车道)。结论先行:让 CI 变红的两道守卫失败,根因已定位、且分支上已由并行会话修好(commit ① 是什么问题 ② 什么原因导致(CI 红)
③ 影响范围与严重程度 ④ 怎么修复的 ⑤ 是否有回归问题 ⑥ 是否破坏缓存 ⑦ 是否改了设计方向 ⑧ 是否引入了新的配置 🔶 需要决策(两项均不阻塞合并)
收工判定:两个 CI 阻塞项已在分支上修复并被我独立验证转绿;设计稳健、门控充分、默认零变化。待 CI 全量 lane 在头 |
…de V2 stamped header + goose/qwen adapters + openai row-pin parity + decoupled cohort gate
|
范围二已推(commit 本轮补进去的(对应你的三条指令:能接的都接、opencode 优先、①②给交代):
证据:tsc 干净;新测试 22 例全绿(identity-harvest 11 含新夹具 / opencode-v2-msgids 5 / msgid-header-channel 5 / openai-msgid-pin 集成 1);关联套件 fastpath×35、proxy-session-id、issue5719 全绿。未开启时零行为变化。 |
…le, lane status (owner request, #5825/#5842) New docs/session-identity-resolution.md (+zh-CN): session-id vs message-id roles, the full resolveSessionOrder ladder (claim → byte continuation → persona escape rungs w/ verbatim-evidence demands → deterministic |sub: fork → #5719 msgid last-resort rung), why the msgid rung is last not first (owner discussion 2026-11-07 ruling recorded), switching-layer table (recognition ungated / harvest double-gate off / row pinning unchanged), trust boundaries incl. whole-turn degrade contract. AGENTS.md KDD #18 now points at it; channel docs cross-link both directions.
8a80f45 to
47e3ac8
Compare
…de V2 stamped header + goose/qwen adapters + openai row-pin parity + decoupled cohort gate
…le, lane status (owner request, #5825/#5842) New docs/session-identity-resolution.md (+zh-CN): session-id vs message-id roles, the full resolveSessionOrder ladder (claim → byte continuation → persona escape rungs w/ verbatim-evidence demands → deterministic |sub: fork → #5719 msgid last-resort rung), why the msgid rung is last not first (owner discussion 2026-11-07 ruling recorded), switching-layer table (recognition ungated / harvest double-gate off / row pinning unchanged), trust boundaries incl. whole-turn degrade contract. AGENTS.md KDD #18 now points at it; channel docs cross-link both directions.
|
Rebased onto post-#5826 master(owner merged #5826 at
One heads-up for CI readers: two reds in |
|
Scope 2 landed on this branch (tip
Local: Roster status in docs: crush/gemini-cli/hermes/iflow = closure memos with audit citations; zed/kiro/qoder/copilot = live-run blocked; codex = deferred (#5643); aider/jcode/kimi = content-hash optimum (closed). Remaining open item from round 1 (openai row-pinning follow-up) is now done in this PR, so nothing external is outstanding except ramp-up numbers after observation. |
…fied consume seam; no use site ever reads client storage itself. - src/identity-harvest.ts: registry core — per-request snapshot at the single handle entry, same downstream path as host-stamped ids (#5719 attribution rung; anthropic wire additionally enters the pin/row pipeline via the existing body field). Gates: pluginLaneServerHistory rollout x BILI_IDENTITY_HARVEST env (off by default) x loopback-only x canonical msgid validation. Whole-turn degrade on any doubt — never partial mapping. Shared alignment: exact count parity vs expectedLen + boundary role spot-check (<=4 positions where both sides expose roles); bounded tail readers for jsonl/sqlite layouts. - Adapters (self-contained, node builtins only): identity-claude.ts (transcript .jsonl: uuid rows, sidechain/summary excluded), identity-codebuddy.ts (<config>/projects/<dir>/<conversation-id>.jsonl, id+parentId rows only), identity-mcode.ts (runtime-state.sqlite local_runtime_message_rows per-turn read probe, open->query->close). Barrel registration in src/identity-sources.ts. - Recognition merge (#5825 decision A): x-conversation-id joins the conversation-header names list in its low-trust tier (measured stable across restarts on 2.181.0; above bare generics, below affinity tier). - Zero behavior change by default: env unset = fully inert, rollout at 0%, loopback boundary, all-or-nothing per turn. - Docs: AGENTS.md KDD (all lanes into the one seam), docs/identity-channels (.md/.zh-CN) lane status table incl. deferred roster from the #5825 investigation, env-only.yaml seed + regenerated config docs. - Tests: tests/identity-harvest.test.ts (fixture-level sqlite/jsonl layouts, gate matrix, degraded paths, recognition precedence).
…s gate, #5825) MAX_ROLE_SPOT_CHECK, IdentitySource and HarvestResult have zero references outside src/identity-harvest.ts (verified textually across src/, tests/, scripts/, docs/); the gate flags them as INTERNAL_ONLY. Drop the leading export keywords instead of adding waivers - no cross-boundary consumer exists. No behavior change.
…r-guard, #5825) The new harvest kill/scope switch is read from src/identity-harvest.ts but was missing from the ledger. Added as a transitional row in section 1 (default off, double-gated behind rollout pluginLaneServerHistory x loopback-only; plan: retire per the #2028 pattern once the lanes settle).
…de V2 stamped header + goose/qwen adapters + openai row-pin parity + decoupled cohort gate
…s gate, #5825) OpencodeV2MessageLike (src/agent/opencode-v2-msgids.ts) and qwenVisibleRows (src/identity-qwen.ts) have zero references outside their own files (verified textually across src/, tests/, scripts/); the gate flags them as INTERNAL_ONLY. Drop the leading export keywords - no cross-boundary consumer exists. No behavior change.
…le, lane status (owner request, #5825/#5842) New docs/session-identity-resolution.md (+zh-CN): session-id vs message-id roles, the full resolveSessionOrder ladder (claim → byte continuation → persona escape rungs w/ verbatim-evidence demands → deterministic |sub: fork → #5719 msgid last-resort rung), why the msgid rung is last not first (owner discussion 2026-11-07 ruling recorded), switching-layer table (recognition ungated / harvest double-gate off / row pinning unchanged), trust boundaries incl. whole-turn degrade contract. AGENTS.md KDD #18 now points at it; channel docs cross-link both directions.
47e3ac8 to
4a5a4a7
Compare
|
Rebased onto post-#5862 master ( |
(ai: vllm-qwen/qwen3.8-27b) 查重:无——检索过并行身份信道接线工作项/PR,本 PR 是 #5825 的唯一落地载体。 本轮工作 = 对你三条留言的独立验证(继承红预警、scope-2 落地、post-#5862 rebase)+ 上一轮三个红 shard 的归因。结论先行:三个红 shard 全部是继承红,零自伤红;继承红已在 master 侧修复(#5862),分支 rebase 后已纳入,本地独立复核全绿。 ① 是什么问题 ② 什么原因导致 ③ 影响范围与严重程度 ④ 怎么修复的 ⑤ 是否有回归问题 ⑥ 是否破坏缓存 ⑦ 是否改了设计方向 ⑧ 是否引入了新的配置 现状与遗留项
收工判定:三个红归因完毕且已在 master 侧修复,本分支干净、本地独立验证全绿;等 CI 在新头上确认即可由你合并,放量数字待你拍板。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1070-master.df0a402 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…nel wiring + ranxianglei#5862 parity hygiene + ranxianglei#5860 phantom-pressure guard Master moved twice since the last sync (295ba58 -> 591e940 -> df0a402). - 591e940 (folded in here): ranxianglei#5862 "master hygiene" restored the msgid-rule-parity pins to their pre-v6 verdicts (undoing 33b2f82, which had pinned behaviour that the ranxianglei#5854 revert deleted), plus the ranxianglei#5860 phantom-pressure guard (a7cbfd1) and the kernel 0.0.184 bump. - df0a402 (this merge): ranxianglei#5842 identity-channel wiring - one unified consume seam for every client lane (opencode V2 stamped header, goose/ qwen adapters, openai row-pin parity, decoupled cohort gate), the identity DETERMINATION docs, and the unused-exports gate fixes. The merge itself was conflict-free: the only shared files are the two generated CONFIGURATION docs plus the website config-reference/web artifacts, all of which are regenerated from the committed seeds rather than hand-merged. One inherited red needed a golden refresh: tests/golden/storage-render/ *.json digest drift, pre-existing on pristine master (verified on a detached df0a402 worktree before the merge). The metadata section digest and its derived stateDigest/stateDigestAligned moved with a7cbfd1, which added compress.requireUsageSampleForPressure (default true) to the config echo written into session.metadata - but that commit did not regenerate tests/golden/storage-render/. Regenerated all four under the documented pinned environment (node --import tsx scripts/update-storage-render-goldens.ts); the diff is exactly 3 lines per wire (stateDigest, stateDigestAligned, sectionDigests.metadata) and every other section digest is byte-identical.
…ted-state shape Master moved past this branch's base (295ba58 → df0a402: #5860 phantom-pressure guard + kernel 0.0.184, #5862 pin hygiene, #5842 identity-channel-wiring). The new kernel config surface changes what the golden drive persists per session, so every merge-ref CI run reds on all four wires even though no rendering behavior moved. Re-generated via scripts/update-storage-render-goldens.ts (its own Parity #3 pin). Per wire only stateDigest / stateDigestAligned / sectionDigests.metadata changed — all turns[].sha (wire bodies) byte-identical, foldAt/editedAt unchanged, state-key set unchanged ("state-key divergence: none"). A/B proof, same machine, same env (real node_modules each, kernel dist rebuilt): - base 295ba58 + this branch's BILI_MESSAGE_TIMESTAMPS pin -> exit 0, all green - master df0a402 + identical pin -> exactly these four failures; digests byte-match our PR's CI errors verbatim (chat f53ae7a7..., anthropic 769f3766..., responses 01c80a61..., google 2c935a3a...). Master's last scheduled CI predates #5860, so nothing upstream has surfaced this yet; regenerating here so the branch is green against live master. No render or storage-contract intent behind the delta beyond what the merged upstream commits introduced.
…render-lane overlap prepare-openai.ts: keep the v6 bounded kernel pass (scratch-clone window pass + legacy fallback) and thread master's new tokenCountSource param (kernel 0.0.184 phantom-pressure guard, #5860) through BOTH processTurn calls inside it. LIFECYCLE.md: union — keep the v6 render-window env rows and add master's BILI_IDENTITY_HARVEST row (#5842).
…nel wiring + ranxianglei#5862 parity hygiene + ranxianglei#5860 phantom-pressure guard Master moved twice since the last sync (295ba58 -> 591e940 -> df0a402). - 591e940 (folded in here): ranxianglei#5862 "master hygiene" restored the msgid-rule-parity pins to their pre-v6 verdicts (undoing 33b2f82, which had pinned behaviour that the ranxianglei#5854 revert deleted), the ranxianglei#5860 phantom-pressure guard (a7cbfd1), and the kernel 0.0.184 bump. - df0a402 (this merge): ranxianglei#5842 identity-channel wiring - one unified consume seam for every client lane (opencode V2 stamped header, goose/ qwen adapters, openai row-pin parity, decoupled cohort gate), the identity DETERMINATION docs, and the unused-exports gate fixes. The merge itself was conflict-free: the only shared files are the two generated CONFIGURATION docs plus the website config-reference/web artifacts, all of which are regenerated from the committed seeds rather than hand-merged. Two golden refreshes ride along, both caused by a7cbfd1 and both already red on pristine master before this merge (verified on detached worktrees at 591e940 and df0a402): - tests/golden/storage-render/*.json - the new compress.requireUsageSampleForPressure (default true) lands in the config echo written into session.metadata, so only the metadata section digest and its derived stateDigest/stateDigestAligned moved. Three lines per wire; every other section digest is byte-identical. - tests/golden/wire-contract/kernel.json - the same knob appears in the pinned acp-kernel NudgeConfig export snapshot: exactly one added line, "requireUsageSampleForPressure": true. Both regenerated with the documented scripts (update-storage-render-goldens, update-wire-contract-goldens) under the pinned suite environment. Not fixed here (upstream behaviour, needs an owner ruling): a7cbfd1 defaults the pressure band to usage-grade readings only, but tests/fork-nudge-trigger.test.ts and tests/silent-backend-nudge.test.ts still assert that a local-estimate reading fires the pressure nudge. Both are byte-identical to master and fail there too, so this merge does not touch them.
#5825 身份信道接线:统一消费缝 + 六条车道(opencode V2 / goose / qwen / claude-code / codebuddy / mcode)
一句话:各客户端的「稳定会话号 + 消息 id」现在都接进同一条消费缝,任何使用点都不再单独读客户端存储。owner 裁定(2026-11-07):能接的都接、一个 PR、不过度耦合。issue #5825 的全部逐客户端结论在本 PR 里落成代码或闭合备忘。
服务端核心缝(wire 车道)
src/msgid-pin.ts新增incomingMsgIdsHeader():x-bili-msg-ids请求头载体(逗号列表;>64 KiB 原值 / >4096 条 / 坏字符 → 整份作废;宽松级校验与 body 字段完全同构)。src/server/handle.ts统一入口:bodybiliMsgIds字段 >x-bili-msg-ids头 > 采集注册表。判定后两条 wire(openai+anthropic)走同一条路:无条件剥除(绝不上游)+ 灰度内applyMsgIdPin钉进行 +biliLedgerSeqs/#5719归属档。src/server/prepare-openai.ts):与 anthropic twin 同款结构(剥除在前、计数对拍、失败 warn 整轮退化);命中水位快路径的轮次窗口变短、按构造不参与(安全方向)。集成测试tests/openai-msgid-pin.test.ts钉死「字段绝不上游 + 行带客户端 id」。src/server/headers.ts:x-bili-msg-ids入出站剥除名单(host↔bili 簿记头,任何上游都不应见到)。opencode V2 宿主侧(本批强调项)
扩展自己的 http-request hook 读当轮自己的结构化消息铸
x-bili-msg-ids——同一事件取值零竞态,不用独立 context hook/LRU 缓存;任一变体缺 id → 该轮戳整体作废(宁可整轮退化不做部分映射)。src/agent/opencode-v2-msgids.ts(纯函数可单测)+ 4096 条/16 KiB 双上限防胖头。V1 链路不动。采集缝(loopback harvest 车道 ×3)
src/identity-harvest.ts注册表 + 门控:envBILI_IDENTITY_HARVEST(缺省关,可按车道点名)与灰度键rollout.features.identityChannelHarvest(默认 0%)二者任其一即可使能——与 dsh 历史车道的pluginLaneServerHistory解耦;仅回环来源;任一不满足整轮退化。自包含适配器(不 import 客户端任何东西、各自可删):x-claude-code-session-idx-conversation-id(本次并入会话识别低信任层,#5825 决定 A)x-mavis-session-id(已识别)agent-session-id(本次并入会话识别低信任层)message_id行x-opencode-session(官方 BYOK 文档示例${session_id}自定义头名;已识别)chats/<sid>.jsonlgit-log 转录其余 roster(审计后记闭合备忘,见 docs/identity-channels.md §2 表)
crush(join 键是 xxh3 摘要 + 库在工程目录内)、gemini-cli(仅装机级身份非会话级)、hermes-agent(线上零身份信号)、iflow(产品已下线)、zed/kiro/qoder/copilot(需登录实测或 blob 解析成本高)、aider/jcode/kimi(无线上 id,内容指纹兜底即最优)、codex(自铸 id 两度生产否决,等 #5643)。
测试与验证
tests/identity-harvest.test.ts(注册表门控 + 五适配器夹具含 SQLite/JSONL 布局 + 角色抽验)、tests/opencode-v2-msgids.test.ts、tests/msgid-header-channel.test.ts(头载体契约 + 与 body 字段同判 + 胖头防爆)、tests/openai-msgid-pin.test.ts(全链路集成)+ 既有回归全绿;tsc --noEmit干净。灰度与回退
出厂惰性(env 缺省关 + cohort 键 0% + 仅回环),合入 = 零行为变化;开启顺序:单装
env=all小流量观察 warnOnce 退化率 → 抬identityChannelHarvestpercent;row pin 继续走既有pluginLaneServerHistory灰度。kill = env unset(即时)或两键归 0。文档:AGENTS.md KDD #18、docs/identity-channels.md/.zh-CN.md、LIFECYCLE §1 登记、website/config-reference(env-only + rollout 两份种子已生成)。