Skip to content

fix: 运行中会话的详情面板不再误显示 legacy(仅 JSON)存储与版本 —(自 #3093) - #3094

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-14_fix-3093-live-stamp
Oct 14, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-14_fix-3093-live-stamp

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #3093

修的是什么

溯源章(biliVersion/storageMode)以前只盖在落盘记录上(persist.ts buildRecord);内存里的活会话对象永远没有这两个字段。详情接口对运行中会话直接取内存对象(sessions-data.ts buildSessionDetail,内存命中就不走盘),响应里缺章,前端 fallback 成 legacy(仅 JSON) + 版本 ———无论实际是 full 还是 shadow。落盘/重启后从盘恢复才正常。

修法(issue 推荐方案 A)

会话创建的唯一入口 createSession 直接把两个章盖进内存 session.metadata:

  • src/session.ts:metadata: {} → metadata: { biliVersion: VERSION, storageMode: effectiveFileStorageMode() }(存储模式是进程级常量,创建时盖章即终身正确);
  • src/persist.ts:导出既有的 effectiveFileStorageMode()(零逻辑变更);
  • tests/web-sessions.test.ts:新增回归测试——从未落盘的运行中会话,内存 metadata 必须带两章、详情接口必须返回它们。无修复时红、有修复时绿(已双向验证)。

行为变更披露

  • 详情接口响应:运行中且尚未落盘的会话现在会带上 biliVersion/storageMode 字段(以前缺失 → 前端显示 legacy + —)。这正是本 bug 的预期修复。
  • 盘上记录:不变。buildRecord 的展开+显式覆盖输出与之前字节一致(Storage layer: four concrete defects (filename coupling, multi-writer heuristic, non-atomic content-store write, immortal compressed sessions) #2671 既有落盘章测试全部通过)。
  • 摘要校验 digest:不受扰动。canonicalize 对 biliVersion 值掩码为 __VER__、对 storageMode 整键丢弃,活会话 metadata 多这两个键不改变 digest。
  • 前端 fallback 逻辑保留不动:对 stamp 机制上线前的老文件仍显示诚实的 legacy/—。
  • 未引入新配置项;不碰 kernel/、pi-subagents/、wire 协议。

验证

  • npm run typecheck clean;
  • 定向测试:tests/web-sessions.test.ts 24/24 通过(含新测试);persist-stats-roundtrip / storage-corpus / proxy-persist / session-transient-memory / subagent-sessions 合计 45 例中 43 通过——proxy-persist 里挂的 2 例(scheduleSave debounces / flushSync writes)在不含本 PR 改动的 master 上同样失败(本地环境问题,与本 diff 无关),全量以 CI 为准。

The web detail panel read running (never-persisted) sessions straight from
memory, where session.metadata never carried the provenance stamps — those
were only applied to disk records in buildRecord. The frontend then fell
back to legacy/"—" for every live session regardless of the real storage
mode. Stamp both fields in createSession (the single choke point for new
in-memory sessions); buildRecord re-stamps identical values on save so disk
records are byte-identical, and canonical.ts already masks/drops these keys
so digests are undisturbed.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-14_fix-3093-live-stamp (64b50fd)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3524-pr.3094.de89f54

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

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

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

收到,开始 review 本 PR(分支 2026-10-14_fix-3093-live-stamp)。流程:先读原 issue #3093 定方向 → 拉 diff 逐行审 + 回归清点(既有落盘章、digest、详情接口行为)→ 测试有效性 → 按八问答复。稍后给结论。

@ranxianglei
ranxianglei merged commit 6887bbd into master Oct 14, 2026
30 of 34 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.397-master.6887bbd (rolling master tag).

npm install -g billion-context@0.0.397-master.6887bbd  # 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 14, 2026
The unused-exports gate (#1440 P6) fails on this branch: ReportOpts/ReportData/SvgReport in src/web/report.ts are only referenced within their own file yet declared as exports. Drop the leading 'export' per the gate's prescribed INTERNAL_ONLY fix. No behavior change: admin.ts and the tests import only the two buildSessionReport* functions. Branch also rebased onto current master (6887bbd, +#3094; no file overlap with this PR). Found while reviewing #3099.
ranxianglei pushed a commit that referenced this pull request Oct 14, 2026
The unused-exports gate (#1440 P6) fails on this branch: ReportOpts/ReportData/SvgReport in src/web/report.ts are only referenced within their own file yet declared as exports. Drop the leading 'export' per the gate's prescribed INTERNAL_ONLY fix. No behavior change: admin.ts and the tests import only the two buildSessionReport* functions. Branch also rebased onto current master (6887bbd, +#3094; no file overlap with this PR). Found while reviewing #3099.
@ranxianglei
ranxianglei deleted the 2026-10-14_fix-3093-live-stamp branch October 15, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

会话详情面板:运行中的会话一律显示 legacy(仅 JSON)存储、代理版本 —,落盘后才恢复正常(实际存储正常)

1 participant