Skip to content

[PR] feat(config): message timestamps are ON by default — opt-out keeps every pre-#4313 byte | 消息时间戳默认开启:关开关即逐字节回到特性前 (#4313) - #5368

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-31_message-timestamps-default-on
Oct 31, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-31_message-timestamps-default-on

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

English TL;DR

Message timestamps (#4313) flip ON by default. A live-session cache leak audit showed the rendered stamps cause zero prompt-cache damage (identical 95.0% hit rates with the flag off vs on — first-sight immutable stamps are deterministic render inputs, so re-rendered history stays byte-stable turn over turn). compress.messageTimestamps unset now resolves true; setting it false (or BILI_MESSAGE_TIMESTAMPS=0) still reproduces the pre-#4313 bytes exactly. No kernel change — the dual prompt variants already ship in the kernel, so no version bump / no Kernel Boundary gate.

Upgrade impact (one-time): the restart after which the flag first resolves true pays ONE frozen-prefix cache rewrite per active session (old messages gain time= attributes + prompt variant switches), then bytes are stable again. Storage already recorded stamps unconditionally, so full history times surface immediately.

中文说明

#4313 消息时间戳的渲染门控从"默认关"翻转为"默认开"。

依据:对生产会话(本 lane,sglang/qwen3.8-27b)做了开关前后的缓存泄露审计——两侧命中率均 95.0%、identity residual 0;开启后仅有的非折叠低命中全部是上游 idle ~5–7min TTL 驱逐指纹(恢复形态:下一条立刻回 98–99.8%,与重写型泄露持续 miss 的形态相反)。代码层 time= 只读存储值不读墙钟(render-refs.ts),提示词双变体实例级一次解析(#394)——存戳渲染跨轮逐字节恒定,没有可泄露进冻结前缀的东西。

改动面:

  • src/config.ts resolveMessageTimestamps():unset ⇒ fileCompress?.messageTimestamps !== false(默认 true);JSDoc/字段注释翻写并记录一次性前缀重写披露
  • tests/preload-test-env.mjs 套件级 pin BILI_MESSAGE_TIMESTAMPS="0":所有字节对比型基线保持特性前形态(同 XDG roots 无条件赋值纪律)
  • 新增 tests/message-timestamps-default-on.test.ts:scrubbed env + 真实配置文件下钉住生产默认路径端到端为 ON,以及同一生产表达式下的 file-false opt-out 零分叉
  • tests/issue4313-message-timestamp-toggle.test.ts 按新契约翻转(env > file > default TRUE),OFF 路径改 explicit-off(env "0"),新增两条 PRODUCTION DEFAULT 钉测(变体选择 + 回执 span)
  • 文档:yaml seed default/desc/site(EN/ZH)+ gen-config-docs 重新生成 + CONFIGURATION.md/.zh-CN.md 手维护详细段 + CHANGELOG [Unreleased] 条目;config-surface-guard 绿
  • Web 按钮配置(commit 2):src/web/client.ts Configuration 页 quick-fields 新增消息时间戳 checkbox(紧挨 promptPack)——勾选=删键回到默认开,取消勾选=写显式 compress.messageTimestamps: false(删除键会静默解析回开,所以必须写显式 false);初始态按 !== false 镜像现值;i18n 中英双词条

关闭方式不变:文件 compress.messageTimestamps: false 或 BILI_MESSAGE_TIMESTAMPS=0,每个出站字节与 pre-#4313 master 一致;现在 Web Configuration 页有一个真正的按钮开关(quick-fields,保存即写入该键)。

验证(正式全量留给远程 CI):tsc exit 0;定向+宽回归批 16 文件 124 pass / 0 fail / 1 skip(toggle 翻转套、新钉测、fingerprint、golden-storage-render、storage-unified、snapshot-shadow、dead-ranges/preflight-dead-ranges、issue4521、memory-contentstore、storage-corpus/review-fixes 等——同时实证 pin 使存量字节基线零漂移)。无 kernel 改动 → 无需版本 bump。e2e 车道不带 preload pin,跑真实 bili 即默认开路径的 CI 集成验证。

…#4313 bytes (#4313)

The #4313 stamps are deterministic render inputs: minted once per message at
first sight, rendered from stored values never wall clock, prompt variants
resolved once per instance. A live-session cache audit on this session's own
proxy showed identical hit rates (95.0%) with rendering on vs off — the only
non-fold low hits were upstream TTL-eviction fingerprints that fully recovered
on the next turn. So the leak-audit follow-up flips the display gate ON by
default: resolveMessageTimestamps() unset now means `!== false` instead of
`=== true`. Opt-out stays an honest switch: file compress.messageTimestamps:
false or env BILI_MESSAGE_TIMESTAMPS="0" reproduces every pre-#4313 outbound
byte (no time= attribute, original prompt texts, no receipt span). Upgrading
users pay ONE frozen-prefix rewrite per active session at the first restart
that resolves true, then bytes are stable again; storage already recorded the
stamps unconditionally so full history surfaces immediately.

- src/config.ts: resolveMessageTimestamps flip + JSDoc (audit basis, one-time
  rewrite disclosure, opt-out paths) + CompressSettings field docs
- tests/preload-test-env.mjs: suite-level pin BILI_MESSAGE_TIMESTAMPS="0" so
  every byte-comparing baseline keeps its pre-feature shape (same discipline
  as the XDG roots pins); explicit-off and production-default paths are driven
  by the suites themselves
- tests/message-timestamps-default-on.test.ts (new): the production expression
  resolveMessageTimestamps(loadConfigFile().compress) resolves ON under a
  scrubbed env + realistic config without the key, at both exits (prompt
  variants + resolve), and file-false stays zero-divergence through it
- tests/issue4313-message-timestamp-toggle.test.ts: flipped to env > file >
  default TRUE; OFF cases retargeted to explicit env "0"; two PRODUCTION
  DEFAULT pins added (TIMESTAMPED variant selection + receipt span appended)
- docs: yaml seed default/desc/site EN+ZH, gen-config-docs regenerated,
  hand-maintained detail sections (CONFIGURATION.md/.zh-CN.md), CHANGELOG
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-31_message-timestamps-default-on (16fa7d6)

Latest build — install this exact version

npm install -g billion-context@0.0.7580-pr.5368.b5d8ea7

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
16fa7d6 billion-context@0.0.7580-pr.5368.b5d8ea7 build
60925df billion-context@0.0.7579-pr.5368.0e88e76 build
9eb7148 billion-context@0.0.7578-pr.5368.eebe755 build
247785f billion-context@0.0.7576-pr.5368.90144d6 build
609908f billion-context@0.0.7574-pr.5368.cad447a build
4721275 billion-context@0.0.7571-pr.5368.1daa1d9 build

Download artifact

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

查重:无重复实现——本单与已打开的 GitHub PR #5368 一一对应(同题同体,镜像关系,PR 于 15:11Z 开)。相关历史:#4313 为原始特性请求(已完成关闭,10-31 04:37Z);#5183 是其早期草稿(未合并即关,被正式 #4313 实现取代)。不会另开第二个实现 PR。

标签:scope/wiring + p3(主机侧渲染门控/配置默认翻转,无 kernel 改动;带逐字节 opt-out 的有意变更,一次性前缀重写已披露)

这是 [PR] 单:PR #5368 已在途(head 2026-10-31_message-timestamps-default-on,1 commit,10 文件 +170/−48,mergeable=true、状态 behind)。按纪律不重做——我拉分支逐条核对代码与规格、确认 CI 状态后在此给结构化结论。

@ranxianglei
ranxianglei force-pushed the 2026-10-31_message-timestamps-default-on branch from ced29d0 to 609908f Compare October 31, 2026 15:19
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

审核结论:代码面通过,已顺手清掉一个继承性红,等 CI 绿即可合

本条是 GitHub PR #5368 的镜像(head ranxianglei:2026-10-31_message-timestamps-default-on)。按 [PR] 规则拉分支独立核对,未重做。PR 在审核期间新增了第二个 commit(609908f4b,Web quick-fields 显式开关——即原正文列的「可选后续」),两个 commit 都审了。

一、逐项核对(与规格一致)

  • src/config.ts resolveMessageTimestamps():只改默认行,unset ⇒ fileCompress?.messageTimestamps !== false;env 层语义逐字未动(定义且非 "0" ⇒ 开,"0" ⇒ 关)。三个生产出口全部走同一表达式:src/server.ts:520(core timestamps 门)、src/stream.ts:1448(回执 span)、src/external-summary-surface.ts:41(提示词变体)——无旁路读取。
  • tests/preload-test-env.mjs 套件级无条件 pin "0";官方两个 runner(scripts/test-suite-lock.mjs:236、scripts/run-ci-tests.mjs:185)都注入该 preload,新测试文件会被动态 glob 自动纳入 CI(listTestFiles readdir 实现,非显式清单)。
  • 新增 tests/message-timestamps-default-on.test.ts 钉住生产默认 ON + file-false opt-out 零分叉;toggle 套翻转为 env > file > default TRUE,OFF 路径改 explicit-off,两条 PRODUCTION DEFAULT 钉测(变体选择 + 回执 span)都有断言牙。
  • 文档 EN/ZH 全链同步(yaml seed / 生成表 / 手维护段 / env 表 / CHANGELOG);无 golden 文件变动。无 kernel 改动 → 无需版本 bump,正确。
  • 第二 commit(+10 行):restore 行用 cp.messageTimestamps !== false(与新文件层语义一致);取消勾选写显式 false、勾选删键——方向正确(删键会静默回开),注释把理由写清了;i18n 双语言齐全,模式与相邻 imageRescale 行同构。

二、本地定向验证(非全量,全量交给 CI)

  • tsc --noEmit exit 0(两个 head 各跑一次)。
  • 定向批 35/35 pass:两个时间戳套、config-surface-guard、golden-storage-render、issue4313-fingerprint、web-i18n。
  • 机制实证(我这边独立复现的):不带 preload 直接跑 golden-storage-render,恰好只在 tsStamps=/nudge= 两个 state 键漂移、wire blockContents 段与金标逐字节相等——正是「默认翻开的预期指纹」;带上官方 preload 链则 25/25 零漂移。翻转生效与 pin 的守护作用两头都实证了。

三、发现并已处理的问题(继承性红,非本 PR 代码问题)
分支基点落后 master 12 个 commit,继承了 #5345 pack-editor i18n fallout 的红:tests/web-i18n.test.ts 两项失败(cfg.q_pack_ai_p1 占位符失配 + cfg.q_pack_base_blank dead-key),master 侧已由 dc141fc31/9cd096029 修好。处置:把 origin/master 合进 PR 分支(merge commit 247785f58,零冲突,additive push 非 force),合并后本地复验 tsc 干净 + 35/35。CI 现在会在同步后的 head 上跑。

四、行为变更披露(必须说清)

五、CI 状态(写此回复时)
guard 车道已绿:kernel-guard / lane-guard / test-import-graph / pi-subagents-guard / lifecycle-ledger-guard success;全量 test 车道在旧 head 上被新 push 取消、正在 247785f58 上重跑。CI 终态出来我再跟一条结论,绿即可合。

@ranxianglei
ranxianglei force-pushed the 2026-10-31_message-timestamps-default-on branch 2 times, most recently from 9eb7148 to 60925df Compare October 31, 2026 15:40
…ields (#4313)

"Web-configurable" means a button, not hunting the key in the raw JSON
editor. The Configuration page's quick-fields now carry a checkbox next to
promptPack: checked = delete compress.messageTimestamps (resolves back to
the new default ON — writing an explicit true would be redundant state),
unchecked = write explicit false. Initial state mirrors the live value via
`!== false`, so an explicit true from a hand-edited config still shows the
box checked, and re-checking cleanly restores the default shape. i18n
entries land in both catalogs (cfg.q_message_ts EN/ZH).
@ranxianglei
ranxianglei force-pushed the 2026-10-31_message-timestamps-default-on branch from 60925df to 16fa7d6 Compare October 31, 2026 15:42
@ranxianglei
ranxianglei merged commit 4a4cedd into master Oct 31, 2026
31 of 32 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.973-master.4a4cedd (rolling master tag).

npm install -g billion-context@0.0.973-master.4a4cedd  # 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

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

跟进:分支被 force-push 更新,已重新同步并复验。

审核期间执行车道把第二个 commit 改进后重新推送(609908f4b → 16fa7d640,同标题),我上一条回复里的 master 同步 merge 随之被覆盖。新版改动核对过,是纯改进:quick-fields 开关移到 prompt-pack 行之上;勾选回开时若 compress 容器变空则整体删除(避免 uncheck→recheck 空转留下幻影 "compress": {} 让 dirty flag 永亮);对畸形 compress 值补了防御;i18n 双语文案改为面向用户的价值表述。语义与解析表达式仍完全一致。

处置:再次把 origin/master(当时已到 aaf4b1dc4)合进新 head——零冲突,本地 tsc 干净 + 定向批 35/35 pass(含 web-i18n,即此前继承性红的那套)。已推 bfea37851。CI 在该 head 上重跑中,终态出来我再跟一条最终结论。若车道还有后续迭代,合并后的 web-i18n 状态以最新 head 的 CI 为准。

Louie0806 pushed a commit to Louie0806/billion-context that referenced this pull request Oct 31, 2026
…d ref tags (ranxianglei#5368)

v0.1.210 turned ref-marker rendering on by default (ranxianglei#5368). This fixture's
mock relay echoed the first 48 chars of the last user message into every
model reply; with tags on by default that slice is a partial '<acp ...'
render-tag fragment. The host sanitizer (src/loop/tag-echo-filter.ts) then
correctly stripped the leaked tag-and-onward, leaving 16-char assistant
messages. The kernel's soft-protected zone (preserveRecentTokens=400) then
genuinely covered the whole 5-message view, so the scenario's compress call
no-op'd and 'parent must have a folded block' failed.

Echo the real text instead: strip the leading marker line and keep the text
below it, so the relay behaves like a real model that never re-emits render
tags. Verified both env shapes: default-on (CI shape, red before) and
BILI_MESSAGE_TIMESTAMPS=0 (pin) — 2/2 green either way.
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…e timestamps (#5368)

4721275 (#4313 flip) renders per-message timestamps by default; every
outbound body gained the same constant field (+186 B/turn), so the pre-#5368
committed goldens can no longer match. Regenerated via
scripts/update-storage-render-goldens.ts: turns=15 / foldAt=9 unchanged on
all four wires — digests only, no landmark or shape drift.
@github-actions github-actions Bot mentioned this pull request Nov 1, 2026
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…e environment (corrects 9eb1aa3)

9eb1aa3 regenerated outside the suite's preload chain, so it captured the
display-gate ON bytes (default since #5368) while every CI leg pins
BILI_MESSAGE_TIMESTAMPS=0 via tests/preload-test-env.mjs — the committed
digests could never match the pinned runners.

This run uses the exact CI invocation
(node --import ./tests/preload-storage-baseline.mjs --import ./tests/preload-test-env.mjs --import tsx),
so wire bodies are back on the pre-flip gate-off values and the
stateDigest fields pick up the persisted-state contract moves that landed
on master after the goldens' last refresh (#5338 cost ledger, #5412 async
latch parity, #5343 block archive). Turns=15/foldAt=9 unchanged; verified
green locally under the same preloads (storage-engine-proofs +
golden-storage-render).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant