Repository navigation
[PR] kernel: fold coverage keyed on ledger seq intervals — churn-immune blocks (#4316 layer 3, PR 2/3) - #4552
Merged
Merged
Conversation
…une blocks (#4316 PR2/3) - CompressionBlock gains optional startSeq/endSeq, recorded only when the folded span is fully stamped and exactly contiguous (never guess). - prune: positional coverage (isCoveredBySeq) runs after the id path — stamped messages inside any active block's interval are suppressed even after an id re-mint; unstamped behavior is byte-identical. - syncBlocks: a bounded block stays alive while any in-view stamped message falls inside its interval (third disjunct), so model switches can no longer deactivate coverage through id churn alone. - plugin lane: ledgerSeq stamps ride the turn body as biliLedgerSeqs (parallel array, strict validation, stripped before upstream), re-attached at prepare-anthropic next to the msgid pin; the lane assembly projects unstamped tails at maxSeq+1 and recordCanonicalPointers rewrites stamps each wrap-up; identityInputOf strips ledgerSeq so stamped re-ingest never re-keys rows. - stakes: kernel seq-interval-coverage 4/4 (churn-immune prune + sync, honest unstamped fallback, exact interval merging), lane e2e seq-interval-lane 1/1 (store start_seq/end_seq + payload interval, outbound suppression, first-user pin, #1567 carrier). kernel-change: types/prune/sync/compress interval bookkeeping + 4 tests
…the #4525 rename The tier1 consolidation train renamed sidScope (AsyncLocalStorage<string>) to dispatchScope (AsyncLocalStorage<{sid,msgIds}>) and updated the main attribution path but missed the C10b fork-blind-spot logger, leaving master tsc red (TS2304 sidScope, dsh-native.ts:1287; CI run 40093629255 failed on the same break). Read dispatchScope.getStore() and test .sid — semantics unchanged (scoped attribution active).
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.5505-pr.4552.c351630This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4552.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…e ledger guard Master-side gap: the #2222 escape hatch landed in src/launcher.ts without a LIFECYCLE.md row, so the exact-match ledger guard fails every push that runs it after that merge (including this branch's CI).
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.820-master.0d9fdae # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 24, 2026
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.
Closes #4316 (layer 3, PR 2/3 — see the plan comment #4316 (comment)). Also unblocks master tsc (rides a one-line fix for the #4525 rename miss, see second commit).
问题
#4316 层 1/2(#4505 msgid pin + 服务端正史)让插件车道的消息行有了稳定身份,但折叠记账仍按 id 列表(
effectiveMessageIds):任何 id 重铸(切模型重盖章/图片重编码/宿主改字节)都会让块覆盖失配,只能靠 fold-reconcile 的证据链救火(1057 失配救回 1038,救不回的变死 ref + churn 区膨胀重折)。这是 #4316 病族的最后一块。改动(kernel 双轨 + lane 传输)
startSeq/endSeq:折叠范围内消息全部带ledgerSeq章且区间精确连续才记录(合并相邻/重叠覆盖段;任一无章、无界或有洞 = 不记录,never guess—— 桩 S10 钉死这个诚实降级)。rebuildMessages在 id 覆盖判定之后加isCoveredBySeq—— 带章消息落任意活跃块区间即压制原件,与 id churn 彻底解耦;无章流量走 id 老路,行为字节等价(S8 对照组钉死)。blockSeqPresent:块有界 + 任一在场消息带章落区间 = 块仍活着,防止 id 重铸引发 deactivate 丢覆盖。ledgerSeq(store 0 基→显示 1 基)以biliLedgerSeqs平行数组随 turn body 传输(与biliMsgIds同位;严格校验,拒绝即降级不猜;转发前剥离不上游泄漏);prepare-anthropic在 msgid pin 同位重钉;lane assembly 对本 turn 未落库尾部按maxSeq+1递增投影;recordCanonicalPointers每 wrap-up 回写行章。identityInputOf剥除清单加ledgerSeq—— 服务端晚加的位置章不参与行身份哈希(否则每轮带章重入库整段换血,调试中实打实测到 29 行三代)。搭乘:master tsc 修复
#4525 把
sidScope改名dispatchScope漏改 C10b fork-blind-spot 日志一处 → master tsc 红(TS2304,CI 40093629255 同因失败)。第二 commit 一行修复(读dispatchScope.getStore()按{sid,msgIds}形状取.sid)。桩(先红后绿)
kernel/tests/seq-interval-coverage.test.ts4/4:S8 盖章折叠记区间 + id 全换(seq 不变)后按区间压制原件,对照组(无章 churn)丢覆盖=现状文档化;S9 syncBlocks 盖章 churn 视图保块活性,对照组 deactivate;S10 部分盖章=不记界;S11 相邻联合区间精确 + 空洞不记录。tests/seq-interval-lane.test.ts1/1 端到端:12 消息 lane → turn-2 fold(POST /__bili/plugin/tool)→ storeblocks.start_seq/end_seq落真值 +payload_json带区间章 → 出站压制被覆盖原件(b2/b3/b4)+首用户钉存活(u1,#DESIGN §8.1)+摘要乘 plugin mode: in-place acp_summary never stripped when the client's own compress pair rides inbound — double summary carrier on every post-fold turn #1567 载体回显(客户端回显 tool_use 的 args 就是载体)+biliMsgIds/biliLedgerSeqs不泄漏上游。验证
npm run typecheck0 错;check-unused-exports clean(6 waived);kernel 0.0.161→0.0.162 + lock-sync。Out of scope(PR 3/3)
fork cloneRows 保号 + 存量重铸窗口;D5-5 渲染分窗(区间落地后顺势变 SQL 查询,单独 PR)。
kernel-change: types/prune/sync/compress interval bookkeeping + kernel tests 4