Repository navigation
[PR] fix: re-anchor folded history across host wire-shape flips (#3301) - #3316
ranxianglei wants to merge 4 commits into
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 即 #3301 的修复 PR( 当前状态:PR 分支基于 |
8e302a5 to
3dd9263
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3919-pr.3316.73645f9This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3316.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 本 PR 带 审核与处置摘要Rebase:PR 切出时 base 独立审核结论(逐文件读了 diff,不是复述 PR 描述):
审核中补的两个小修(独立 commit,已在 head 上):
一处微行为变更披露(审核发现的唯一语义面变化):两个逐字重复的思考回合若仅标记风格不同( 结构化八问
CI 状态与收工判定本地定向:typecheck 干净;fold-reconcile 系 / issue3301(23)/ storage 系 / issue2636+2915 / compaction-archive 等定向合跑 242 pass / 0 fail(1 pre-existing skip)。 CI(head
收工判定:代码就绪可合。 当前 CI 红全部来自 master 存量问题,不是本 PR 的回归。下一步建议:你合并 #3314+#3317 后告诉我,我把本 PR rebase 到新 master 推上去,CI 应能全绿,届时即可合并本 PR。 |
(ai: vllm-qwen/qwen3.8-27b) 冲突唤醒核查结论:本次为陈旧通知,分支已是干净状态,未做任何 rebase/push。 核查过程(证据):
即:dirty 状态是 force-push 落地前算出的旧值(或重复转发),现在 GitHub 自己已经判干净了。按「不要重复 rebase」纪律,不硬造动作。 结构化八问
CI 现状(head
|
A host metadata-table refresh can re-serialize every past thinking turn of one session in a different wire form (reasoning_content field vs reasoning spliced into content), minting new ids for unchanged content. Fold re-anchor then reports 'covered id(s) missing with no anchor match' on every request: the turn-key pass only understood bare-concat merges, and pre-#2644 anchors lack p/x entirely — while the wire-side backfill can never fire because the flip puts the old id off the wire on the very pass that also rolls the order backbone forward without it. - fold-reconcile: extractThinkingMerge mirrors the kernel's demoted-thinking FORMS so merged-form cores register the same turn keys as split-form anchors (turnContexts + Pass 3 candidate side); ReconcileOptions.storedMessages rebuilds eligible legacy anchors from stored decompositions BEFORE the plan runs, so the flip pass itself claims. - storage: UnifiedStore.messagesForIds (+seq±1 neighbors for rc-pair adjacency), shadow/persist pass-throughs gated on full mode. - new fold-decomposition-lookup: per-pass capped lookup with a tried-set (index absence is stable, index unavailability retries). - import entry: record/session/ingest carry an optional decompositionLog (external converter payload) interned first at ingest; consume-once at save keeps the #3133 delta fast path intact; buildRecord never emits it. No new config surface. Additive optional fields only (ReconcileOptions. storedMessages, LegacySessionLike.decompositionLog, PersistedSession. decompositionLog) plus an internal metadata bookkeeping key foldStoredTried. No kernel/ changes. Fixes #3301
…view supplement) The new DB method carried chunked IN-lists, seq±1 neighbor expansion and CAS content resolution but no direct store-level test — every other facet of #3301 was pinned, this one only exercised through injected fakes.
…guessing (#3301) Owner review: runtime form extraction in the reconciler chases symptoms — the flip producer is the host serializer choosing the reasoning field from the current metadata table. The root fix pins the wire shape at the plugin transform boundary (separate PRs: opencode-acp for the 1.x lane, opencode-native here for the 2.x lane), after which the wire re-mints the original ids and existing exact-id + backfill mechanisms self-heal. This commit removes that speculative half (THINKING_MERGE_FORMS, extractThinkingMerge, its turnContexts/Pass-3 registrations and their tests) and keeps the deterministic half: pre-plan anchor rebuild from stored decompositions (unified index rows) + the decompositionLog import entry.
8a00b3d to
a233c6c
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,rebase 完成并推回分支。 这次是真实冲突(与上次不同):master 已从 按八问汇报:
已知背景(非本次引入):CI 上 shard 2 的红是 master 既有问题,待 #3314 + #3317 合入后转绿;Windows shard 3 为运行时时序抖动家族(#3279 同族)。收工判定:rebase 完成、冲突已解、验证通过,PR 可合并性已恢复,等 CI 绿 + owner 合并。 |
Closes #3301
背景
宿主(opencode)元数据表刷新后,同一会话早先的思考消息整段换成另一种 wire 形态(reasoning_content 字段 ↔ 合并进正文),内容哈希 id 空间非平稳,已折叠锚点认不回来(
[fold-reconcile] resent history drifted: N covered id(s) missing)→ 原文重新上线、上下文上涨、重复压缩。顺序为中心的对账梯队(#2821/#2915)契约前提是结构稳定(条数/顺序不变,id 可重铸);形态翻转是重塑形(每个 thinking turn 2 核→1 核),超出其生存域——属上游前提被破坏,不是机制失效。根因修复在产生端:opencode-acp#483 请求时归一化历史思考形态(见相关)。本 PR 只保留对自愈够不到的历史损伤的确定性恢复。
改造说明
初版含运行时形态猜测(extractThinkingMerge)。owner 评审认定为打膏药(新变体出现需再追一轮),已撤除(commit 8a00b3d);产生端钉死由 opencode-acp#483 承担,本 PR 不再做任何运行时猜测。
修复内容(全部确定性,零猜测)
Part B — 从存储真值重建遗留锚点(#2644 之前铸的锚点无 turn key;老 id 在翻转后第一条请求即离开 order backbone,wire backfill 永远不会触发):
ReconcileOptions.storedMessages+reconcileFoldCoveragepre-plan 锚点升级(src/fold-reconcile.ts):规划前为符合条件的锚点(bare assistant、无 toolCallId、不在当前 wire 上)从存储分解重建 p/p2/x/c/sh/wh;UnifiedStore.messagesForIds(只读,分块 IN-list + seq±1 邻接)/ shadow 透传 /SessionStore.unifiedMessageRows(readsUnified 门禁 + try/catch→null);Part C — 外部导入入口(外部导入账本在索引库无行——#3301 待确认点):
decompositionLog(session record / LegacySessionLike):导入时恰好消费一次、优先 intern 进现有messages表(最低 seqs);不写回磁盘记录;存在期间 delta planner 走全量路径。相关(同一家族,按包边界拆分)
<thinking>标记规范形态(kernel 在 minting 前还原 tagged≡split → 同一 id;部署后 wire 重新 mint 出原始 rc id,本 PR 的 exact-id pass + master backfill-once 让存量会话自愈);行为变更披露
稳态成本为零:各门禁均要求「存在遗留锚点 ∧ 索引可用 ∧ reconcile 开启」三者齐备才工作,健康锚点的会话什么都不做。
验证
npm run typecheckclean(rebased head)testlanes