Skip to content

[PR] chore: fold thinking forms single-source + drop inert fold-reconcile import - #4866

Merged
ranxianglei merged 5 commits into
masterfrom
2026-10-26_fold-forms-dedup
Oct 27, 2026
Merged

ranxianglei merged 5 commits into
masterfrom
2026-10-26_fold-forms-dedup

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

这是啥问题

两个死代码/易漂移点(增量压缩深入分析的副产物,见 #4801 评审):

  1. 思考标签形态表双份维护:kernel/src/wire/demoted-thinking.ts 的 FORMS 与 src/fold-reconcile.ts 的 THINKING_MERGE_FORMS 逐字节相同,只靠注释约定同步——将来任一侧加第四种形态(新模型厂)另一侧静默漏掉,折叠对齐的辅助证据悄悄失效。
  2. src/server.ts:57 死 import:reconcileFoldCoverage / noteSystemPromptFingerprint / resolveFoldReconcileMode 三个符号 import 后全文件未用(prepare-* 各自导入自己的副本)。

改动

  • kernel 侧导出 FORMS(注释注明单一来源);fold-reconcile 深层导入(同 src/storage/ingest.ts 先例),删本地副本,镜像注释改为指向单一来源
  • 删 server.ts:57 整行死 import

验证

  • typecheck 干净;build+dist-external OK
  • tests/issue3301-shape-flip-reanchor.test.ts 22/22(直接覆盖 extractThinkingMerge)
  • tests/fold-anchor-doctrine.test.ts 8/8

kernel-change: export FORMS as the single source of truth for the demoted-thinking merge forms; bili fold-reconcile now imports it instead of keeping a byte-identical copy (dedup, #3301). No behavior change on the kernel side.

@ranxianglei ranxianglei added the ci:full Run the FULL CI matrix (all e2e lanes + 12-leg test matrix) on this PR label Oct 26, 2026
@ranxianglei ranxianglei changed the title chore: fold thinking forms single-source + drop inert fold-reconcile import [PR] chore: fold thinking forms single-source + drop inert fold-reconcile import Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_fold-forms-dedup (16a259e)

Latest build — install this exact version

npm install -g billion-context@0.0.6318-pr.4866.5821dd5

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
16a259e billion-context@0.0.6318-pr.4866.5821dd5 build
809b33a billion-context@0.0.6312-pr.4866.b52cc6c build
6d88a11 billion-context@0.0.6310-pr.4866.0234171 build
16ebc28 billion-context@0.0.6304-pr.4866.2658874 build
d128daf billion-context@0.0.6296-pr.4866.57ec906 build

Download artifact

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

查重: 不重复——这是 #4801 评审发现的两个死代码/易漂移点的修复,检索 open/closed issue 与近期 PR 无同症状条目(失败签名:thinking forms 双份维护 + server.ts 死 import)。

这是 [PR] 条目,分支 2026-10-26_fold-forms-dedup(d128daf)已存在。我按 PR 审核流程处理:拉分支核对代码、核 kernel 边界合规(版本纪律/kernel-change 声明)、看 CI。注意 base 还停在旧 master(24e71f6),master 已前进到 13e0dba——审核结论出来前先看是否需要 rebase。稍后回八问结论。

…import

The demoted-thinking form list existed twice (kernel/src/wire/demoted-thinking.ts
FORMS and src/fold-reconcile.ts THINKING_MERGE_FORMS) with only a comment tying
them — a silent drift bug waiting to happen. fold-reconcile now imports the
kernel list directly (deep-import convention already used by src/storage/ingest.ts).

Also drops src/server.ts's import of reconcileFoldCoverage/noteSystemPromptFingerprint/
resolveFoldReconcileMode — all three were unused in that module (the prepare-* files
import their own copies).
@ranxianglei ranxianglei added bug Something isn't working p3 scope/kernel labels Oct 26, 2026
ci-check added 2 commits October 27, 2026 00:30
Review fix on PR #4866 branch: the local THINKING_MERGE_FORMS deletion left two blank lines between the doc comment and the export (src/fold-reconcile.ts). No behavior change.
Version discipline (Kernel Boundary rule 2): this PR touches kernel/src/wire/demoted-thinking.ts (FORMS becomes an exported single source), which requires a kernel version bump. Lockfile regenerated with npm install --package-lock-only (mirrors the lock-sync CI check).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

审核结论:代码本身正确且已验证,但卡在 kernel 授权门禁 —— 已按 owner policy 2026-10-26 立项 #4877(kernel authorization request,p1)等拍板。

标签: bug scope/kernel p3 —— 死代码 + 易漂移点,触碰 kernel/,无用户可见影响的小问题。

结构化八问

  1. 是什么问题:思考标签形态表存在两份逐字节相同的拷贝(kernel 的 FORMS 与 host 的 THINKING_MERGE_FORMS),只靠注释约定同步——任一侧将来加新形态另一侧会静默漏掉,折叠对齐的辅助证据悄悄失效;另有 src/server.ts:57 一行 import 后全文件未用的死导入。
  2. 什么原因导致的:fold-reconcile 当初从 kernel 拷贝了形态表而不是直接引用;prepare-* 模块各自导入自己的副本后,server.ts 顶层那行 import 成了遗留。
  3. 影响范围与严重程度:纯内部实现,无外部影响——两份表当前值逐字节一致(我逐值核对过值与顺序),现状零故障;风险只在未来的静默漂移。p3。
  4. 怎么修复的:kernel FORMS 变单一来源(export + 注释钉死「扩展只在这里」),host 侧深层导入同一列表(与 src/storage/ingest.ts、src/state-hydration.ts 的既有先例同约定),删本地副本;死 import 整行删除。行为中性,两种压缩模式(plugin/proxy)的 wire 路径均不触碰。
  5. 是否有回归问题:无。既有行为逐项过:extractThinkingMerge 调用链不变、形态值/顺序不变 → 折叠锚点辅助证据行为不变;无阈值/时序/输出格式漂移;无 fail-fast 变吞错。验证:typecheck ✓、build+dist-external ✓、kernel 单测套件 ✓、tests/issue3301-shape-flip-reanchor.test.ts + tests/fold-anchor-doctrine.test.ts 合计 30/30 ✓(在推送后的 head 上本地定向复跑)。
  6. 是否破坏缓存:否。仅折叠对齐的辅助证据来源收敛,wire 输出字节不变,前缀缓存不受影响。
  7. 是否改了设计方向:没有。双份维护收敛为单一来源,架构/边界/数据流不变。
  8. 是否引入新配置:没有。

审核方动作(已推到 PR 分支,head 809b33a3a)

  • chore: 删本地副本时残留的双空行收敛为一行(src/fold-reconcile.ts)——review 发现的小瑕疵,当场修;
  • kernel: acp-kernel 版本 0.0.167 → 0.0.168(+ lockfile 同步)——Kernel Boundary rule 2 要求触碰 kernel/src/** 必须同步版本号,机械性补齐,当场修。
  • 分支已 rebase 到最新 master(含 [PR] docs: message-identity hierarchy is now msgid > order > hash (#4491/#4834) #4871 等),零冲突;最终 diff 恰为预期 5 个文件。

卡点与现状

判定:代码可合并(两层验证绿、diff 干净、行为中性),唯一剩余步骤是 kernel 授权门禁(#4877);批准后 kernel-guard 转绿即可合入。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

收工确认(完整八问结论见上一条回复):本条 PR 的审核与可执行修复已全部完成——

我这边无其他待办,停等裁决。

The 0.0.167->0.0.168 bump commit regenerated kernel/package-lock.json but
left the root lockfile's packages["kernel"].version at 0.0.167, which the
lock-sync job (#2704) rejects. Regenerated with the exact lock-sync recipe
(npm install --package-lock-only --ignore-scripts --no-fund --no-audit,
node 22 / npm 10); diff is the single version line only.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

kernel 授权闭环 + 最后一处 CI 红已修,全绿可合。

等你合并。

@ranxianglei
ranxianglei merged commit 02bcdc4 into master Oct 27, 2026
63 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.868-master.02bcdc4 (rolling master tag).

npm install -g billion-context@0.0.868-master.02bcdc4  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Oct 27, 2026
…lset-tripwire

Conflicts resolved:
- tests/golden/storage-render/{anthropic,chat,google,responses}.json: digest-only conflict (both sides legitimately moved the snapshots). Regenerated from the merged tree via scripts/update-storage-render-goldens.ts and verified against both parents (vs master: only this branch's metadata/stateDigest delta; vs previous head: byte-identical, since no new master commit touched these conversations' wire).
- kernel/package.json + kernel/package-lock.json: master's version bump to 0.0.168 (this branch makes no kernel changes); took master's side.
- package-lock.json: vendored kernel entry version line -> 0.0.168 to match.
- src/server/codex-catalog-cache.ts: master's off-spec-304 handling (#4866); this branch has no own change here, took master's side.
- src/server/prepare-responses.ts: import hunk unioned - this branch's noteBiliToolSurface/outboundBiliSurface plus master's anchored-view snapshot-render imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:full Run the FULL CI matrix (all e2e lanes + 12-leg test matrix) on this PR p3 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant