Repository navigation
[PR] fix: observability gaps — unpriced-token ledger, health installPath, lineage column docs (#5647) - #5650
ranxianglei wants to merge 10 commits into
Conversation
…5647) Requests for models with no resolvable price (absent from billing.prices AND models.dev) returned early from both settle sites with no trace at all, so costUsdTotal understated spend by an unknown amount while dashboards read 0.00 as free. The same sites now accumulate raw tokens into stats.unpricedTokens {input,cacheRead,cacheWrite,output} when no price resolves; 0.00 + unpricedTokens > 0 now means unknown, not free. Persisted through the buildSession restore whitelist (validated by validUnpricedTokens, same discipline as validCostUsd) and exposed on /__bili/sessions rows and detail.
…supersedes_block_id column (#5647) bili --version can cite a different build than the running instance (self-update moves only the instance); version+commit identify the running copy, installPath now identifies WHICH install serves it so a skew is locatable. /__bili/health gains installPath = the package root of the serving bundle (JSON-omitted if unresolvable). Also documents blocks.supersedes_block_id as having no writer yet (always NULL) in both sqlite and mysql schema DDL, per the reporter's ask that tooling stop guessing events from it.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10985-pr.5650.edfccc7This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5650.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ability-gaps-5648
… persist field The unpriced-token ledger (#5647 item 3) now persists stats.unpricedTokens for sessions whose model has no resolvable price. The storage-render corpus (tests/golden-storage-drive.ts) is driven with setRegistryForTest({}) - an empty price registry - so every turn in it is unpriced and the new field enters the persisted stats blob. viewStateDigest digests that stats sub-object, so the four committed state digests shift. costUsd already sits in the same digested stats (added in #4899/#5303 with a matching golden regen), so regenerating is the consistent remedy. Regenerated under the script's documented parity pins (BILI_IMAGE_RESCALE=0 / BILI_SNAPSHOT_SHADOW=0 / BILI_MESSAGE_TIMESTAMPS=0); verified green locally under the preload launch (storage-engine-proofs + golden-storage-render + both #5647 suites, 28/28). Priced-traffic behavior stays byte-identical.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 检索了 open+closed 的 issue 与近期 PR(按失败签名 + 主题),没有并行在途工作覆盖 #5647 这三项(unpriced-token ledger / health installPath / lineage 列注释);PR 里 item 2(tokensSaved 无累加点)明确指向既有 #4700/#4723,不是重复立项。 标签: 结论先行:代码本身干净、正确、测试有牙;但 CI 红了——是它自己引入的回归,我已定位根因、修好并推回 PR 分支。 审了什么(独立重做,未照抄 issue 侧结论):
CI 红的根因(自引入,非继承、非 flaky): 怎么修的: 按脚本声明的 parity pin( 结构化八问:
行为变更披露(rule 4): 本次 golden 重生成不改任何运行时行为,只是把"现在会被持久化的 unpricedTokens 字段"钉进测试基线——纯测试契约更新,无旧值→新值的运行时漂移。(PR 本身的用户可见变更——web 面板多出 unpricedTokens、health 多出 installPath——已在 PR 描述的行为表里披露。) 判定: 代码可合(走人工合并;§7.4 不满足自动合并——属 feat + 持久化新增,正常)。等 CI 在新 head 上转绿即可合并。我不执行合并(PR 合并仅人工)。 |
(ai: vllm-qwen/qwen3.8-27b) 一句话:PR #5650 那 6 个红的 test 分片已经转绿。根因不是负载 flake,而是这个 PR 自己改了持久化形状却没同步参考快照;修复(重生成 4 个 storage-render golden)已经在分支上(18d7c28),我独立复现了同样的失败并本地验证修复有效。 接手过程:我按指派当这个 PR 的 CI 工程师查红 CI。排查中发现分支在我工作期间被并发推进过两次——先合入 ci-fixes(d175b3f→50d2ef70f0),再重生成 golden(50d2ef7→18d7c28f8)。golden 重生成这一步跟我独立推导出的修法逐字节完全一致,所以我没有再推一个重复 commit(避免冲突),改成独立复现 + 验证。 结构化结论(八问):
当前状态:head 18d7c28 的 CI 已全绿(镜像缓存:30 项 check 全部 success/skipped,0 失败、0 进行中)。合并是 owner 的动作,我不合 PR。 判定:红 CI 已闭环——根因 = 确定性快照漂移(非 flake),修法 = 同步 golden(已在分支并经独立复现验证),可交 owner 验收合并。 |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。本 PR 是 #5647 可无决策落地部分(第 1/3/5 项)的唯一实现;第 2 项(tokensSaved)明确指向既有 #4700/#4723,未重复实现;无其他在途 PR 触碰同一机制。 独立性声明: 以下结论基于本 PR diff 独立重读与本地定向验证产出。 八问
测试有效性: 两个新测试文件均为真断言(非恒真):reload round-trip、恢复后续累加而非清零、损坏 blob 拒绝、legacy 缺失保持缺失、priced 负门、真 server health e2e(含 #2941 启动期 503 轮询)。此 bug 类回归时抓得住。 CI: head 结论: 可合并(APPROVE)。未发现需要顺手修的机械性小问题。 |
(ai: vllm-qwen/qwen3.8-27b) 来源:#5660 四车道源码验证——F2「压缩后条条带 id」前提不全部成立(opencode v1/v2 不保证、pi/dsh 有条件保证,结论表见该 issue)。对本 PR 的两个直接影响(均不动数据面):
|
|
Branch is now |
…torage-render goldens) master advanced ~657 commits past the merge-base (d7a1a91), including kernel 0.0.191 render/storage changes. All source files auto-merged cleanly; the only conflicts were the four tests/golden/storage-render/*.json, which both sides had modified. Resolved by regenerating them from the merged+rebuilt tree via scripts/update-storage-render-goldens.ts rather than hand-merging digests: the result preserves every one of master's per-turn wire-body / block / metadata bytes byte-for-byte and adds only this PR's stats.unpricedTokens field. Verified locally on the merged tree: golden-storage-render 5/5, storage-engine-proofs 12/12, issue5647-unpriced-tokens 9/9, issue5647-health-install-path 2/2.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved & pushed. The branch was What was wrong
How I resolved it
Verified (live, this run)
@MorningStar0709 — done: the branch is updated onto current master and CI is re-running; you didn't need push rights for this. 中文八问(供人工 reviewer):
收工判定:冲突已解决并推送(fast-forward,无 force-push);merge 状态 |
(ai: vllm-qwen/qwen3.8-27b) No action taken this run — the reported conflict does not exist in the live state. I verified directly instead of trusting the forward (status-freshness rule):
Current live state: CI is re-running on I deliberately did not re-merge or force-push — that would only add a pointless no-op commit and risk racing a concurrent agent on the branch. There is nothing to fix. 中文八问(供人工 reviewer):
判定:无需任何操作。冲突已在上一轮解决,且本轮实时状态确认仍为「无冲突(blocked)」;等 CI 全矩阵在新 head 上转绿即可合并。若后续出现真实 CI 红项,会作为独立事件另行处置。 |
|
(ai: vllm-qwen/qwen3.8-27b) Round-2 review — head Note: this account cannot approve its own PR (GitHub restriction); this comment carries the equivalent review verdict. What changed since the previous review ( Independence: the effective delta was re-derived against the CURRENT merge-base, every source hunk re-read in the merged tree, and local verification re-run on the new head — not carried over from round 1. Duplicate screening: not a duplicate — remains the sole implementation of #5647's decision-free items (1/3/5); item 2 stays under #4700/#4723; no parallel work found. 八问
CI:mirror cache @ 结论:可合并(APPROVE)。无需顺手修的小问题,无遗留开口。 |
Round-2 review done for new head |
Resolve tests/golden/storage-render/chat.json conflict by regenerating all 4 storage-render goldens from the merged tree. Delta vs master is only the unpricedTokens stats field (stateDigest/stateDigestAligned/sectionDigests.stats); wire bodies byte-identical to master.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed — Unlike the two prior forwards (which were stale duplicates of an already-resolved state), this one was real and fresh:
Resolution (the proven workflow): merged live master into the PR branch, rebuilt (the 420 commits carry a heavier Correctness proof (field-by-field vs master): for all 4 goldens the only differences are Verified before push: local CI-parity run of the 4 relevant test files ( Post-push state: 中文八问(供人工 reviewer):
判定:冲突已解决并推送( |
|
(ai: vllm-qwen/qwen3.8-27b) Round-3 review — head Note: this account cannot approve its own PR (GitHub restriction); this comment carries the equivalent review verdict. What changed since the previous reviewed head (
CI (mirror cache @ 八问
结论:可合并(APPROVE)。无需顺手修的小问题,无遗留开口;全量 test 分片跑完前无失败信号。 |
Round-3 review done for new head |
CI status update for |
Resolve tests/golden/storage-render/{chat,anthropic,responses,google}.json conflicts by regenerating all 4 storage-render goldens from the merged tree (master 77fe0b1, kernel 0.0.198). Delta vs master is only the unpricedTokens stats field; wire bodies byte-identical to master.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed — This is the 3rd re-conflict in this session from master churn. Master advanced another 185 commits ( Resolution (same proven mechanical workflow): merged live master into the PR branch (only the 4 generated goldens conflicted; Correctness proof (field-by-field vs master Post-push:
中文八问(供人工 reviewer):
判定:冲突已解决并推送( |
summaryFromRow (the full-mode / shadow fresh-row projection) whitelisted stats fields for the web list but carried costUsd without the new unpricedTokens ledger — full-mode list rows (and shadow mode's fresh-row adoption) silently dropped it while the file-decode path (summaryFromRecord) and the detail view kept it. Add the field to the projection (one line, same validator) and pin it with a full-mode row-path regression test in the web single-store suite (verified red on the pre-fix head).
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm/qwen3.8-27b)
Verdict: APPROVE (posted as a comment review — the bot account owns the PR, and GitHub forbids approving one's own PR) — clean, well-scoped, host-side-only; every claim in the body verified against the code independently.
Verified (not taken from the PR body):
- Item 3 (unpriced ledger): the unpriced branch of
billInputUsage/billOutputUsage(src/billing.ts:214/236) mirrors the priced path's token decomposition exactly (fresh / min(cached,total) / creation); the priced math is byte-identical (same expressions, same order; the stamp read is pure).validUnpricedTokensmirrorsvalidCostUsdfield-for-field. Round-trip confirmed:buildRecordspreadssession.stats(src/persist.ts:4161),buildSessionwhitelists through the new validator (src/persist.ts:4323) — the #5303 drop-class is covered. - Item 5 (installPath): the
pkgRoot()refactor (src/version.ts) preserves behavior for every valid layout (flat entry →.., subdir bundle →../..); the only divergent case (malformed package.json at the first candidate) now degrades to the fallback instead of reaching past it into an unrelated grandparent — more conservative, not a regression.installPathis omitted from the health JSON when unresolvable (undefined drops out of JSON.stringify) — honest degradation as claimed. - Item 1 (lineage column): confirmed no writer exists — the only assignment in the repo is the explicit
supersedesBlockId: nullat src/storage/ingest.ts:475; kernel block shapes never set it. DDL comments are accurate; comment-only, no DDL change. - Wire: unchanged — in the regenerated storage-render goldens the per-turn wire shas are untouched; only the persisted-state stats digest moved (the golden corpus model
gpt-golden-ahas no price, so its traffic now lands in the new field). Legitimate regen. - Tests: both new suites have teeth — round-trip, negative priced gate, mid-session price-loss split, corrupt-blob rejection, legacy absence (unpriced); health unit + server e2e with the pre-existing identity fields pinned.
已顺手修:summaryFromRow (src/web/sessions-data.ts:754) — the unified-index row projection carried costUsd but dropped the new unpricedTokens field, so full-mode list rows (and shadow mode's fresh-row adoption) silently lost the ledger while the file-decode path and the detail view kept it. One-line fix + a full-mode row-path regression test in tests/issue4990-web-single-store.test.ts (verified red on the pre-fix head, green with the fix). + commit 02267ca
八问(结构化结论)
- 是什么问题:#5647 报告的四个可观测性缺口——无价模型流量在账单里"凭空消失"(0.00 被误读为免费)、CLI 与运行实例版本漂移无法定位、
blocks.supersedes_block_id恒 NULL 且无人说明(item 2 由 #4723 承接、item 4 走决策评论,均不在本 PR)。 - 什么原因导致的:结算点在价格解析失败时直接 early-return,原始 token 数没有任何落账;
/__bili/health只有 version+commit,没有安装路径,无法区分"哪个安装在服务";supersedes_block_id列自始没有写入方(唯一赋值是 ingest 的显式 null)。 - 影响范围与严重程度:纯可观测性/展示面——计费、压缩、线上行为全部不变;影响面是所有无价模型流量(如 issue 里 kimi-for-coding 1041 请求 / 95.6M input 记 0.00)的账单解读。体验瑕疵级,无数据丢失、无安全面。
- 怎么修复的:结算点在无价时把原始 token 累进新的
stats.unpricedTokens账本(与 costUsd 同一套校验/恢复/展示纪律);health 增加installPath(从既有 package-root 上行走取,解析失败则字段省略);两个 DDL 加注释声明该列无写入方、工具不得从 NULL 推断事件。 - 是否有回归问题:逐项过过——priced 路径计费数学逐字节不变(表达式与顺序相同);持久化格式未升版(stats_json 新增可选键:旧文件读回无此键=无账本,新文件被旧代码读=忽略未知键);
readPkgField重构对一切合法安装布局行为一致(唯一分歧场景:首个候选 package.json 损坏时,旧代码会越级读祖父目录的 package.json,新代码退回 fallback——更保守);health 响应只增字段;wire 零变化(golden 每轮 wire sha 未动)。审核中另发现并当场修掉一处真缺口:统一存储行投影(summaryFromRow)漏带新字段,full 模式列表行会静默丢账本(见上"已顺手修")。 - 是否破坏缓存:不涉及——不触碰任何缓存/重试/增量游标/去重键。
- 是否改了设计方向:不涉及——纯 host 侧可观测性补齐,无架构/边界/数据流转向;kernel 未动。
- 是否引入了新的配置:无——
unpricedTokens是输出字段不是配置输入;无新 env、无新 config key(PR 正文已按规范声明)。
Regression audit (existing behaviors of touched paths): billing settle sites (priced math unchanged) / persist round-trip (additive optional key, validator-gated) / version resolution (behavior-preserving refactor) / health endpoint (additive field) / web session list+detail (additive field + the row-path fix above) / storage DDL (comments only). No kernel, no wire, no config schema, no persistence version.
Verdict: APPROVE — mergeable once CI is green on the new head (02267ca).
Round-4 review done for new head |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm/qwen3.8-27b)
Round-5 review — head 02267cae1. Verdict: APPROVE / mergeable.
Note: this account cannot approve its own PR (GitHub restriction); this comment carries the equivalent review verdict.
What changed since the previous reviewed head (deb4531d6): exactly one commit — 02267cae "fix: surface unpricedTokens on the unified-row web list path (#5647)", the round-4 on-the-spot fix by the review worker (reviewer-authored, not an author commit). Two files, +39/−1:
src/web/sessions-data.ts(+4):summaryFromRow(the unified-index row projection) now carriesunpricedTokens: validUnpricedTokens(stats.unpricedTokens)alongsidecostUsd— closing the gap where full-mode list rows and shadow mode's fresh-row adoption silently dropped the new ledger while the file-decode path and the detail view kept it.tests/issue4990-web-single-store.test.ts(+36/−1): localStatsinterface extended with the optional field + a full-mode row-path regression test (seed a session with a non-zero ledger, remove the JSON twin,buildSessionList, assert the row carries the ledger).
Independence: the fix hunk was re-read in the merged tree — minimal (one projection line + a why-comment, same validator as the record path, no new predicate, no behavior change beyond surfacing the field the record path already carries). The regression test was verified red on the pre-fix head and green with the fix.
Freshness: live master 77fe0b1d63 is the merge-base — 0 commits ahead; branch is current, no conflict possible.
Local verification (this exact head, clean tree): issue4990-web-single-store 3/3; issue5647-unpriced-tokens + issue5647-health-install-path + billing-web + billing-prices + issue5303-costusd-restore 34/34; web-sessions + issue3199-overview-cold-scan 32/32; typecheck clean.
CI (mirror cache @ 02267cae1): 30 checks, 0 failed, 0 pending — 15 success + 15 skipped, fully green.
八问
- 是什么问题:与第 4 轮相同——#5647 的三个可落地观测缺口(无价流量零痕迹、health 无安装路径、恒 NULL lineage 列无文档);本轮增量 = 第 4 轮发现的行投影漏字段已修复。
- 什么原因导致的:未变(结算点无价早退丢 token、health 无安装根通道、DDL 未声明无写入方);增量原因:统一存储行投影的 stats 白名单是逐字段手写的,新字段加进了记录路径但漏进了行投影路径。
- 影响范围与严重程度:纯观测面,无用户行为影响;增量修复消除了 full 模式列表行/影子模式新行静默丢账本的缺口,无可用性影响。
- 怎么修复的:行投影白名单补一行(与记录路径同一校验器
validUnpricedTokens),并加 full 模式行路径回归测试钉住(修复前红、修复后绿)。 - 是否有回归问题:无。增量 diff 仅 2 文件 +39/−1:投影加一个可选输出字段(无新谓词、无行为变化,只是把记录路径已有的字段带到行路径)+ 测试。priced 计费数学、持久化格式、wire、缓存键均未触碰;master 领先 0 提交,无合并交互风险。
- 是否破坏缓存:不涉及。
- 是否改了设计方向:不涉及。
- 是否引入了新的配置:无。
结论:可合并(APPROVE)。无新发现、无遗留开口;CI 全绿,等 owner 合并。
Round-5 review done for head |
Resolve the recurring storage-render golden conflict: master's CI regenerated tests/golden/storage-render/*.json (kernel 0.0.199), which textually conflicts with this PR's unpricedTokens stats field. Regenerated all 4 goldens from the merged tree via scripts/update-storage-render-goldens.ts; per-file delta vs master is ONLY stateDigest/stateDigestAligned/sectionDigests.stats (the unpricedTokens ledger) - wire bodies byte-identical. Local: golden + storage-engine-proofs + issue5647 + issue4990 tests 31/31, typecheck clean.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved (4th re-conflict on this PR). Live master had advanced 88 commits ( What I did this run:
八问
判定:冲突已解决,PR 在当前 master( |
(ai: vllm-qwen/qwen3.8-27b) No action needed — stale forward. I verified live this run:
The "conflicts (dirty)" state this forward reports was already cleared by my previous run's push (Churn note: this is the 6th conflict forward for this PR; 4 were real and resolved, 2 were stale. The root cause — this PR's 八问
判定:无活动冲突,本轮无操作。 等镜像缓存刷新到 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm/qwen3.8-27b)
Round-6 review — head 2789d1039. Verdict: APPROVE / mergeable.
Note: this account cannot approve its own PR (GitHub restriction); this comment carries the equivalent review verdict.
What changed since the previous reviewed head (02267cae1): exactly one commit — 2789d1039 "Merge origin/master (a446a3c) into 2026-11-04_observability-gaps-5648", the 4th master-churn re-merge (master advanced ~80 commits, the wave11 batch incl. #6775 persisted fields). No new author commits.
Independence (re-derived, not carried over):
- Freshness: live master
a446a3c1cIS the merge-base — 0 commits ahead; branch is current, no conflict possible. - Effective diff (master → PR head): 15 files, +414/−30 — same shape as the previously reviewed effective diff. Diffed the two effective diffs hunk-by-hunk: the ONLY differences are (a) hunk line-offsets in src/persist.ts (master added lines above the PR's hunks), (b) git blob-index lines, (c) the 4 storage-render goldens — and for those, the PR's contribution on top of MASTER's goldens (which already carry master's #6775 persisted-field digests) is exactly
stateDigest/stateDigestAligned/stats-section digests per file. Every source hunk is byte-identical to what was verified in rounds 1–5. - No kernel involvement in the effective diff — no authorization boundary engaged.
Local verification (this exact merged head, clean tree):
golden-storage-render+storage-engine-proofs17/17 — the decisive check for the 4th golden union: the merged golden files (master's #6775 fields + this PR'sunpricedTokens) match exactly what the merged code produces;- issue5647-unpriced-tokens + issue5647-health-install-path + issue4990-web-single-store + billing-prices + billing-web + issue5303-costusd-restore + build-info: 41 pass / 0 fail / 3 skip;
- web-sessions + issue3199-overview-cold-scan: 32/32;
- typecheck clean.
CI (mirror cache @ 2789d1039): 30 checks, 0 failed, 6 in progress (14 skipped + 10 success complete) — the full-suite test shards are running; no failure signal.
八问
- 是什么问题:与第 5 轮相同——#5647 的三个可落地观测缺口(无价流量零痕迹、health 无安装路径、恒 NULL lineage 列无文档)+ 第 4 轮已修的行投影漏字段;本轮增量仅为第 4 次 master 冲突重并。
- 什么原因导致的:未变;增量原因:PR 分支 15 天未动,期间 master 高速前进(wave11 批次 ~80 提交,含 #6775 持久化字段),再次触碰同样 4 个 golden 文件 → 第 4 次 3-way 冲突。
- 影响范围与严重程度:纯观测面,无用户行为影响;本轮增量为纯合并操作,无新代码。
- 怎么修复的:CI 工程师把 live master 合入分支,从合并树重新生成 4 个 golden(既有成熟流程);本轮审核独立重验了合并结果(有效 diff 逐块比对 + golden 并集本地复跑)。
- 是否有回归问题:无。有效 diff 与第 5 轮审核过的逐字节一致(仅 persist.ts hunk 行偏移 + golden 摘要);master 领先 0 提交;golden 并集经本地 golden-storage-render + storage-engine-proofs 17/17 证明与合并树代码产出一致;wire 体不变。
- 是否破坏缓存:不涉及。
- 是否改了设计方向:不涉及。
- 是否引入了新的配置:无。
结论:可合并(APPROVE)。无新发现、无遗留开口;CI 全量分片在跑、零失败信号,等 owner 合并。
Round-6 review done for head |
Conflicts were confined to the four storage-render golden digests (stateDigest / stateDigestAligned / sectionDigests.stats). Resolved by rebuilding kernel + pi-subagents and regenerating the goldens from the merged code via scripts/update-storage-render-goldens.ts — the merged stats carry the PR's unpricedTokens field while metadata/state/ blockContents take master's values. Verified: typecheck clean, full build clean, tests/golden-storage-render.test.ts green (4 wires + orphan check).
(ai: vllm-qwen/qwen3.8-27b) Resolved the merge conflict on PR #5650 and pushed the new head. What I did this run
Live state (verified this run, not from memory)
八问
判定:冲突已解决并推送,CI 在新 head |
(ai: vllm-qwen/qwen3.8-27b) Round-7 review — head Note: this account cannot approve its own PR (GitHub restriction); this comment carries the equivalent review verdict. What changed since the previous reviewed head ( Independence: I re-derived the effective diff against the CURRENT merge-base, re-read every Duplicate screening: not a duplicate — remains the sole implementation of the #5647 decision-free items (1/3/5); item 2 stays under its own decision flow; no parallel work found. Re-verified this round (live, on
CI (mirror cache @ 八问
结论:可合并(APPROVE)。本轮未发现需顺手修的机械性小问题,无遗留开口。等待 owner 合并(合并仅人工)。 |
Round-7 review done for head |
Closes #5647
What this PR does
Covers the #5647 items closable on the host side without kernel or config-surface changes:
Item 3 — unpriced models silently count as free. Requests for a model with no resolvable price (absent from
billing.pricesAND models.dev) returned early from both settle sites (billInputUsage/billOutputUsage) with NO trace at all, socostUsdTotalunderstated spend by an unknown amount while dashboards read0.00as "free". The same sites now accumulate raw tokens into a newstats.unpricedTokens {input, cacheRead, cacheWrite, output}ledger when no price resolves — going forward0.00 + unpricedTokens > 0means unknown, not free. The ledger persists through thebuildSessionrestore whitelist (validated by a newvalidUnpricedTokens, same discipline asvalidCostUsd) and is exposed on/__bili/sessionslist rows and detail. This subsumes the reporter'spriced: falseask: ledger presence/non-zero is derivable, and it also says HOW MUCH is unknown.Item 5 — version skew between CLI and running instance.
/__bili/healthnow reportsinstallPath— the package root of the bundle actually serving requests (extracted from the existing package-root walk-up insrc/version.ts). Together with the existingversion+commit, a report can locate WHICH install serves the running copy, so a skew is locatable instead of guessed. The field is omitted when unresolvable (honest degradation).Item 1 (partial) —
blocks.supersedes_block_idalways NULL. Verified: the column has NO writer anywhere — the schema declares it, the store passes through what callers provide, but nothing in the repo (kernel block shapes included) ever sets it. Per the reporter's alternative ask, both DDLs (sqliteschema.ts, mysqlmysql.ts) now document that no writer exists yet and tooling must not infer events from its NULLness. Populating real lineage (tier-upgrade supersession + retirement reason) needs a kernel change → decision comment posted on the issue thread.Item 2 — tracked elsewhere, not duplicated here. DB
tokensSaved=0while the API reports values is exactly #4700 (the counter has no incrementer; the web layer derives the value from blocks). Fix PR #4723 is open and credits the counter at the shared fold-commit point on every lane; once merged, DB and API converge.Item 4 — pending decision. The residual miss bucket ("TTL expiry / eviction or client-side wire rewrite") is computed inside the kernel (
kernel/src/cache-report.ts), and the requested discriminator (first-diverging message id behind a debug flag) implies BOTH a kernel change AND a new config knob — double owner gate. Options posted as a decision comment on the issue.Behavior changes (old → new)
stats_json)unpricedTokens; absent when no unpriced traffic/__bili/sessionsrows + detailunpricedTokens(same shape); absent for priced-only sessions/__bili/healthinstallPath(string; omitted if unresolvable)billInputUsageinternalsNo wire-protocol, kernel, config-schema, or persistence-format-version changes.
Config surface
None added —
unpricedTokensis an output field (session stats + API response), not a config input; no new env var, no new config key.Verification
npm run typecheckclean (incl. kernel + pi-subagents pre-builds).tests/issue5647-unpriced-tokens.test.ts(8 tests: split/inclusive/zero input semantics, output, priced negative gate, mid-session price-loss split, validator table, reload round-trip, restored-accumulation, corrupt-blob rejection, legacy-absence) andtests/issue5647-health-install-path.test.ts(unit + server e2e), plus the existing consumers of the touched surfaces:tests/billing-prices.test.ts,tests/issue5303-costusd-restore.test.ts,tests/billing-web.test.ts,tests/web-sessions.test.ts,tests/issue4990-web-single-store.test.ts,tests/issue3199-overview-cold-scan.test.ts,tests/build-info.test.ts— all pass. Full-suite verdict left to CI.